@toa.io/cli 1.1.0-dev.1 → 1.1.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/readme.md +20 -1
- package/src/commands/export/deployment.js +2 -2
- package/src/commands/export/images.js +2 -2
- package/src/commands/shell.js +22 -0
- package/src/handlers/replay.js +2 -1
- package/src/handlers/shell.js +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/cli",
|
|
3
|
-
"version": "1.1.0-dev.
|
|
3
|
+
"version": "1.1.0-dev.11",
|
|
4
4
|
"description": "Toa CLI",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@toa.io/console": "0.6.0",
|
|
26
|
-
"@toa.io/generic": "0.11.0-dev.
|
|
27
|
-
"@toa.io/kubernetes": "0.7.5-dev.
|
|
28
|
-
"@toa.io/norm": "1.0.2-dev.
|
|
29
|
-
"@toa.io/yaml": "0.7.6-dev.
|
|
26
|
+
"@toa.io/generic": "0.11.0-dev.11",
|
|
27
|
+
"@toa.io/kubernetes": "0.7.5-dev.11",
|
|
28
|
+
"@toa.io/norm": "1.0.2-dev.11",
|
|
29
|
+
"@toa.io/yaml": "0.7.6-dev.11",
|
|
30
30
|
"find-up": "5.0.0",
|
|
31
31
|
"yargs": "17.6.2"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "43f790e208d5eea38a8d3f09136dc1221d26ccc3"
|
|
34
34
|
}
|
package/readme.md
CHANGED
|
@@ -57,7 +57,8 @@ the context will be found and replayed sequentially.
|
|
|
57
57
|
<code>--error</code> print errors only<br/>
|
|
58
58
|
</dd>
|
|
59
59
|
</dl>
|
|
60
|
-
|
|
60
|
+
|
|
61
|
+
## Operations
|
|
61
62
|
|
|
62
63
|
> Deployment commands use current `kubectl` context.
|
|
63
64
|
|
|
@@ -93,3 +94,21 @@ the context will be found and replayed sequentially.
|
|
|
93
94
|
</dt>
|
|
94
95
|
<dd>Print keys and values of a secret.</dd>
|
|
95
96
|
</dl>
|
|
97
|
+
|
|
98
|
+
### shell
|
|
99
|
+
|
|
100
|
+
<dl>
|
|
101
|
+
<dt>
|
|
102
|
+
<code>toa shell [image]</code>
|
|
103
|
+
</dt>
|
|
104
|
+
<dd>Run interactive shell inside the current Kubernetes context using disposable pod.
|
|
105
|
+
|
|
106
|
+
<code>image</code> docker image<br/>
|
|
107
|
+
</dd>
|
|
108
|
+
</dl>
|
|
109
|
+
|
|
110
|
+
Extra arguments may be passed:
|
|
111
|
+
|
|
112
|
+
```shell
|
|
113
|
+
$ toa shell -- ping 1.1
|
|
114
|
+
```
|
|
@@ -6,7 +6,7 @@ const builder = (yargs) => {
|
|
|
6
6
|
yargs
|
|
7
7
|
.positional('target', {
|
|
8
8
|
type: 'string',
|
|
9
|
-
desc: '
|
|
9
|
+
desc: 'Path to export to'
|
|
10
10
|
})
|
|
11
11
|
.positional('environment', {
|
|
12
12
|
type: 'string',
|
|
@@ -21,7 +21,7 @@ const builder = (yargs) => {
|
|
|
21
21
|
})
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
exports.command = ['deployment <target>
|
|
24
|
+
exports.command = ['deployment <environment> <target>', 'dep']
|
|
25
25
|
exports.desc = 'Export context deployment'
|
|
26
26
|
exports.builder = builder
|
|
27
27
|
exports.handler = dump
|
|
@@ -6,7 +6,7 @@ const builder = (yargs) => {
|
|
|
6
6
|
yargs
|
|
7
7
|
.positional('target', {
|
|
8
8
|
type: 'string',
|
|
9
|
-
desc: '
|
|
9
|
+
desc: 'Path to export to'
|
|
10
10
|
})
|
|
11
11
|
.option('path', {
|
|
12
12
|
alias: 'p',
|
|
@@ -17,7 +17,7 @@ const builder = (yargs) => {
|
|
|
17
17
|
})
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
exports.command = ['images
|
|
20
|
+
exports.command = ['images <target>', 'img']
|
|
21
21
|
exports.desc = 'Export docker image sources'
|
|
22
22
|
exports.builder = builder
|
|
23
23
|
exports.handler = prepare
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { shell } = require('../handlers/shell')
|
|
4
|
+
|
|
5
|
+
const builder = (yargs) => {
|
|
6
|
+
yargs
|
|
7
|
+
.positional('image', {
|
|
8
|
+
group: 'Command options:',
|
|
9
|
+
type: 'string',
|
|
10
|
+
desc: 'Docker image',
|
|
11
|
+
default: 'alpine'
|
|
12
|
+
})
|
|
13
|
+
.example([
|
|
14
|
+
['$0 shell'],
|
|
15
|
+
['$0 shell -- ping localhost']
|
|
16
|
+
])
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.command = 'shell [image]'
|
|
20
|
+
exports.desc = 'Run interactive shell from the current Kubernetes context'
|
|
21
|
+
exports.builder = builder
|
|
22
|
+
exports.handler = shell
|
package/src/handlers/replay.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('node:child_process')
|
|
4
|
+
const { newid } = require('@toa.io/generic')
|
|
5
|
+
|
|
6
|
+
const shell = async (argv) => {
|
|
7
|
+
const rnd = newid().substring(0, 6)
|
|
8
|
+
|
|
9
|
+
const args = [
|
|
10
|
+
'run',
|
|
11
|
+
'shell-' + rnd,
|
|
12
|
+
'--rm',
|
|
13
|
+
'-i',
|
|
14
|
+
'--tty',
|
|
15
|
+
'--image',
|
|
16
|
+
argv.image,
|
|
17
|
+
'--restart=Never',
|
|
18
|
+
'--'
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
const extra = argv._.splice(1)
|
|
22
|
+
|
|
23
|
+
if (extra.length > 0) args.push(...extra)
|
|
24
|
+
else args.push('sh')
|
|
25
|
+
|
|
26
|
+
await spawn('kubectl', args, { stdio: 'inherit' })
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
exports.shell = shell
|