kubes 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- 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 +2 -2
- data/docs/_docs/helpers/google/service-account.md +8 -0
- data/docs/_docs/intro.md +3 -1
- data/docs/_docs/intro/docker-image.md +66 -0
- 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/yaml.md +2 -2
- data/docs/_includes/commands.html +2 -2
- data/docs/_includes/sidebar.html +2 -0
- 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/lib/kubes.rb +1 -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/helpers.rb +11 -2
- data/lib/kubes/compiler/shared/helpers/deprecated.rb +37 -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/batch.rb +0 -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 +20 -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 +41 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32e7414b0e237ec67d21e06089571c57671f5ec2fb946eb89a1b2220bc1ba87d
|
4
|
+
data.tar.gz: 76d393eee8b25ee806ca455efe521d4a690795a1f94690d16ba39a1a0dd05d4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5a7c052aaae9e0893293a9862979502f7bba65465d189691647ee5f4a4786c3e166c5e6ad2c908d72c3586a64db153253fe4e8f109fd278570c007d9ad6c53
|
7
|
+
data.tar.gz: ea95f2f305b03a32f2283ca103a4b69914229a238ace8527cea56898af33b7b15f563d8cc5041279758c98c9150e713a03b5acb96b08d789202c966ba34ecc03
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@
|
|
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.5.0]
|
7
|
+
- #34 Generators, docker_image helper, check project, also write full.yaml #34
|
8
|
+
- new generators: docs: https://kubes.guru/docs/generators/
|
9
|
+
- `docker_image` helper. deprecated `built_image`. `config.image` option support.
|
10
|
+
- check_project: check within a Kubes project
|
11
|
+
- job dsl
|
12
|
+
- kubes compile: auto run docker build and push when if needed
|
13
|
+
- also write .kubes/output/full.yaml
|
14
|
+
|
6
15
|
## [0.4.7]
|
7
16
|
- #33 improve switch context: earlier and only when needed
|
8
17
|
|
@@ -6,6 +6,7 @@ Name | Description | Default
|
|
6
6
|
---|---|---
|
7
7
|
auto_prune | Prune and delete old hashed resources like Secret and ConfigMap. | true
|
8
8
|
builder | What docker build command to use. Can use `docker` or `gcloud` to build the Docker image. | docker
|
9
|
+
image | Set a prebuilt Docker image to use. This is optional. Usually, you want to build an image from the Dockerfile. Setting this will change the `docker_image` helper to use a predefined image. See: [Docker Image]({% link _docs/intro/docker-image.md %}) | nil
|
9
10
|
kubectl.context | What kubectl context to auto-switch to. | nil
|
10
11
|
kubectl.context_keep | Whether or not to keep the context switched | true
|
11
12
|
kubectl.exit_on_fail.apply | Whether or not continue if the `kubectl apply` fails. Note, can use `KUBES_EXIT_ON_FAIL=0` env var to set to false. | true
|
data/docs/_docs/config/skip.md
CHANGED
@@ -51,13 +51,13 @@ You can also use a block form to create multiple resources. You name the resour
|
|
51
51
|
deployment "demo-web" do
|
52
52
|
labels(role: "web")
|
53
53
|
replicas 1
|
54
|
-
image
|
54
|
+
image docker_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
55
55
|
end
|
56
56
|
|
57
57
|
deployment "demo-web-2" do
|
58
58
|
labels(role: "web")
|
59
59
|
replicas 1
|
60
|
-
image
|
60
|
+
image docker_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
61
61
|
end
|
62
62
|
```
|
63
63
|
|
@@ -70,7 +70,7 @@ You can also mix and matched resources. When you use the block form, the file na
|
|
70
70
|
deployment "demo-web" do
|
71
71
|
labels(role: "web")
|
72
72
|
replicas 1
|
73
|
-
image
|
73
|
+
image docker_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
74
74
|
end
|
75
75
|
|
76
76
|
service "demo-web" do
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
title: Job
|
3
|
+
categories: dsl
|
4
|
+
---
|
5
|
+
|
6
|
+
## Example 1
|
7
|
+
|
8
|
+
Here's an example of an job.
|
9
|
+
|
10
|
+
.kubes/resources/migrate/job.rb
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
name "<%= app %>"
|
14
|
+
image(docker_image)
|
15
|
+
```
|
16
|
+
|
17
|
+
Produces:
|
18
|
+
|
19
|
+
.kubes/output/migrate/job.yaml
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
---
|
23
|
+
apiVersion: batch/v1
|
24
|
+
kind: Job
|
25
|
+
metadata:
|
26
|
+
name: demo
|
27
|
+
labels:
|
28
|
+
app: demo
|
29
|
+
namespace: demo-dev
|
30
|
+
spec:
|
31
|
+
template:
|
32
|
+
metadata:
|
33
|
+
labels:
|
34
|
+
app: demo
|
35
|
+
spec:
|
36
|
+
containers:
|
37
|
+
- image: 111111111111.dkr.ecr.us-west-2.amazonaws.com/demo:kubes-2020-10-26T20-25-43
|
38
|
+
name: demo
|
39
|
+
```
|
40
|
+
|
41
|
+
## DSL Methods
|
42
|
+
|
43
|
+
Here's a list of more common methods:
|
44
|
+
|
45
|
+
job.spec.template.spec.containers fields:
|
46
|
+
|
47
|
+
* args
|
48
|
+
* command
|
49
|
+
* env
|
50
|
+
* envFrom
|
51
|
+
* image
|
52
|
+
* imagePullPolicy
|
53
|
+
* lifecycle
|
54
|
+
* livenessProbe
|
55
|
+
* containerName
|
56
|
+
* ports
|
57
|
+
* readinessProbe
|
58
|
+
* volumeDevices
|
59
|
+
* volumeMounts
|
60
|
+
* workingDir
|
61
|
+
|
62
|
+
{% include dsl/methods.md name="job" %}
|
data/docs/_docs/extra-env/dsl.md
CHANGED
@@ -14,7 +14,7 @@ labels(role: "web")
|
|
14
14
|
namespace with_extra("default")
|
15
15
|
|
16
16
|
replicas 1
|
17
|
-
image
|
17
|
+
image docker_image # IE: user/demo-web:kubes-2020-06-13T19-55-16-43afc6e
|
18
18
|
```
|
19
19
|
|
20
20
|
.kubes/resources/web/service.rb
|
@@ -50,7 +50,7 @@ labels(app: name, extra: extra)
|
|
50
50
|
namespace "default"
|
51
51
|
|
52
52
|
replicas 1
|
53
|
-
image
|
53
|
+
image docker_image # IE: user/demo-web:kubes-2020-06-13T19-55-16-43afc6e
|
54
54
|
```
|
55
55
|
|
56
56
|
.kubes/resources/web/service.rb
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
title: Generators
|
3
|
+
---
|
4
|
+
|
5
|
+
Kubes ships with a few generators to help you get building with Kubernetes quickly. The generated starter YAML should be modified and customized for your needs.
|
6
|
+
|
7
|
+
## Examples
|
8
|
+
|
9
|
+
Here are a few examples:
|
10
|
+
|
11
|
+
$ kubes new ingress
|
12
|
+
create .kubes/resources/web/ingress.yaml
|
13
|
+
$ kubes new service_account
|
14
|
+
create .kubes/resources/shared/service_account.yaml
|
15
|
+
$
|
16
|
+
|
17
|
+
Use `-h` to see the cli options:
|
18
|
+
|
19
|
+
kubes new -h
|
20
|
+
|
21
|
+
## Supported Resources
|
22
|
+
|
23
|
+
Here's a list of some of the supported resources.
|
24
|
+
|
25
|
+
backend_config
|
26
|
+
config_map
|
27
|
+
daemon_set
|
28
|
+
deployment
|
29
|
+
ingress
|
30
|
+
job
|
31
|
+
managed_certificate
|
32
|
+
namespace
|
33
|
+
network_policy
|
34
|
+
pod
|
35
|
+
role_binding
|
36
|
+
role
|
37
|
+
secret
|
38
|
+
service_account
|
39
|
+
service
|
40
|
+
|
41
|
+
Refer to the [source code](https://github.com/boltops-tools/kubes/blob/master/lib/templates/new/yaml) to all the resources that the generator supports.
|
data/docs/_docs/helpers.md
CHANGED
@@ -6,8 +6,8 @@ Kubes provides some helper methods to help write Kubernetes YAML files. Here's
|
|
6
6
|
|
7
7
|
Helper | Description
|
8
8
|
--- | ---
|
9
|
-
|
10
|
-
|
9
|
+
decode64 | Basey64 decode a string.
|
10
|
+
docker_image | Method refers to the latest Docker image built by Kubes. This spares you from having to update the image manually in the deployment resource. Note, this can be overridden with the `--image` cli option or the `Kubes.config.image` setting. See: [Docker Image]({% link _docs/intro/docker-image.md %})
|
11
11
|
dockerfile_port | Exposed port extracted from the Dockerfile of the project.
|
12
12
|
encode64 | Basey64 encode a string. Also available as `base64` method.
|
13
13
|
extra | The `KUBES_EXTRA` value.
|
@@ -41,6 +41,8 @@ metadata:
|
|
41
41
|
|
42
42
|
The role permissions are currently always added to the existing permissions. So removing roles that were previously added does not remove them.
|
43
43
|
|
44
|
+
## Variables
|
45
|
+
|
44
46
|
ServiceAccount#initialize options:
|
45
47
|
|
46
48
|
Variable | Description | Default
|
@@ -50,3 +52,9 @@ gsa | The Google Service Account name. The conventional name is APP-ENV. IE: dem
|
|
50
52
|
ksa | The Kubernetes Service Account name. The conventional name is APP. IE: demo | APP
|
51
53
|
namespace | The Kubernetes namespace. Defaults to the APP-ENV. IE: demo-dev. | APP-ENV
|
52
54
|
roles | Google IAM roles to add. This adds permissions to the Google service account. | []
|
55
|
+
|
56
|
+
Relevant environment variables:
|
57
|
+
|
58
|
+
Name | Description
|
59
|
+
---|---
|
60
|
+
GOOGLE_PROJECT | Google project id. This is required as it's used to build the full service account name.
|
data/docs/_docs/intro.md
CHANGED
@@ -11,7 +11,9 @@ title: What is Kubes?
|
|
11
11
|
* Automation: [Builds the Docker image]({% link _docs/config/docker.md %}) and updates the compiled YAML files
|
12
12
|
* Syntactic Sugar: Use an [ERB/YAML]({% link _docs/yaml.md %}) or a [DSL]({% link _docs/dsl.md %}) to write your Kubernetes YAML files. You can use a mix of DSL and YAML definitions in the `.kubes/resources` folder.
|
13
13
|
* Layering: Use the same Kubernetes YAML to build multiple environments like dev and prod with [layering]({% link _docs/layering.md %}).
|
14
|
-
*
|
14
|
+
* Generators: Kubes ships with a few generators to help you get building with Kubernetes quickly. See: [Generator Docs]({% link _docs/generators.md %}).
|
15
|
+
* CLI Customizations: You can customize the [cli args]({% link _docs/config/args/kubectl.md %}).
|
16
|
+
* Hooks: You can also run [hooks]({% link _docs/config/hooks.md %}) before and after [kubes]({% link _docs/config/hooks/kubes.md %}) and [kubectl]({% link _docs/config/hooks/kubectl.md %}) commands.
|
15
17
|
* Automated Suffix Hashes: Automatically appends a suffix hash to ConfigMap and Secret resources. More details in [ConfigMap]({% link _docs/dsl/resources/config_map.md %}) and [Secret]({% link _docs/dsl/resources/secret.md %}) docs.
|
16
18
|
* Kustomize Support: If you’re a kustomization user, you can use it with Kubes. More details in [Kustomize Support Docs]({% link _docs/misc/kustomize.md %}).
|
17
19
|
* Auto Context Switching: Map dev to a specific kubectl context and prod to another kubectl context and Kubes can switch them automatically so you won't have to remember. More details in [Auto Context Docs]({% link _docs/misc/auto-context.md %}).
|
@@ -0,0 +1,66 @@
|
|
1
|
+
---
|
2
|
+
title: Docker Image
|
3
|
+
---
|
4
|
+
|
5
|
+
With Kubes, you can use the `docker_image` helper method to select which image to use. It can use images from these sources:
|
6
|
+
|
7
|
+
1. CLI Option: The `--image` option specified with the CLI command
|
8
|
+
2. Kubes Config: Specified by `config.image` in the `.kubes/config.rb`
|
9
|
+
3. Built Docker Image: The image built from Dockerfile
|
10
|
+
|
11
|
+
The CLI option has the highest precedence, and the Built Docker image has the lowest precedence.
|
12
|
+
|
13
|
+
## 1. CLI Option
|
14
|
+
|
15
|
+
Kubes uses the image from the `--image` option if specified. It's a quick way to override the Docker image used by Kubes. Example:
|
16
|
+
|
17
|
+
kubes deploy --image repo/image:tag
|
18
|
+
|
19
|
+
When the `--image` option is set, Kubes skips the Docker build phase.
|
20
|
+
|
21
|
+
## 2. Kubes Config
|
22
|
+
|
23
|
+
If you set the `config.image` in the Kubes config, Kubes will use this prebuilt Docker image instead. Example:
|
24
|
+
|
25
|
+
.kubes/config.rb:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Kubes.configure do |config|
|
29
|
+
config.image = "nginx"
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
When `config.image` is set, Kubes skips the Docker build phase.
|
34
|
+
|
35
|
+
## 3. Built Docker Image
|
36
|
+
|
37
|
+
Kubes can use a Docker image built from your Dockerfile. This is the default behavior of Kubes, as long as the CLI Option and the Kubes Config option is not set.
|
38
|
+
|
39
|
+
## Template Example
|
40
|
+
|
41
|
+
Here's an example usage of the `docker_image` helper.
|
42
|
+
|
43
|
+
.kubes/resources/web/deployment.yaml
|
44
|
+
|
45
|
+
```yaml
|
46
|
+
apiVersion: apps/v1
|
47
|
+
kind: Deployment
|
48
|
+
metadata:
|
49
|
+
name: web
|
50
|
+
labels:
|
51
|
+
role: web
|
52
|
+
spec:
|
53
|
+
selector:
|
54
|
+
matchLabels:
|
55
|
+
role: web
|
56
|
+
template:
|
57
|
+
metadata:
|
58
|
+
labels:
|
59
|
+
role: web
|
60
|
+
spec:
|
61
|
+
containers:
|
62
|
+
- name: web
|
63
|
+
image: <%= docker_image %>
|
64
|
+
```
|
65
|
+
|
66
|
+
When running `kubes deploy`, Kubes will replace `<%= docker_image %>` with the Docker image from one of the sources described above.
|
@@ -67,7 +67,7 @@ The merging of simple String is a straightforward replacement.
|
|
67
67
|
.kubes/resources/web/deployment.rb
|
68
68
|
|
69
69
|
```ruby
|
70
|
-
image
|
70
|
+
image docker_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
71
71
|
# ...
|
72
72
|
```
|
73
73
|
|
@@ -6,11 +6,19 @@ Let's now delete the app and clean up:
|
|
6
6
|
|
7
7
|
kubes delete
|
8
8
|
|
9
|
-
You will be prompted to confirm before deletion.
|
9
|
+
You will be prompted to confirm before deletion.
|
10
10
|
|
11
11
|
$ kubes delete
|
12
|
+
Compiled .kubes/resources files to .kubes/output
|
13
|
+
Will run:
|
14
|
+
kubectl delete -f .kubes/output/web/deployment.yaml
|
15
|
+
kubectl delete -f .kubes/output/web/service.yaml
|
16
|
+
kubectl delete -f .kubes/output/shared/namespace.yaml
|
17
|
+
This will delete resources. Are you sure? (y/N)
|
18
|
+
|
19
|
+
Confirm to delete the resources:
|
20
|
+
|
12
21
|
This will delete resources. Are you sure? (y/N) y
|
13
|
-
Compiled .kubes/resources files
|
14
22
|
=> kubectl delete -f .kubes/output/web/service.yaml
|
15
23
|
service "demo-web" deleted
|
16
24
|
=> kubectl delete -f .kubes/output/web/deployment.yaml
|
@@ -29,10 +29,10 @@ labels(role: "web")
|
|
29
29
|
namespace "default"
|
30
30
|
|
31
31
|
replicas 1
|
32
|
-
image
|
32
|
+
image docker_image # IE: user/demo:kubes-2020-06-13T19-55-16-43afc6e
|
33
33
|
```
|
34
34
|
|
35
|
-
The DSL form is more concise than the YAML form. Also, notice the use of the `
|
35
|
+
The DSL form is more concise than the YAML form. Also, notice the use of the `docker_image` helper. The `docker_image` is a kubes helper method that refers to the latest Docker image built. This spares you from updating the image manually.
|
36
36
|
|
37
37
|
## Base Folder
|
38
38
|
|
@@ -6,11 +6,19 @@ Let's now delete the app and clean up:
|
|
6
6
|
|
7
7
|
kubes delete
|
8
8
|
|
9
|
-
You will be prompted to confirm before deletion.
|
9
|
+
You will be prompted to confirm before deletion.
|
10
10
|
|
11
11
|
$ kubes delete
|
12
|
+
Compiled .kubes/resources files to .kubes/output
|
13
|
+
Will run:
|
14
|
+
kubectl delete -f .kubes/output/web/deployment.yaml
|
15
|
+
kubectl delete -f .kubes/output/web/service.yaml
|
16
|
+
kubectl delete -f .kubes/output/shared/namespace.yaml
|
17
|
+
This will delete resources. Are you sure? (y/N)
|
18
|
+
|
19
|
+
Confirm to delete the resources:
|
20
|
+
|
12
21
|
This will delete resources. Are you sure? (y/N) y
|
13
|
-
Compiled .kubes/resources files
|
14
22
|
=> kubectl delete -f .kubes/output/web/service.yaml
|
15
23
|
service "demo-web" deleted
|
16
24
|
=> kubectl delete -f .kubes/output/web/deployment.yaml
|
@@ -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
|
|
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
|
```
|