kubes 0.4.6 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +54 -1
  4. data/docs/_docs/config/reference.md +1 -0
  5. data/docs/_docs/config/skip.md +1 -1
  6. data/docs/_docs/dsl/multiple-resources.md +3 -3
  7. data/docs/_docs/dsl/resources/job.md +62 -0
  8. data/docs/_docs/dsl/resources/secret.md +19 -2
  9. data/docs/_docs/extra-env/dsl.md +2 -2
  10. data/docs/_docs/extra-env/yaml.md +1 -1
  11. data/docs/_docs/generators.md +41 -0
  12. data/docs/_docs/helpers.md +17 -3
  13. data/docs/_docs/helpers/aws.md +1 -0
  14. data/docs/_docs/helpers/aws/advanced.md +10 -0
  15. data/docs/_docs/helpers/aws/advanced/secrets.md +131 -0
  16. data/docs/_docs/helpers/aws/advanced/ssm.md +78 -0
  17. data/docs/_docs/helpers/aws/secrets.md +18 -88
  18. data/docs/_docs/helpers/aws/ssm.md +20 -38
  19. data/docs/_docs/helpers/google.md +1 -1
  20. data/docs/_docs/helpers/google/advanced.md +10 -0
  21. data/docs/_docs/helpers/google/advanced/secrets.md +78 -0
  22. data/docs/_docs/helpers/google/secrets.md +18 -27
  23. data/docs/_docs/helpers/google/service-account.md +8 -0
  24. data/docs/_docs/intro.md +2 -9
  25. data/docs/_docs/intro/docker-image.md +66 -0
  26. data/docs/_docs/intro/how-kubes-works.md +7 -11
  27. data/docs/_docs/layering.md +2 -0
  28. data/docs/_docs/layering/merge.md +1 -1
  29. data/docs/_docs/layering/mix.md +99 -0
  30. data/docs/_docs/learn/dsl/delete.md +10 -2
  31. data/docs/_docs/learn/dsl/review-project.md +2 -2
  32. data/docs/_docs/learn/yaml/delete.md +10 -2
  33. data/docs/_docs/learn/yaml/review-project.md +2 -2
  34. data/docs/_docs/patterns/clock-web-worker.md +3 -3
  35. data/docs/_docs/patterns/migrations.md +1 -1
  36. data/docs/_docs/patterns/multiple-envs.md +55 -0
  37. data/docs/_docs/patterns/secrets.md +0 -2
  38. data/docs/_docs/variables.md +23 -0
  39. data/docs/_docs/variables/advanced.md +62 -0
  40. data/docs/_docs/variables/basic.md +137 -0
  41. data/docs/_docs/vs.md +10 -0
  42. data/docs/_docs/vs/custom.md +109 -0
  43. data/docs/_docs/vs/helm.md +243 -0
  44. data/docs/_docs/vs/kustomize.md +167 -0
  45. data/docs/_docs/yaml.md +2 -2
  46. data/docs/_includes/commands.html +2 -2
  47. data/docs/_includes/intro/features.md +11 -0
  48. data/docs/_includes/layering/layers.md +2 -4
  49. data/docs/_includes/sidebar.html +41 -0
  50. data/docs/_includes/vs/article.md +1 -0
  51. data/docs/_includes/vs/kubes/layering.md +10 -0
  52. data/docs/_includes/vs/kubes/structure.md +24 -0
  53. data/docs/_reference/kubes-delete.md +1 -1
  54. data/docs/_reference/kubes-exec.md +17 -1
  55. data/docs/_reference/kubes-init.md +2 -2
  56. data/docs/_reference/kubes-logs.md +2 -1
  57. data/docs/_reference/kubes-new-help.md +15 -0
  58. data/docs/_reference/kubes-new-helper.md +25 -0
  59. data/docs/_reference/kubes-new-resource.md +56 -0
  60. data/docs/_reference/kubes-new-variable.md +20 -0
  61. data/docs/_reference/kubes-new.md +26 -0
  62. data/docs/_reference/kubes-prune.md +22 -0
  63. data/docs/reference.md +2 -0
  64. data/kubes.gemspec +2 -2
  65. data/lib/kubes.rb +5 -3
  66. data/lib/kubes/auth.rb +4 -1
  67. data/lib/kubes/auth/base.rb +21 -0
  68. data/lib/kubes/auth/ecr.rb +1 -15
  69. data/lib/kubes/auth/gcr.rb +24 -0
  70. data/lib/kubes/cli.rb +9 -1
  71. data/lib/kubes/cli/build.rb +6 -0
  72. data/lib/kubes/cli/compile.rb +7 -0
  73. data/lib/kubes/cli/deploy.rb +1 -6
  74. data/lib/kubes/cli/exec.rb +5 -1
  75. data/lib/kubes/cli/help/exec.md +15 -0
  76. data/lib/kubes/cli/help/new/helper.md +4 -0
  77. data/lib/kubes/cli/help/new/resource.md +30 -0
  78. data/lib/kubes/cli/init.rb +1 -1
  79. data/lib/kubes/cli/new.rb +15 -0
  80. data/lib/kubes/cli/new/helper.rb +24 -0
  81. data/lib/kubes/cli/new/resource.rb +97 -0
  82. data/lib/kubes/cli/new/variable.rb +16 -0
  83. data/lib/kubes/cli/sequence.rb +1 -0
  84. data/lib/kubes/command.rb +7 -0
  85. data/lib/kubes/compiler.rb +19 -21
  86. data/lib/kubes/compiler/decorator/base.rb +1 -1
  87. data/lib/kubes/compiler/dsl/core/base.rb +6 -9
  88. data/lib/kubes/compiler/dsl/syntax/job.rb +217 -0
  89. data/lib/kubes/compiler/layering.rb +21 -7
  90. data/lib/kubes/compiler/shared/custom_variables.rb +38 -0
  91. data/lib/kubes/compiler/shared/helpers.rb +11 -2
  92. data/lib/kubes/compiler/shared/helpers/deprecated.rb +37 -0
  93. data/lib/kubes/compiler/shared/plugin_helpers.rb +14 -0
  94. data/lib/kubes/compiler/strategy.rb +7 -6
  95. data/lib/kubes/compiler/strategy/base.rb +59 -2
  96. data/lib/kubes/compiler/strategy/dsl.rb +0 -29
  97. data/lib/kubes/compiler/strategy/erb.rb +10 -22
  98. data/lib/kubes/compiler/util/normalize.rb +6 -3
  99. data/lib/kubes/compiler/util/yaml_dump.rb +4 -4
  100. data/lib/kubes/config.rb +1 -1
  101. data/lib/kubes/core.rb +6 -0
  102. data/lib/kubes/docker/strategy/image_name.rb +1 -1
  103. data/lib/kubes/kubectl.rb +5 -23
  104. data/lib/kubes/kubectl/batch.rb +27 -33
  105. data/lib/kubes/kubectl/ordering.rb +42 -0
  106. data/lib/kubes/plugin.rb +14 -0
  107. data/lib/kubes/util/sh.rb +1 -1
  108. data/lib/kubes/version.rb +1 -1
  109. data/lib/templates/base/.kubes/config.rb.tt +1 -1
  110. data/lib/templates/base/.kubes/config/env/dev.rb +1 -1
  111. data/lib/templates/base/.kubes/config/env/prod.rb +1 -1
  112. data/lib/templates/dsl/.kubes/resources/web/deployment.rb +1 -1
  113. data/lib/templates/new/helper/file.rb +2 -0
  114. data/lib/templates/new/resource/dsl/backend_config.rb +10 -0
  115. data/lib/templates/new/resource/dsl/config_map.rb +5 -0
  116. data/lib/templates/new/resource/dsl/daemon_set.rb +11 -0
  117. data/lib/templates/new/resource/dsl/deployment.rb +4 -0
  118. data/lib/templates/new/resource/dsl/ingress.rb +3 -0
  119. data/lib/templates/new/resource/dsl/job.rb +2 -0
  120. data/lib/templates/new/resource/dsl/managed_certificate.rb +2 -0
  121. data/lib/templates/new/resource/dsl/namespace.rb +2 -0
  122. data/lib/templates/new/resource/dsl/network_policy.rb +7 -0
  123. data/lib/templates/new/resource/dsl/pod.rb +6 -0
  124. data/lib/templates/new/resource/dsl/role.rb +4 -0
  125. data/lib/templates/new/resource/dsl/role_binding.rb +7 -0
  126. data/lib/templates/new/resource/dsl/secret.rb +5 -0
  127. data/lib/templates/new/resource/dsl/service.rb +2 -0
  128. data/lib/templates/new/resource/dsl/service_account.rb +1 -0
  129. data/lib/templates/new/resource/yaml/backend_config.yaml +10 -0
  130. data/lib/templates/new/resource/yaml/config_map.yaml +9 -0
  131. data/lib/templates/new/resource/yaml/daemon_set.yaml +11 -0
  132. data/lib/templates/new/resource/yaml/deployment.yaml +19 -0
  133. data/lib/templates/new/resource/yaml/ingress.yaml +12 -0
  134. data/lib/templates/new/resource/yaml/job.yaml +19 -0
  135. data/lib/templates/new/resource/yaml/managed_certificate.yaml +7 -0
  136. data/lib/templates/new/resource/yaml/namespace.yaml +6 -0
  137. data/lib/templates/new/resource/yaml/network_policy.yaml +20 -0
  138. data/lib/templates/new/resource/yaml/pod.yaml +11 -0
  139. data/lib/templates/new/resource/yaml/role.yaml +13 -0
  140. data/lib/templates/new/resource/yaml/role_binding.yaml +11 -0
  141. data/lib/templates/new/resource/yaml/secret.yaml +9 -0
  142. data/lib/templates/new/resource/yaml/service.yaml +14 -0
  143. data/lib/templates/new/resource/yaml/service_account.yaml +4 -0
  144. data/lib/templates/new/variable/file.rb +1 -0
  145. data/lib/templates/yaml/.kubes/resources/base/all.yaml.tt +2 -0
  146. data/lib/templates/yaml/.kubes/resources/web/deployment.yaml.tt +1 -1
  147. data/spec/fixtures/multiple-files/{deployment-1.rb → .kubes/resources/web/deployment-1.rb} +0 -0
  148. data/spec/fixtures/multiple-files/{deployment-2.rb → .kubes/resources/web/deployment-2.rb} +0 -0
  149. data/spec/fixtures/project/.kubes/resources/{deployment.rb → web/deployment.rb} +0 -0
  150. data/spec/fixtures/project/.kubes/resources/{foobar.rb → web/empty.rb} +0 -0
  151. data/spec/fixtures/project/.kubes/resources/{service.rb → web/service.rb} +1 -1
  152. data/spec/fixtures/syntax/{network_policy.rb → .kubes/resources/web/network_policy.rb} +0 -0
  153. data/spec/fixtures/syntax/{pod.rb → .kubes/resources/web/pod.rb} +0 -0
  154. data/spec/kubes/cli/prune_spec.rb +1 -0
  155. data/spec/kubes/compiler/strategy/dsl_spec.rb +2 -2
  156. data/spec/kubes/compiler_spec.rb +6 -2
  157. data/spec/kubes/dsl/network_policy_spec.rb +1 -1
  158. data/spec/kubes/dsl/pod_spec.rb +1 -1
  159. metadata +97 -25
@@ -0,0 +1,167 @@
1
+ ---
2
+ title: Kubes vs Kustomize
3
+ nav_text: Kustomize
4
+ categories: vs
5
+ ---
6
+
7
+ Though both Kubes and Kustomize build YAML files, they are quite different beasts. Kustomize is more like a `kubectl` feature that decorates YAML. Kubes is more like a tool. Kubes also builds YAML, but it also provides additional features.
8
+
9
+ Kustomize lets you customize your Kubernetes YAML files with additional `kustomization.yaml` files. The kustomization.yaml files contain configs that tell `kubectl` how to decorate existing Kubernetes YAML files in a template-free way.
10
+
11
+ Kubes lets you create Kubernetes files more directly. It handles layering and merging YAML files via a conventional structure. It also supports additional conveniences like building Docker images, CLI Customizations, Hooks, etc.
12
+
13
+ {% include vs/article.md %}
14
+
15
+ ## Project Structures
16
+
17
+ ### Kustomize Project Structure
18
+
19
+ Kustomize doesn't define a strict a project folder structure. You define any project structure you wish and use `kustomization.yaml` files to connect things together. Here's a possible Kustomize example project structure:
20
+
21
+ ├── base
22
+ │ ├── deployment.yaml
23
+ │ ├── kustomization.yaml
24
+ │ └── service.yaml
25
+ └── overlays
26
+ ├── dev
27
+ │ ├── deployment.yaml
28
+ │ ├── kustomization.yaml
29
+ │ └── namespace.yaml
30
+ └── prod
31
+ ├── deployment.yaml
32
+ ├── kustomization.yaml
33
+ └── namespace.yaml
34
+
35
+ The provided structure allows you to use the same code to create different environments with overlays. The `overlays/dev/kustomization.yaml` file stitches the structure together.
36
+
37
+ overlays/dev/kustomization.yaml:
38
+
39
+ ```yaml
40
+ apiVersion: kustomize.config.k8s.io/v1beta1
41
+ kind: Kustomization
42
+ bases:
43
+ - ../../base
44
+ patchesStrategicMerge:
45
+ - deployment.yaml
46
+ namespace: demo-dev
47
+ resources:
48
+ - ./namespace.yaml
49
+ ```
50
+
51
+ {% include vs/kubes/structure.md %}
52
+
53
+ ## Multiple Environments: Overlays vs Layering
54
+
55
+ Both Kustomize and Kubes allow you to use the same code to create multiple environments. They take different approaches, though.
56
+
57
+ ### Kustomize Overlays
58
+
59
+ Kustomize achieves multiple environments via `kustomization.yaml` and manually specifying and wiring how the files should merge. To create different dev and prod environments, we use overlays:
60
+
61
+ kubectl apply -k overlays/dev
62
+ kubectl apply -k overlays/prod
63
+
64
+ {% include vs/kubes/layering.md %}
65
+
66
+ ## DRY Differences
67
+
68
+ ## DRY with Kustomize
69
+
70
+ Both Kubes and Kustomize try to achieve DRY YAML code. It tries to avoid YAML duplication.
71
+
72
+ Kustomize takes a purist viewpoint. You use `kustomization.yaml` to decorate original YAML. The original files are untouched and left as-is. Here are example overlays files.
73
+
74
+ overlays/dev/kustomization.yaml:
75
+
76
+ ```yaml
77
+ apiVersion: kustomize.config.k8s.io/v1beta1
78
+ kind: Kustomization
79
+ bases:
80
+ - ../../base
81
+ patchesStrategicMerge:
82
+ - deployment.yaml
83
+ namespace: demo-dev
84
+ resources:
85
+ - ./namespace.yaml
86
+ ```
87
+
88
+ overlays/prod/kustomization.yaml:
89
+
90
+ ```yaml
91
+ apiVersion: kustomize.config.k8s.io/v1beta1
92
+ kind: Kustomization
93
+ bases:
94
+ - ../../base
95
+ patchesStrategicMerge:
96
+ - deployment.yaml
97
+ namespace: demo-prod
98
+ resources:
99
+ - ./namespace.yaml
100
+ ```
101
+
102
+ While duplication is reduced since the original `base/deployment.yaml` is left untouched, there is duplication in the `kustomization.yaml` files.
103
+
104
+ ## DRY with Kubes
105
+
106
+ With Kubes, DRY has handled by layering and templating support. Let's first take a look at how layering removes duplication.
107
+
108
+ Let's focus on `deployment.yaml` to explain and understand layering. Here are the files that get layered.
109
+
110
+ .kubes/resources/base/all.yaml # common YAML for all files
111
+ .kubes/resources/base/deployment.yaml # common YAML for deployment kind
112
+ .kubes/resources/web/deployment.yaml
113
+ .kubes/resources/web/deployment/dev.yaml # env-specific that overrides YAML
114
+
115
+ Each file is merged together and produces a resulting YAML file:
116
+
117
+ .kubes/output/web/deployment.yaml
118
+
119
+ Additionally, you can use ERB templating to keep things DRY. Here's an example:
120
+
121
+ .kubes/resources/shared/namespace.yaml
122
+
123
+ ```yaml
124
+ apiVersion: v1
125
+ kind: Namespace
126
+ metadata:
127
+ name: demo-<%= Kubes.env %>
128
+ labels:
129
+ app: demo
130
+ ```
131
+
132
+ Notice the `<%= Kubes.env %>` templating logic. When is `KUBES_ENV=dev`, then `name: demo-dev`. When is `KUBES_ENV=prod`, then `name: demo-prod`.
133
+
134
+ You can even define your own custom helpers for even more control. See: [Helpers Docs](https://kubes.guru/docs/helpers/custom/)
135
+
136
+ ## Kubes Features
137
+
138
+ Kubes does a lot more than build YAML files. Here's a list of features:
139
+
140
+ {% include intro/features.md %}
141
+
142
+ ## Kubes Kustomize Support
143
+
144
+ All of that being said, Kubes also supports Kustomize. So if you’re a Kustomize user, you can use it with Kubes. Here's an example Kustomize structure with Kubes.
145
+
146
+ .kubes/resources
147
+ ├── base
148
+ │ ├── deployment.yaml
149
+ │ ├── kustomization.yaml
150
+ │ └── service.yaml
151
+ └── overlays
152
+ ├── dev
153
+ │ └── kustomization.yaml
154
+ └── prod
155
+ └── kustomization.yaml
156
+
157
+ In Kustomize mode, Kubes will call `kubectl apply -k`. Here's an example:
158
+
159
+ kubes deploy overlays/dev
160
+
161
+ This calls:
162
+
163
+ kubectl apply -k .kubes/output/overlays/dev
164
+
165
+ ## Summary
166
+
167
+ Kustomize and Kubes are quite different. Kustomize is more of a feature to kubectl and takes on a purist view on changing YAML files for deployment. Kubes has similar merging concepts as Kustomize in the form of layering. Kustomize is more about control things with additional `kustomization.yaml` configurations. Whereas, Kubes takes more of a convention-over-configuration approach, so it just works without having to do extra prewiring work. Kubes additionally helps you build your Docker images.
@@ -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 `built_image` helper.
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: <%= built_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: <%= built_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 built_image # IE: user/demo-web:kubes-2020-06-13T19-55-16-43afc6e
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,11 @@
1
+ * Automation: [Builds the Docker image]({% link _docs/config/docker.md %}) and updates the compiled YAML files
2
+ * 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.
3
+ * Layering: Use the same Kubernetes YAML to build multiple environments like dev and prod with [layering]({% link _docs/layering.md %}).
4
+ * Secrets: Use helpers like [aws_secret]({% link _docs/helpers/aws/secrets.md %}), [aws_ssm]({% link _docs/helpers/aws/ssm.md %}), and [google_secret]({% link _docs/helpers/google/secrets.md %}) to build Kubernetes secrets.yaml from secret providers designed for it.
5
+ * Generators: Kubes ships with a few generators to help you get building with Kubernetes quickly. See: [Generator Docs]({% link _docs/generators.md %}).
6
+ * CLI Customizations: You can customize the [cli args]({% link _docs/config/args/kubectl.md %}).
7
+ * 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.
8
+ * 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.
9
+ * 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 %}).
10
+ * 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 %}).
11
+ * Ordering: Kubes run kubectl apply to create resources in the [correct order]({% link _docs/intro/ordering.md %}). For deleting, it kubes will run `kubectl delete` in the correct reverse order. The order is also [customizable]({% link _docs/intro/ordering/custom.md %}).
@@ -1,6 +1,6 @@
1
1
  Kubes Layering in it's full form allows you to keep your resource definitions DRY and create different environments with the same code.
2
2
 
3
- ## Structure
3
+ ## Project Structure
4
4
 
5
5
  Here's an example structure, so we can understand how layering works.
6
6
 
@@ -25,9 +25,7 @@ To explain the layering, here's the general processing order that Kubes takes.
25
25
  2. Then Kubes will process your `.kubes/resources/ROLE` definitions.
26
26
  3. Lastly, Kubes processes any post-layers in the `.kubes/resources/ROLE/KIND` folders.
27
27
 
28
- Note, both YAML and DSL forms support layering.
29
-
30
- Layering only combines resources definitions with the same form. For example, the DSL form `base/all.rb` will not be combined with YAML form `web/deployment.yaml`.
28
+ Note, both YAML and DSL forms support layering. They can be mixed together.
31
29
 
32
30
  ## Full Layering
33
31
 
@@ -28,6 +28,14 @@
28
28
  <li><a href="{% link _docs/learn/dsl/next-steps.md %}">Next Steps</a></li>
29
29
  </ul>
30
30
  </li>
31
+ <li><a href="{% link _docs/vs.md %}">Kubes vs Others</a>
32
+ <ul>
33
+ {% assign docs = site.docs | where: "categories","vs" %}
34
+ {% for doc in docs -%}
35
+ <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
36
+ {% endfor %}
37
+ </ul>
38
+ </li>
31
39
  </ul>
32
40
  <h2><a href="{% link docs.md %}">Docs</a></h2>
33
41
  <ul id="docs">
@@ -42,6 +50,7 @@
42
50
  </ul>
43
51
  </li>
44
52
  <li><a href="{% link _docs/intro/install.md %}">Install</a></li>
53
+ <li><a href="{% link _docs/intro/docker-image.md %}">Docker Image</a></li>
45
54
  </ul>
46
55
  </li>
47
56
  <li><a href="{% link _docs/resources.md %}">Resources</a>
@@ -76,11 +85,13 @@
76
85
  <li><a href="{% link _docs/config/reference.md %}">Reference</a></li>
77
86
  </ul>
78
87
  </li>
88
+ <li><a href="{% link _docs/generators.md %}">Generators</a></li>
79
89
  <li><a href="{% link _docs/yaml.md %}">YAML</a></li>
80
90
  <li><a href="{% link _docs/layering.md %}">Layering</a>
81
91
  <ul>
82
92
  <li><a href="{% link _docs/layering/yaml.md %}">YAML</a></li>
83
93
  <li><a href="{% link _docs/layering/dsl.md %}">DSL</a></li>
94
+ <li><a href="{% link _docs/layering/mix.md %}">Mix</a></li>
84
95
  <li><a href="{% link _docs/layering/merge.md %}">Merge Behavior</a></li>
85
96
  </ul>
86
97
  </li>
@@ -97,6 +108,14 @@
97
108
  <li><a href="{% link _docs/dsl/multiple-resources.md %}">Multiple Resources</a>
98
109
  </ul>
99
110
  </li>
111
+ <li><a href="{% link _docs/variables.md %}">Variables</a>
112
+ <ul>
113
+ {% assign docs = site.docs | where: "categories","variables" %}
114
+ {% for doc in docs -%}
115
+ <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
116
+ {% endfor %}
117
+ </ul>
118
+ </li>
100
119
  <li><a href="{% link _docs/helpers.md %}">Helpers</a>
101
120
  <ul>
102
121
  <li><a href="{% link _docs/helpers/custom.md %}">Custom</a></li>
@@ -104,7 +123,18 @@
104
123
  <ul>
105
124
  {% assign docs = site.docs | where: "categories","helpers-aws" %}
106
125
  {% for doc in docs -%}
126
+ {% if doc.nav_text == "Advanced" %}
127
+ <li><a href='{{ doc.url }}'>{{ doc.nav_text }}</a>
128
+ <ul>
129
+ {% assign docs = site.docs | where: "categories","advanced-helpers-aws" %}
130
+ {% for doc in docs -%}
131
+ <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
132
+ {% endfor %}
133
+ </ul>
134
+ </li>
135
+ {% else %}
107
136
  <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
137
+ {% endif %}
108
138
  {% endfor %}
109
139
  </ul>
110
140
  </li>
@@ -112,7 +142,18 @@
112
142
  <ul>
113
143
  {% assign docs = site.docs | where: "categories","helpers-google" %}
114
144
  {% for doc in docs -%}
145
+ {% if doc.nav_text == "Advanced" %}
146
+ <li><a href='{{ doc.url }}'>{{ doc.nav_text }}</a>
147
+ <ul>
148
+ {% assign docs = site.docs | where: "categories","advanced-helpers-google" %}
149
+ {% for doc in docs -%}
150
+ <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
151
+ {% endfor %}
152
+ </ul>
153
+ </li>
154
+ {% else %}
115
155
  <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
156
+ {% endif %}
116
157
  {% endfor %}
117
158
  </ul>
118
159
  </li>
@@ -0,0 +1 @@
1
+ This article also covers more differences in detail: [Kustomize vs Helm vs Kubes: Kubernetes Deploy Tools](https://blog.boltops.com/2020/11/05/kustomize-vs-helm-vs-kubes-kubernetes-deploy-tools)
@@ -0,0 +1,10 @@
1
+ ### Kubes Layering
2
+
3
+ To deploy and create multiple environments like dev and prod with the same YAML, we use a different KUBES_ENV setting:
4
+
5
+ KUBES_ENV=dev kubes deploy
6
+ KUBES_ENV=prod kubes deploy
7
+
8
+ The layering is achieved thanks to the conventional project structure. You don't have to do any extra work, you just create pre-process base layer files or post-process environment specific layer files.
9
+
10
+ * [Kubes Layering Docs]({% link _docs/layering.md %})
@@ -0,0 +1,24 @@
1
+ ### Kubes Project Structure
2
+
3
+ On the other hand, Kubes defines a conventional project structure. Here's a project directory example:
4
+
5
+ .kubes
6
+ └── resources
7
+ ├── base
8
+ │ ├── all.yaml
9
+ │ └── deployment.yaml
10
+ ├── shared
11
+ │ └── namespace.yaml
12
+ └── web
13
+ ├── deployment
14
+ │ ├── dev.yaml
15
+ │ └── prod.yaml
16
+ ├── deployment.yaml
17
+ └── service.yaml
18
+
19
+ A Kubes project structure also supports introduces a role concept or folder. The folder structure only shows a web role for simplicity. You can always add more roles. For example:
20
+
21
+ .kubes/resources/ROLE/deployment.yaml
22
+ .kubes/resources/clock/deployment.yaml
23
+ .kubes/resources/web/deployment.yaml
24
+ .kubes/resources/worker/deployment.yaml
@@ -9,7 +9,7 @@ reference: true
9
9
 
10
10
  ## Description
11
11
 
12
- Delete Kubernetes resources within the app folder
12
+ Delete Kubernetes resources in defined .kubes/resources
13
13
 
14
14
 
15
15
  ## Options
@@ -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
- n, [--name=NAME] # deployment name to use. IE: demo-web
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
- [--force] # Bypass overwrite are you sure prompt for existing files
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 the app option
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
- n, [--name=NAME] # deployment name to use. IE: demo-web
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,15 @@
1
+ ---
2
+ title: kubes new help
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ kubes new help [COMMAND]
9
+
10
+ ## Description
11
+
12
+ Describe subcommands or one specific subcommand
13
+
14
+
15
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ title: kubes new helper
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ kubes new helper
9
+
10
+ ## Description
11
+
12
+ Generates kubes helper file.
13
+
14
+ ## Examples
15
+
16
+ $ kubes new helper custom
17
+ create .kubes/helpers/custom_helper.rb
18
+
19
+
20
+ ## Options
21
+
22
+ ```
23
+ y, [--force] # Bypass overwrite are you sure prompt for existing files
24
+ ```
25
+