-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement tunnel-based APIs (Exec, Attach, Portforward) (#6)
* fix(generation): Implement quirked argv parameters It seems like Kubernetes should OpenAPI should be changed to present this argument properly. In any non-trivial case, it will be a list. * Collapse param building loop for lists * Properly implement PodExec with examples * Improve PodExec interface and examples * Add missing method on PortforwardTunnel * Drop Deno v1.22 from CI - lacks Deno.consoleSize() * Update /x/kubernetes_client to v0.7.0 * Put 'tunnel' into tunnel API names * Fix array arg of portforward API too * Get PortForward going with WebSockets * Rename ChannelTunnel to StdioTunnel * Add a basic test for each tunnel utility class * Make test green on somewhat older Denos (v1.28) * Update README
- Loading branch information
Showing
11 changed files
with
627 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
// so this is provided an optional utility (as opposed to deps.ts) | ||
|
||
export * from "https://deno.land/x/[email protected]/mod.ts"; | ||
export * as tunnelBeta from "https://deno.land/x/[email protected]/tunnel-beta/via-websocket.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env -S deno run --allow-net --allow-read --allow-env --unstable | ||
|
||
import { tunnelBeta, makeClientProviderChain } from '../client.ts'; | ||
import { CoreV1Api } from '../builtin/core@v1/mod.ts'; | ||
|
||
// Set up an experimental client which can use Websockets | ||
const client = await makeClientProviderChain(tunnelBeta.WebsocketRestClient).getClient(); | ||
const coreApi = new CoreV1Api(client); | ||
|
||
// Launch a process into a particular container | ||
const tunnel = await coreApi | ||
.namespace('media') | ||
.tunnelPodExec('sabnzbd-srv-0', { | ||
command: ['uname', '-a'], | ||
stdout: true, | ||
stderr: true, | ||
}); | ||
|
||
// Buffer & print the contents of stdout | ||
const output = await tunnel.output(); | ||
console.log(new TextDecoder().decode(output.stdout).trimEnd()); | ||
|
||
// Print any error that occurred | ||
if (output.status !== 'Success') { | ||
console.error(output.message); | ||
} |
Oops, something went wrong.