kubes 0.3.0 → 0.3.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/docs/_reference/kubes-exec.md +1 -1
- data/lib/kubes/cli.rb +1 -0
- data/lib/kubes/cli/exec.rb +2 -1
- data/lib/kubes/cli/help/exec.md +13 -6
- data/lib/kubes/compiler/dsl/syntax/deployment.rb +13 -0
- data/lib/kubes/kubectl/fetch/deployment.rb +1 -1
- data/lib/kubes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d130212469e4bc5bd395cd0b12978199876a6c5b946caf80fa66a7e09608ccd5
|
4
|
+
data.tar.gz: b2fd2bfc17efa04772d69426e9895e3151c97c3628a573f245e7920824c9df9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd1c1f453efdc400a6056443fe95a92bf1e0443cea14df03373a650f4c538a3d152e0c1b49195801a99a578df7eb0aa5092b6e612078775cb7a2086daca0937f
|
7
|
+
data.tar.gz: 95c492b92ce1890e011c9d93ebc46b8a9248eaa372b9545721f5c0d64ac72b96f20c07705ad0f667b6b7e84a2440af662d9b26b0a12186a83c218c62315c01a7
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.3.1]
|
7
|
+
- #20 improve sidecar support. kubes exec -c option also
|
8
|
+
|
6
9
|
## [0.3.0]
|
7
10
|
- #19 new commands: exec, logs
|
8
11
|
- delete preview
|
@@ -21,7 +21,7 @@ The exec command finds the latest pod from the deployment and runs `kubectl exec
|
|
21
21
|
|
22
22
|
## Multiple Deployments
|
23
23
|
|
24
|
-
If you have have multiple deployments in your
|
24
|
+
If you have have multiple deployments in your `.kubes/resources` then the command will use the first deployment by default. You can specify the specfic deployment with the `--name` option. Examples:
|
25
25
|
|
26
26
|
kubes exec --name demo-web
|
27
27
|
kubes exec --name demo-clock
|
data/lib/kubes/cli.rb
CHANGED
@@ -67,6 +67,7 @@ module Kubes
|
|
67
67
|
long_desc Help.text(:exec)
|
68
68
|
compile_option.call
|
69
69
|
name_option.call
|
70
|
+
option :container, aliases: %w[c], desc: "Container name. If omitted, the first container in the pod will be chosen"
|
70
71
|
def exec(*cmd)
|
71
72
|
Exec.new(options.merge(cmd: cmd)).run
|
72
73
|
end
|
data/lib/kubes/cli/exec.rb
CHANGED
@@ -19,8 +19,9 @@ class Kubes::CLI
|
|
19
19
|
end
|
20
20
|
|
21
21
|
name = pod['metadata']['name']
|
22
|
+
container = " -c #{@options[:container]}" unless @options[:container].nil?
|
22
23
|
cmd = @options[:cmd].empty? ? "bash" : @options[:cmd].join(' ')
|
23
|
-
sh("kubectl exec -n #{ns} -ti #{name} -- #{cmd}")
|
24
|
+
sh("kubectl exec -n #{ns} -ti #{name}#{container} -- #{cmd}")
|
24
25
|
end
|
25
26
|
|
26
27
|
# get latest running pod
|
data/lib/kubes/cli/help/exec.md
CHANGED
@@ -8,10 +8,17 @@ The exec command finds the latest pod from the deployment and runs `kubectl exec
|
|
8
8
|
|
9
9
|
## Multiple Deployments
|
10
10
|
|
11
|
-
If you have have multiple deployments in your
|
11
|
+
If you have have multiple deployments in your `.kubes/resources` then the command will use the first deployment by default. You can specify the specfic deployment with the `--name` or `-n` option. Examples:
|
12
12
|
|
13
|
-
kubes exec --name
|
14
|
-
kubes exec
|
15
|
-
kubes exec
|
16
|
-
kubes exec
|
17
|
-
kubes exec
|
13
|
+
kubes exec --name web
|
14
|
+
kubes exec -n web
|
15
|
+
kubes exec -n clock
|
16
|
+
kubes exec -n worker
|
17
|
+
kubes exec -n web sh
|
18
|
+
kubes exec -n web ls -l
|
19
|
+
|
20
|
+
## Multiple Pod Containers
|
21
|
+
|
22
|
+
If you have have multiple containers in your pod. You can specify the specfic container with the `--container` or `-c` option. Examples:
|
23
|
+
|
24
|
+
kubes exec --name web
|
@@ -3,6 +3,8 @@ module Kubes::Compiler::Dsl::Syntax
|
|
3
3
|
fields :container, # <Object>
|
4
4
|
"matchLabels:hash", # <map[string]string>
|
5
5
|
:sidecar, # <Object>
|
6
|
+
:sidecar_name, # <string>
|
7
|
+
:sidecar_image, # <string>
|
6
8
|
:templateMetadata, # <Object>
|
7
9
|
:templateSpec # <Object>
|
8
10
|
|
@@ -185,6 +187,17 @@ module Kubes::Compiler::Dsl::Syntax
|
|
185
187
|
[container, sidecar].compact
|
186
188
|
end
|
187
189
|
|
190
|
+
def default_sidecar
|
191
|
+
{
|
192
|
+
name: sidecar_name,
|
193
|
+
image: sidecar_image,
|
194
|
+
}
|
195
|
+
end
|
196
|
+
|
197
|
+
def default_sidecar_name
|
198
|
+
"sidecar" if sidecar_image # othewise will create invalid sidecar field w/o image
|
199
|
+
end
|
200
|
+
|
188
201
|
def default_container
|
189
202
|
{
|
190
203
|
args: args,
|
@@ -11,7 +11,7 @@ module Kubes::Kubectl::Fetch
|
|
11
11
|
INFO: More than one deployment found.
|
12
12
|
Deployment names: #{names.join(', ')}
|
13
13
|
Using #{names.first}
|
14
|
-
Note: You can specify the deployment to use with --name
|
14
|
+
Note: You can specify the deployment to use with --name or -n
|
15
15
|
EOL
|
16
16
|
end
|
17
17
|
|
data/lib/kubes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|