kubes 0.4.4 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/docs/_docs/config/reference.md +1 -0
- data/docs/_docs/config/skip.md +1 -1
- data/docs/_docs/dsl/multiple-resources.md +3 -3
- data/docs/_docs/dsl/resources/job.md +62 -0
- data/docs/_docs/extra-env/dsl.md +2 -2
- data/docs/_docs/extra-env/yaml.md +1 -1
- data/docs/_docs/generators.md +41 -0
- data/docs/_docs/helpers.md +10 -3
- data/docs/_docs/helpers/aws.md +15 -0
- data/docs/_docs/helpers/aws/iam-role.md +91 -0
- data/docs/_docs/helpers/aws/secrets.md +129 -0
- data/docs/_docs/helpers/aws/ssm.md +76 -0
- data/docs/_docs/helpers/custom.md +40 -0
- data/docs/_docs/helpers/google.md +17 -0
- data/docs/_docs/helpers/google/secrets.md +76 -0
- data/docs/_docs/helpers/google/service-account.md +60 -0
- data/docs/_docs/intro.md +3 -1
- data/docs/_docs/intro/docker-image.md +66 -0
- data/docs/_docs/intro/how-kubes-works.md +7 -11
- data/docs/_docs/layering/merge.md +1 -1
- data/docs/_docs/learn/dsl/delete.md +10 -2
- data/docs/_docs/learn/dsl/review-project.md +2 -2
- data/docs/_docs/learn/yaml/delete.md +10 -2
- data/docs/_docs/learn/yaml/review-project.md +2 -2
- data/docs/_docs/patterns/clock-web-worker.md +3 -3
- data/docs/_docs/patterns/migrations.md +1 -1
- data/docs/_docs/patterns/secrets.md +0 -2
- data/docs/_docs/yaml.md +2 -2
- data/docs/_includes/commands.html +2 -2
- data/docs/_includes/helpers/base64.md +1 -0
- data/docs/_includes/sidebar.html +23 -1
- data/docs/_reference/kubes-delete.md +1 -1
- data/docs/_reference/kubes-exec.md +17 -1
- data/docs/_reference/kubes-init.md +2 -2
- data/docs/_reference/kubes-logs.md +2 -1
- data/docs/_reference/kubes-new.md +58 -0
- data/docs/_reference/kubes-prune.md +22 -0
- data/docs/reference.md +2 -0
- data/kubes.gemspec +1 -0
- data/lib/kubes.rb +2 -0
- data/lib/kubes/autoloader.rb +9 -0
- data/lib/kubes/cli.rb +9 -1
- data/lib/kubes/cli/build.rb +6 -0
- data/lib/kubes/cli/compile.rb +7 -0
- data/lib/kubes/cli/deploy.rb +1 -6
- data/lib/kubes/cli/exec.rb +5 -1
- data/lib/kubes/cli/help/exec.md +15 -0
- data/lib/kubes/cli/help/new.md +30 -0
- data/lib/kubes/cli/init.rb +1 -1
- data/lib/kubes/cli/new.rb +97 -0
- data/lib/kubes/cli/sequence.rb +1 -0
- data/lib/kubes/command.rb +7 -0
- data/lib/kubes/compiler.rb +19 -21
- data/lib/kubes/compiler/dsl/syntax/job.rb +217 -0
- data/lib/kubes/compiler/shared/custom_helpers.rb +17 -0
- data/lib/kubes/compiler/shared/helpers.rb +12 -3
- data/lib/kubes/compiler/shared/helpers/deprecated.rb +37 -0
- data/lib/kubes/compiler/strategy/base.rb +1 -0
- data/lib/kubes/compiler/strategy/dsl.rb +1 -0
- data/lib/kubes/compiler/strategy/erb.rb +2 -0
- data/lib/kubes/config.rb +1 -1
- data/lib/kubes/core.rb +6 -0
- data/lib/kubes/docker/strategy/image_name.rb +1 -1
- data/lib/kubes/kubectl.rb +5 -23
- data/lib/kubes/kubectl/batch.rb +27 -33
- data/lib/kubes/kubectl/ordering.rb +42 -0
- data/lib/kubes/version.rb +1 -1
- data/lib/templates/base/.kubes/config.rb.tt +1 -1
- data/lib/templates/base/.kubes/config/env/dev.rb +1 -1
- data/lib/templates/base/.kubes/config/env/prod.rb +1 -1
- data/lib/templates/dsl/.kubes/resources/web/deployment.rb +1 -1
- data/lib/templates/new/dsl/backend_config.rb +10 -0
- data/lib/templates/new/dsl/config_map.rb +5 -0
- data/lib/templates/new/dsl/daemon_set.rb +11 -0
- data/lib/templates/new/dsl/deployment.rb +4 -0
- data/lib/templates/new/dsl/ingress.rb +3 -0
- data/lib/templates/new/dsl/job.rb +2 -0
- data/lib/templates/new/dsl/managed_certificate.rb +2 -0
- data/lib/templates/new/dsl/namespace.rb +2 -0
- data/lib/templates/new/dsl/network_policy.rb +7 -0
- data/lib/templates/new/dsl/pod.rb +6 -0
- data/lib/templates/new/dsl/role.rb +4 -0
- data/lib/templates/new/dsl/role_binding.rb +7 -0
- data/lib/templates/new/dsl/secret.rb +5 -0
- data/lib/templates/new/dsl/service.rb +2 -0
- data/lib/templates/new/dsl/service_account.rb +1 -0
- data/lib/templates/new/yaml/backend_config.yaml +10 -0
- data/lib/templates/new/yaml/config_map.yaml +9 -0
- data/lib/templates/new/yaml/daemon_set.yaml +11 -0
- data/lib/templates/new/yaml/deployment.yaml +19 -0
- data/lib/templates/new/yaml/ingress.yaml +12 -0
- data/lib/templates/new/yaml/job.yaml +19 -0
- data/lib/templates/new/yaml/managed_certificate.yaml +7 -0
- data/lib/templates/new/yaml/namespace.yaml +6 -0
- data/lib/templates/new/yaml/network_policy.yaml +20 -0
- data/lib/templates/new/yaml/pod.yaml +11 -0
- data/lib/templates/new/yaml/role.yaml +13 -0
- data/lib/templates/new/yaml/role_binding.yaml +11 -0
- data/lib/templates/new/yaml/secret.yaml +9 -0
- data/lib/templates/new/yaml/service.yaml +14 -0
- data/lib/templates/new/yaml/service_account.yaml +4 -0
- data/lib/templates/yaml/.kubes/resources/base/all.yaml.tt +2 -0
- data/lib/templates/yaml/.kubes/resources/web/deployment.yaml.tt +1 -1
- data/spec/kubes/cli/prune_spec.rb +1 -0
- data/spec/kubes/compiler_spec.rb +5 -1
- metadata +65 -2
@@ -46,10 +46,10 @@ spec:
|
|
46
46
|
spec:
|
47
47
|
containers:
|
48
48
|
- name: web
|
49
|
-
image: <%=
|
49
|
+
image: <%= docker_image %>
|
50
50
|
```
|
51
51
|
|
52
|
-
Notice the `<%=
|
52
|
+
Notice the `<%= docker_image %>`. Kubes processes the YAML files with ERB templating and replaces these tags. The `docker_image` is a kubes helper method that refers to the latest Docker image built by Kubes. This spares you updating the image manually.
|
53
53
|
|
54
54
|
## Base Folder
|
55
55
|
|
@@ -31,7 +31,7 @@ namespace "default"
|
|
31
31
|
labels(role: "web")
|
32
32
|
|
33
33
|
replicas 1
|
34
|
-
image
|
34
|
+
image docker_image # IE: user/demo-clock:kubes-2020-06-13T19-55-16-43afc6e
|
35
35
|
command "bin/clock"
|
36
36
|
```
|
37
37
|
|
@@ -43,7 +43,7 @@ namespace "default"
|
|
43
43
|
labels(role: "web")
|
44
44
|
|
45
45
|
replicas 1
|
46
|
-
image
|
46
|
+
image docker_image # IE: user/demo-clock:kubes-2020-06-13T19-55-16-43afc6e
|
47
47
|
```
|
48
48
|
|
49
49
|
.kubes/resources/demo-worker/deployment.rb
|
@@ -54,7 +54,7 @@ namespace "default"
|
|
54
54
|
labels(role: "web")
|
55
55
|
|
56
56
|
replicas 2
|
57
|
-
image
|
57
|
+
image docker_image # IE: user/demo-clock:kubes-2020-06-13T19-55-16-43afc6e
|
58
58
|
command "bin/worker"
|
59
59
|
```
|
60
60
|
|
@@ -78,5 +78,3 @@ upcase | Automatically upcase the Kubernetes secret data keys. | false
|
|
78
78
|
prefix | Prefixed used to list and filter Google secrets. IE: `projects/686010496118/secrets/demo-dev-`. Can also be set with the `GCP_SECRET_PREFIX` env variable. The env variable takes the highest precedence. | nil
|
79
79
|
|
80
80
|
Note, Kubernetes secrets are only base64 encoded. So users who have access to read Kubernetes secrets will be able to decode and get the value trivially. Depending on your security posture requirements, this may or may not suffice.
|
81
|
-
|
82
|
-
The Google helpers are provided by the [boltops-tools/kubes_google](https://github.com/boltops-tools/kubes_google) library. For more details, check out its README.
|
data/docs/_docs/yaml.md
CHANGED
@@ -12,7 +12,7 @@ You can write your Kubernetes resources in YAML format.
|
|
12
12
|
|
13
13
|
## YAML and Templating
|
14
14
|
|
15
|
-
Kubes provides a little extra power for the YAML format. The YAML files are processed through an ERB templating language. So you have dynamic control. Here's an example with `Kubes.env` and the `
|
15
|
+
Kubes provides a little extra power for the YAML format. The YAML files are processed through an ERB templating language. So you have dynamic control. Here's an example with `Kubes.env` and the `docker_image` helper.
|
16
16
|
|
17
17
|
.kubes/resources/web/deployment.yaml
|
18
18
|
|
@@ -37,5 +37,5 @@ spec:
|
|
37
37
|
spec:
|
38
38
|
containers:
|
39
39
|
- name: demo-web
|
40
|
-
image: <%=
|
40
|
+
image: <%= docker_image %>
|
41
41
|
```
|
@@ -108,7 +108,7 @@ spec:
|
|
108
108
|
spec:
|
109
109
|
containers:
|
110
110
|
- name: demo-web
|
111
|
-
image: <%=
|
111
|
+
image: <%= docker_image %>
|
112
112
|
{% endhighlight %}
|
113
113
|
</div>
|
114
114
|
</div>
|
@@ -121,7 +121,7 @@ namespace "default"
|
|
121
121
|
labels(role: "web")
|
122
122
|
|
123
123
|
replicas 2
|
124
|
-
image
|
124
|
+
image docker_image # IE: user/demo-web:kubes-2020-06-13T19-55-16-43afc6e
|
125
125
|
{% endhighlight %}
|
126
126
|
</div>
|
127
127
|
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
Note, Kubernetes secrets are only base64 encoded. So users who have access to read Kubernetes secrets will be able to decode and get the value trivially. Depending on your security posture requirements, this may or may not suffice.
|
data/docs/_includes/sidebar.html
CHANGED
@@ -42,6 +42,7 @@
|
|
42
42
|
</ul>
|
43
43
|
</li>
|
44
44
|
<li><a href="{% link _docs/intro/install.md %}">Install</a></li>
|
45
|
+
<li><a href="{% link _docs/intro/docker-image.md %}">Docker Image</a></li>
|
45
46
|
</ul>
|
46
47
|
</li>
|
47
48
|
<li><a href="{% link _docs/resources.md %}">Resources</a>
|
@@ -76,6 +77,7 @@
|
|
76
77
|
<li><a href="{% link _docs/config/reference.md %}">Reference</a></li>
|
77
78
|
</ul>
|
78
79
|
</li>
|
80
|
+
<li><a href="{% link _docs/generators.md %}">Generators</a></li>
|
79
81
|
<li><a href="{% link _docs/yaml.md %}">YAML</a></li>
|
80
82
|
<li><a href="{% link _docs/layering.md %}">Layering</a>
|
81
83
|
<ul>
|
@@ -97,7 +99,27 @@
|
|
97
99
|
<li><a href="{% link _docs/dsl/multiple-resources.md %}">Multiple Resources</a>
|
98
100
|
</ul>
|
99
101
|
</li>
|
100
|
-
<li><a href="{% link _docs/helpers.md %}">Helpers</a
|
102
|
+
<li><a href="{% link _docs/helpers.md %}">Helpers</a>
|
103
|
+
<ul>
|
104
|
+
<li><a href="{% link _docs/helpers/custom.md %}">Custom</a></li>
|
105
|
+
<li><a href="{% link _docs/helpers/aws.md %}">AWS</a>
|
106
|
+
<ul>
|
107
|
+
{% assign docs = site.docs | where: "categories","helpers-aws" %}
|
108
|
+
{% for doc in docs -%}
|
109
|
+
<li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
|
110
|
+
{% endfor %}
|
111
|
+
</ul>
|
112
|
+
</li>
|
113
|
+
<li><a href="{% link _docs/helpers/google.md %}">Google</a>
|
114
|
+
<ul>
|
115
|
+
{% assign docs = site.docs | where: "categories","helpers-google" %}
|
116
|
+
{% for doc in docs -%}
|
117
|
+
<li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
|
118
|
+
{% endfor %}
|
119
|
+
</ul>
|
120
|
+
</li>
|
121
|
+
</ul>
|
122
|
+
</li>
|
101
123
|
<li><a href="{% link _docs/patterns.md %}">Patterns</a>
|
102
124
|
<ul>
|
103
125
|
{% assign docs = site.docs | where: "categories","patterns" %}
|
@@ -36,13 +36,29 @@ If you have have multiple containers in your pod. You can specify the specfic co
|
|
36
36
|
|
37
37
|
kubes exec --name web
|
38
38
|
|
39
|
+
## Default Exec Command
|
40
|
+
|
41
|
+
The default exec command is `sh`. Example:
|
42
|
+
|
43
|
+
$ kubes exec
|
44
|
+
=> kubectl exec -n demo-dev -ti web-568645f665-62j8f -- sh
|
45
|
+
/app #
|
46
|
+
|
47
|
+
You can override the default with `KUBES_DEFAULT_EXEC`. Example:
|
48
|
+
|
49
|
+
$ export KUBES_DEFAULT_EXEC=bash
|
50
|
+
$ kubes exec
|
51
|
+
=> kubectl exec -n demo-dev -ti web-568645f665-62j8f -- bash
|
52
|
+
/app #
|
53
|
+
|
39
54
|
|
40
55
|
## Options
|
41
56
|
|
42
57
|
```
|
43
58
|
[--compile], [--no-compile] # whether or not to compile the .kube/resources
|
44
59
|
# Default: true
|
45
|
-
|
60
|
+
p, [--pod=POD] # pod to use. IE: web
|
61
|
+
d, [--deployment=DEPLOYMENT] # deployment name to use. IE: demo-web
|
46
62
|
c, [--container=CONTAINER] # Container name. If omitted, the first container in the pod will be chosen
|
47
63
|
[--verbose], [--no-verbose]
|
48
64
|
[--noop], [--no-noop]
|
@@ -16,11 +16,11 @@ Init project
|
|
16
16
|
|
17
17
|
```
|
18
18
|
a, --app=APP # Docker repo name. Example: web. Generates .kubes/APP/resources folder
|
19
|
-
|
19
|
+
y, [--force] # Bypass overwrite are you sure prompt for existing files
|
20
20
|
t, [--type=TYPE] # Type: dsl or yaml
|
21
21
|
# Default: yaml
|
22
22
|
--repo=REPO # Docker repo name. Example: user/repo. Configures .kubes/config.rb
|
23
|
-
n, [--namespace=NAMESPACE] # Namespace to use, defaults to
|
23
|
+
n, [--namespace=NAMESPACE] # Namespace to use, defaults to APP-ENV. IE: demo-dev
|
24
24
|
[--verbose], [--no-verbose]
|
25
25
|
[--noop], [--no-noop]
|
26
26
|
```
|
@@ -17,7 +17,8 @@ logs from all deployment pods
|
|
17
17
|
```
|
18
18
|
[--compile], [--no-compile] # whether or not to compile the .kube/resources
|
19
19
|
# Default: true
|
20
|
-
|
20
|
+
p, [--pod=POD] # pod to use. IE: web
|
21
|
+
d, [--deployment=DEPLOYMENT] # deployment name to use. IE: demo-web
|
21
22
|
c, [--container=CONTAINER] # Container name. If omitted, the first container in the pod will be chosen
|
22
23
|
f, [--follow], [--no-follow] # Follow logs
|
23
24
|
# Default: true
|
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
title: kubes new
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
kubes new
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Generates new resource.
|
13
|
+
|
14
|
+
## Examples
|
15
|
+
|
16
|
+
$ kubes new ingress
|
17
|
+
create .kubes/resources/web/ingress.yaml
|
18
|
+
$ kubes new service_account
|
19
|
+
create .kubes/resources/shared/service_account.yaml
|
20
|
+
$
|
21
|
+
|
22
|
+
## Supported Resources
|
23
|
+
|
24
|
+
Here's a list of some of the supported resources.
|
25
|
+
|
26
|
+
backend_config
|
27
|
+
config_map
|
28
|
+
daemon_set
|
29
|
+
deployment
|
30
|
+
ingress
|
31
|
+
job
|
32
|
+
managed_certificate
|
33
|
+
namespace
|
34
|
+
network_policy
|
35
|
+
pod
|
36
|
+
role_binding
|
37
|
+
role
|
38
|
+
secret
|
39
|
+
service_account
|
40
|
+
service
|
41
|
+
|
42
|
+
Refer to the source code to all the resources that the generator supports:
|
43
|
+
https://github.com/boltops-tools/kubes/blob/master/lib/templates/new/yaml
|
44
|
+
|
45
|
+
|
46
|
+
## Options
|
47
|
+
|
48
|
+
```
|
49
|
+
a, [--app=APP] # App name
|
50
|
+
# Default: demo
|
51
|
+
y, [--force] # Bypass overwrite are you sure prompt for existing files
|
52
|
+
r, [--role=ROLE] # Role. IE: web, clock, worker, migrate, etc. Defaults to convention: web or shared when not set
|
53
|
+
t, [--type=TYPE] # Type: dsl or yaml
|
54
|
+
# Default: yaml
|
55
|
+
[--verbose], [--no-verbose]
|
56
|
+
[--noop], [--no-noop]
|
57
|
+
```
|
58
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
title: kubes prune
|
3
|
+
reference: true
|
4
|
+
---
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
kubes prune
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
Prune old resources like secret and config maps
|
13
|
+
|
14
|
+
|
15
|
+
## Options
|
16
|
+
|
17
|
+
```
|
18
|
+
y, [--yes], [--no-yes] # Skip are you sure prompt
|
19
|
+
[--verbose], [--no-verbose]
|
20
|
+
[--noop], [--no-noop]
|
21
|
+
```
|
22
|
+
|
data/docs/reference.md
CHANGED
@@ -16,4 +16,6 @@ title: CLI Reference
|
|
16
16
|
* [kubes get]({% link _reference/kubes-get.md %})
|
17
17
|
* [kubes init]({% link _reference/kubes-init.md %})
|
18
18
|
* [kubes logs]({% link _reference/kubes-logs.md %})
|
19
|
+
* [kubes new]({% link _reference/kubes-new.md %})
|
20
|
+
* [kubes prune]({% link _reference/kubes-prune.md %})
|
19
21
|
* [kubes version]({% link _reference/kubes-version.md %})
|
data/kubes.gemspec
CHANGED
data/lib/kubes.rb
CHANGED
@@ -15,6 +15,7 @@ require "rainbow/ext/string"
|
|
15
15
|
require "yaml"
|
16
16
|
|
17
17
|
# core helper libraries
|
18
|
+
require "kubes_aws"
|
18
19
|
require "kubes_google"
|
19
20
|
|
20
21
|
DslEvaluator.backtrace_reject = "lib/kubes"
|
@@ -24,5 +25,6 @@ Kubes::Autoloader.setup
|
|
24
25
|
|
25
26
|
module Kubes
|
26
27
|
class Error < StandardError; end
|
28
|
+
class MissingDockerImage < Error; end
|
27
29
|
extend Core
|
28
30
|
end
|
data/lib/kubes/autoloader.rb
CHANGED
@@ -14,8 +14,17 @@ module Kubes
|
|
14
14
|
loader = Zeitwerk::Loader.new
|
15
15
|
loader.inflector = Inflector.new
|
16
16
|
loader.push_dir(File.dirname(__dir__)) # lib
|
17
|
+
|
18
|
+
helpers = "#{kubes_root}/.kubes/helpers"
|
19
|
+
loader.push_dir(helpers) if File.exist?(helpers) # project helpers
|
20
|
+
|
17
21
|
loader.setup
|
18
22
|
end
|
23
|
+
|
24
|
+
# Autoloader runs so early that Kubes.root is not available, so we must declare it here
|
25
|
+
def kubes_root
|
26
|
+
ENV['KUBES_ROOT'] || '.'
|
27
|
+
end
|
19
28
|
end
|
20
29
|
end
|
21
30
|
end
|
data/lib/kubes/cli.rb
CHANGED
@@ -26,6 +26,14 @@ module Kubes
|
|
26
26
|
long_desc Help.text(:docker)
|
27
27
|
subcommand "docker", Docker
|
28
28
|
|
29
|
+
desc "docker SUBCOMMAND", "Docker subcommands"
|
30
|
+
long_desc Help.text(:docker)
|
31
|
+
subcommand "docker", Docker
|
32
|
+
|
33
|
+
long_desc Help.text("new")
|
34
|
+
New.options.each { |args| option(*args) }
|
35
|
+
register(New, "new", "new", "Generates new resource.")
|
36
|
+
|
29
37
|
desc "apply [ROLE] [RESOURCE]", "Apply the Kubernetes YAML files without building docker image"
|
30
38
|
long_desc Help.text(:apply)
|
31
39
|
image_option.call
|
@@ -48,7 +56,7 @@ module Kubes
|
|
48
56
|
Compile.new(options).run
|
49
57
|
end
|
50
58
|
|
51
|
-
desc "delete [ROLE] [RESOURCE]", "Delete Kubernetes resources
|
59
|
+
desc "delete [ROLE] [RESOURCE]", "Delete Kubernetes resources in defined .kubes/resources"
|
52
60
|
long_desc Help.text(:delete)
|
53
61
|
image_option.call
|
54
62
|
yes_option.call
|
data/lib/kubes/cli/build.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
class Kubes::CLI
|
2
2
|
class Build < Base
|
3
3
|
def run
|
4
|
+
return unless build?
|
4
5
|
Kubes::Docker.new(@options, "build").run
|
5
6
|
Kubes::Docker.new(@options, "push").run
|
6
7
|
end
|
8
|
+
|
9
|
+
def build?
|
10
|
+
return false if @options[:build] == false || @options[:image] || Kubes.config.image
|
11
|
+
@options[:resource].nil? || @options[:resource] == "deployment"
|
12
|
+
end
|
7
13
|
end
|
8
14
|
end
|
data/lib/kubes/cli/compile.rb
CHANGED
@@ -8,9 +8,16 @@ class Kubes::CLI
|
|
8
8
|
@@compiled = false
|
9
9
|
def run
|
10
10
|
return if @@compiled
|
11
|
+
build_docker_image
|
11
12
|
Clean.new(@options.merge(mute: true)).run
|
12
13
|
Kubes::Compiler.new(@options).run
|
13
14
|
@@compiled = true
|
14
15
|
end
|
16
|
+
|
17
|
+
# auto build docker image and push image if kubes docker build not yet called
|
18
|
+
def build_docker_image
|
19
|
+
return if File.exist?("#{Kubes.root}/.kubes/state/docker_image.txt")
|
20
|
+
Build.new(@options).run
|
21
|
+
end
|
15
22
|
end
|
16
23
|
end
|
data/lib/kubes/cli/deploy.rb
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
class Kubes::CLI
|
2
2
|
class Deploy < Base
|
3
3
|
def run
|
4
|
-
Build.new(@options).run
|
4
|
+
Build.new(@options).run
|
5
5
|
Apply.new(@options).run # also calls Compile
|
6
6
|
end
|
7
|
-
|
8
|
-
def build?
|
9
|
-
return false if @options[:build] == false || @options[:image]
|
10
|
-
@options[:resource].nil? || @options[:resource] == "deployment"
|
11
|
-
end
|
12
7
|
end
|
13
8
|
end
|
data/lib/kubes/cli/exec.rb
CHANGED
@@ -20,10 +20,14 @@ class Kubes::CLI
|
|
20
20
|
end
|
21
21
|
|
22
22
|
container = " -c #{@options[:container]}" unless @options[:container].nil?
|
23
|
-
cmd = @options[:cmd].empty? ?
|
23
|
+
cmd = @options[:cmd].empty? ? default_exec : @options[:cmd].join(' ')
|
24
24
|
sh("kubectl exec #{ns} -ti #{pod}#{container} -- #{cmd}")
|
25
25
|
end
|
26
26
|
|
27
|
+
def default_exec
|
28
|
+
ENV['KUBES_DEFAULT_EXEC'] || "sh"
|
29
|
+
end
|
30
|
+
|
27
31
|
def find_pod
|
28
32
|
pod_name || deployment_pod
|
29
33
|
end
|
data/lib/kubes/cli/help/exec.md
CHANGED
@@ -22,3 +22,18 @@ If you have have multiple deployments in your `.kubes/resources` then the comman
|
|
22
22
|
If you have have multiple containers in your pod. You can specify the specfic container with the `--container` or `-c` option. Examples:
|
23
23
|
|
24
24
|
kubes exec --name web
|
25
|
+
|
26
|
+
## Default Exec Command
|
27
|
+
|
28
|
+
The default exec command is `sh`. Example:
|
29
|
+
|
30
|
+
$ kubes exec
|
31
|
+
=> kubectl exec -n demo-dev -ti web-568645f665-62j8f -- sh
|
32
|
+
/app #
|
33
|
+
|
34
|
+
You can override the default with `KUBES_DEFAULT_EXEC`. Example:
|
35
|
+
|
36
|
+
$ export KUBES_DEFAULT_EXEC=bash
|
37
|
+
$ kubes exec
|
38
|
+
=> kubectl exec -n demo-dev -ti web-568645f665-62j8f -- bash
|
39
|
+
/app #
|