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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6a93c63c1e8d4aeea46969a491b3065c97e9a1a290bfd871286e794c35cb0d6
4
- data.tar.gz: d8dbb91a1214bf8c42a5c9dd1e591dfcf6c41ffee6feb36af0af2f7b3a519ebd
3
+ metadata.gz: d130212469e4bc5bd395cd0b12978199876a6c5b946caf80fa66a7e09608ccd5
4
+ data.tar.gz: b2fd2bfc17efa04772d69426e9895e3151c97c3628a573f245e7920824c9df9e
5
5
  SHA512:
6
- metadata.gz: dfc13591d144fb99837297c4c766354ceed410df631e505e54517e9759b9b44b03ce9adb7738db167b55c877d7f47bbd644f1bb832df38c4213651243fcbe668
7
- data.tar.gz: 9ed84b118c29ec8531407f4b069840d1c576eb6f120f58ead3a8560242af44b62ca3b6339f4949a5433c64fc966003d65f2871134b0ed17984cc2f461b9537bd
6
+ metadata.gz: cd1c1f453efdc400a6056443fe95a92bf1e0443cea14df03373a650f4c538a3d152e0c1b49195801a99a578df7eb0aa5092b6e612078775cb7a2086daca0937f
7
+ data.tar.gz: 95c492b92ce1890e011c9d93ebc46b8a9248eaa372b9545721f5c0d64ac72b96f20c07705ad0f667b6b7e84a2440af662d9b26b0a12186a83c218c62315c01a7
@@ -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 ``.kubes/resources` then the command will use the first deployment by default. You can specify the specfic deployment with the `--name` option. Examples:
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
@@ -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
@@ -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
@@ -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 ``.kubes/resources` then the command will use the first deployment by default. You can specify the specfic deployment with the `--name` option. Examples:
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 demo-web
14
- kubes exec --name demo-clock
15
- kubes exec --name demo-worker
16
- kubes exec --name demo-web sh
17
- kubes exec --name demo-web ls -l
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
 
@@ -1,3 +1,3 @@
1
1
  module Kubes
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.0
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-01 00:00:00.000000000 Z
11
+ date: 2020-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport