forked from kubernetes-client/javascript
-
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.
chore: test examples and update docs
- Loading branch information
1 parent
c431ef3
commit a112a84
Showing
18 changed files
with
107 additions
and
57 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
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import k8s = require('@kubernetes/client-node'); | ||
// in a real program use require('@kubernetes/client-node') | ||
import * as k8s from '../../../dist'; | ||
|
||
const kc = new k8s.KubeConfig(); | ||
kc.loadFromDefault(); | ||
|
||
const attach = new k8s.Attach(kc); | ||
attach.attach('default', 'nginx-4217019353-9gl4s', 'nginx', | ||
process.stdout, process.stderr, null /* stdin */, false /* tty */); | ||
|
||
const namespace = 'default'; | ||
const pod = 'nginx-4217019353-9gl4s'; | ||
const container = 'nginx'; | ||
|
||
attach.attach(namespace, pod, container, process.stdout, process.stderr, null /* stdin */, false /* tty */); |
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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import * as k8s from '@kubernetes/client-node'; | ||
// in a real program use require('@kubernetes/client-node') | ||
import * as k8s from '../../../dist'; | ||
|
||
const kc = new k8s.KubeConfig(); | ||
kc.loadFromDefault(); | ||
|
||
const cp = new k8s.Cp(kc); | ||
cp.cpFromPod('default', 'nginx-4217019353-9gl4s', 'nginx', './test.txt', '/tmp'); | ||
|
||
const namespace = 'default'; | ||
const pod = 'nginx-4217019353-9gl4s'; | ||
const container = 'nginx'; | ||
const srcPath = '/test.txt'; | ||
const targetPath = '/tmp'; | ||
|
||
cp.cpFromPod(namespace, pod, container, srcPath, targetPath); |
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 |
---|---|---|
@@ -1,18 +1,21 @@ | ||
import * as k8s from '@kubernetes/client-node'; | ||
// in a real program use require('@kubernetes/client-node') | ||
import * as k8s from '../../../dist'; | ||
import * as net from 'net'; | ||
|
||
const command = process.argv[2]; | ||
|
||
const kc = new k8s.KubeConfig(); | ||
kc.loadFromDefault(); | ||
|
||
const forward = new k8s.PortForward(kc); | ||
|
||
const namespace = 'default'; | ||
const pod = 'demo'; | ||
const port = 8080; | ||
|
||
// This simple server just forwards traffic from itself to a service running in kubernetes | ||
// -> localhost:8080 -> port-forward-tunnel -> kubernetes-pod | ||
// This is basically equivalent to 'kubectl port-forward ...' but in TypeScript. | ||
const server = net.createServer((socket) => { | ||
forward.portForward('default', 'demo', [8080], socket, null, socket); | ||
forward.portForward(namespace, pod, [port], socket, null, socket); | ||
}); | ||
|
||
server.listen(8080, '127.0.0.1'); | ||
server.listen(port, '127.0.0.1'); |
Oops, something went wrong.