kubes 0.5.1 → 0.6.4

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.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/.gcloudignore +22 -0
  3. data/.gitignore +1 -1
  4. data/CHANGELOG.md +22 -0
  5. data/Dockerfile +6 -6
  6. data/Dockerfile.alpine +20 -0
  7. data/README.md +53 -7
  8. data/docker/install/docker.sh +8 -0
  9. data/docker/install/gcloud.sh +18 -0
  10. data/docker/install/kubectl.sh +4 -0
  11. data/docs/_docs/config/hooks/kubes.md +1 -0
  12. data/docs/_docs/config/reference.md +1 -0
  13. data/docs/_docs/dsl/multiple-resources.md +3 -1
  14. data/docs/_docs/dsl/resources/secret.md +19 -2
  15. data/docs/_docs/generators.md +4 -4
  16. data/docs/_docs/helpers.md +4 -2
  17. data/docs/_docs/helpers/aws/advanced.md +10 -0
  18. data/docs/_docs/helpers/aws/advanced/secrets.md +131 -0
  19. data/docs/_docs/helpers/aws/advanced/ssm.md +78 -0
  20. data/docs/_docs/helpers/aws/secrets.md +25 -83
  21. data/docs/_docs/helpers/aws/ssm.md +20 -38
  22. data/docs/_docs/helpers/custom.md +1 -0
  23. data/docs/_docs/helpers/google/advanced.md +10 -0
  24. data/docs/_docs/helpers/google/advanced/secrets.md +78 -0
  25. data/docs/_docs/helpers/google/gke.md +92 -0
  26. data/docs/_docs/helpers/google/secrets.md +30 -27
  27. data/docs/_docs/intro.md +2 -11
  28. data/docs/_docs/layering.md +2 -0
  29. data/docs/_docs/layering/mix.md +99 -0
  30. data/docs/_docs/patterns/multiple-envs.md +55 -0
  31. data/docs/_docs/plugins.md +12 -0
  32. data/docs/_docs/plugins/aws.md +17 -0
  33. data/docs/_docs/plugins/google.md +18 -0
  34. data/docs/_docs/variables.md +12 -0
  35. data/docs/_docs/variables/advanced.md +64 -0
  36. data/docs/_docs/variables/basic.md +139 -0
  37. data/docs/_docs/vs.md +10 -0
  38. data/docs/_docs/vs/custom.md +109 -0
  39. data/docs/_docs/vs/helm.md +243 -0
  40. data/docs/_docs/vs/kustomize.md +167 -0
  41. data/docs/_includes/helpers/generator.md +13 -0
  42. data/docs/_includes/intro/features.md +11 -0
  43. data/docs/_includes/layering/layers.md +11 -15
  44. data/docs/_includes/plugins/gke-config.md +6 -0
  45. data/docs/_includes/sidebar.html +45 -0
  46. data/docs/_includes/variables/generator.md +12 -0
  47. data/docs/_includes/vs/article.md +1 -0
  48. data/docs/_includes/vs/kubes/layering.md +10 -0
  49. data/docs/_includes/vs/kubes/structure.md +24 -0
  50. data/docs/_reference/kubes-new-help.md +15 -0
  51. data/docs/_reference/kubes-new-helper.md +25 -0
  52. data/docs/_reference/kubes-new-resource.md +56 -0
  53. data/docs/_reference/kubes-new-variable.md +20 -0
  54. data/docs/_reference/kubes-new.md +6 -38
  55. data/kubes.gemspec +2 -2
  56. data/lib/kubes.rb +4 -3
  57. data/lib/kubes/auth.rb +13 -1
  58. data/lib/kubes/auth/base.rb +21 -0
  59. data/lib/kubes/auth/ecr.rb +1 -15
  60. data/lib/kubes/auth/gcr.rb +24 -0
  61. data/lib/kubes/cli/apply.rb +0 -1
  62. data/lib/kubes/cli/help/new/helper.md +4 -0
  63. data/lib/kubes/cli/help/{new.md → new/resource.md} +3 -3
  64. data/lib/kubes/cli/new.rb +12 -94
  65. data/lib/kubes/cli/new/helper.rb +24 -0
  66. data/lib/kubes/cli/new/resource.rb +97 -0
  67. data/lib/kubes/cli/new/variable.rb +16 -0
  68. data/lib/kubes/cli/prune.rb +4 -2
  69. data/lib/kubes/command.rb +1 -1
  70. data/lib/kubes/compiler/decorator/base.rb +1 -1
  71. data/lib/kubes/compiler/dsl/core/base.rb +6 -9
  72. data/lib/kubes/compiler/layering.rb +21 -7
  73. data/lib/kubes/compiler/shared/custom_variables.rb +38 -0
  74. data/lib/kubes/compiler/shared/plugin_helpers.rb +14 -0
  75. data/lib/kubes/compiler/strategy.rb +7 -6
  76. data/lib/kubes/compiler/strategy/base.rb +59 -2
  77. data/lib/kubes/compiler/strategy/dsl.rb +0 -29
  78. data/lib/kubes/compiler/strategy/erb.rb +10 -22
  79. data/lib/kubes/compiler/util/normalize.rb +6 -3
  80. data/lib/kubes/compiler/util/yaml_dump.rb +4 -4
  81. data/lib/kubes/config.rb +14 -0
  82. data/lib/kubes/hooks/builder.rb +20 -5
  83. data/lib/kubes/hooks/concern.rb +1 -1
  84. data/lib/kubes/kubectl/batch.rb +7 -0
  85. data/lib/kubes/plugin.rb +14 -0
  86. data/lib/kubes/util/sh.rb +1 -1
  87. data/lib/kubes/version.rb +1 -1
  88. data/lib/templates/new/helper/file.rb +2 -0
  89. data/lib/templates/new/{dsl → resource/dsl}/backend_config.rb +0 -0
  90. data/lib/templates/new/{dsl → resource/dsl}/config_map.rb +0 -0
  91. data/lib/templates/new/{dsl → resource/dsl}/daemon_set.rb +0 -0
  92. data/lib/templates/new/{dsl → resource/dsl}/deployment.rb +0 -0
  93. data/lib/templates/new/{dsl → resource/dsl}/ingress.rb +0 -0
  94. data/lib/templates/new/{dsl → resource/dsl}/job.rb +0 -0
  95. data/lib/templates/new/{dsl → resource/dsl}/managed_certificate.rb +0 -0
  96. data/lib/templates/new/{dsl → resource/dsl}/namespace.rb +0 -0
  97. data/lib/templates/new/{dsl → resource/dsl}/network_policy.rb +0 -0
  98. data/lib/templates/new/{dsl → resource/dsl}/pod.rb +0 -0
  99. data/lib/templates/new/{dsl → resource/dsl}/role.rb +0 -0
  100. data/lib/templates/new/{dsl → resource/dsl}/role_binding.rb +0 -0
  101. data/lib/templates/new/{dsl → resource/dsl}/secret.rb +0 -0
  102. data/lib/templates/new/{dsl → resource/dsl}/service.rb +0 -0
  103. data/lib/templates/new/{dsl → resource/dsl}/service_account.rb +0 -0
  104. data/lib/templates/new/{yaml → resource/yaml}/backend_config.yaml +0 -0
  105. data/lib/templates/new/{yaml → resource/yaml}/config_map.yaml +0 -0
  106. data/lib/templates/new/{yaml → resource/yaml}/daemon_set.yaml +0 -0
  107. data/lib/templates/new/{yaml → resource/yaml}/deployment.yaml +0 -0
  108. data/lib/templates/new/{yaml → resource/yaml}/ingress.yaml +0 -0
  109. data/lib/templates/new/{yaml → resource/yaml}/job.yaml +0 -0
  110. data/lib/templates/new/{yaml → resource/yaml}/managed_certificate.yaml +0 -0
  111. data/lib/templates/new/{yaml → resource/yaml}/namespace.yaml +0 -0
  112. data/lib/templates/new/{yaml → resource/yaml}/network_policy.yaml +0 -0
  113. data/lib/templates/new/{yaml → resource/yaml}/pod.yaml +0 -0
  114. data/lib/templates/new/{yaml → resource/yaml}/role.yaml +0 -0
  115. data/lib/templates/new/{yaml → resource/yaml}/role_binding.yaml +0 -0
  116. data/lib/templates/new/{yaml → resource/yaml}/secret.yaml +0 -0
  117. data/lib/templates/new/{yaml → resource/yaml}/service.yaml +0 -0
  118. data/lib/templates/new/{yaml → resource/yaml}/service_account.yaml +0 -0
  119. data/lib/templates/new/variable/file.rb +1 -0
  120. data/spec/fixtures/multiple-files/{deployment-1.rb → .kubes/resources/web/deployment-1.rb} +0 -0
  121. data/spec/fixtures/multiple-files/{deployment-2.rb → .kubes/resources/web/deployment-2.rb} +0 -0
  122. data/spec/fixtures/project/.kubes/resources/{deployment.rb → web/deployment.rb} +0 -0
  123. data/spec/fixtures/project/.kubes/resources/{foobar.rb → web/empty.rb} +0 -0
  124. data/spec/fixtures/project/.kubes/resources/{service.rb → web/service.rb} +1 -1
  125. data/spec/fixtures/syntax/{network_policy.rb → .kubes/resources/web/network_policy.rb} +0 -0
  126. data/spec/fixtures/syntax/{pod.rb → .kubes/resources/web/pod.rb} +0 -0
  127. data/spec/kubes/compiler/strategy/dsl_spec.rb +2 -2
  128. data/spec/kubes/compiler_spec.rb +1 -1
  129. data/spec/kubes/dsl/network_policy_spec.rb +1 -1
  130. data/spec/kubes/dsl/pod_spec.rb +1 -1
  131. metadata +101 -56
@@ -0,0 +1,13 @@
1
+ ## Generator
2
+
3
+ To help you get started quickly, you can generate starter helper code.
4
+
5
+ $ kubes new helper custom
6
+ create .kubes/helpers/custom_helper.rb
7
+
8
+ .kubes/helpers/custom_helper.rb
9
+
10
+ ```ruby
11
+ module CustomHelper
12
+ end
13
+ ```
@@ -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
 
@@ -50,15 +48,13 @@ ROLE/KIND/ENV.{{ include.ext }} | web/deployment/dev.{{ include.ext }}
50
48
  2. Then you can define the core of your resource definition in the `ROLE/KIND.{{ include.ext }}`. Example: `web/deployment.{{ include.ext }}`
51
49
  3. Finally, you can provide environment-specific overrides in the `ROLE/KIND/ENV.{{ include.ext }}`. Example: `web/deployment/dev.{{ include.ext }}`.
52
50
 
53
- Here's an example of the structure:
51
+ Here's a concrete example of layering with the deployment resource kind:
54
52
 
55
- .kubes/resources/
56
- ├── base
57
- │ ├── all.{{ include.ext }}
58
- │ └── deployment.{{ include.ext }}
59
- └── web
60
- ├── deployment
61
- │ ├── dev.{{ include.ext }}
62
- │ └── prod.{{ include.ext }}
63
- ├── deployment.{{ include.ext }}
64
- └── service.{{ include.ext }}
53
+ .kubes/resources/base/all.{{ include.ext }}
54
+ .kubes/resources/base/deployment.{{ include.ext }}
55
+ .kubes/resources/web/deployment.{{ include.ext }}
56
+ .kubes/resources/web/deployment/dev.{{ include.ext }}
57
+
58
+ All of these files get layered and merged together to produce a resulting deployment.{{ include.ext }}
59
+
60
+ .kubes/output/web/deployment.{{ include.ext }}
@@ -0,0 +1,6 @@
1
+ gke.cluster_name | GKE cluster name. This is required when using the [GKE whitelisting feature]({% link _docs/helpers/google/gke.md %}). | nil
2
+ gke.enable_get_credentials | Whether or not to run the hook that calls `gcloud container clusters get-credentials`. This spares you from having to call it manually. | false
3
+ gke.enable_hooks | This will be true when the cluster_name is set. So there's no need to set it. The option provides a quick way to override and disable running the hooks. | true
4
+ gke.google_project | Google project. Can also be set with the env var `GOOGLE_PROJECT`. `GOOGLE_PROJECT` takes precedence. | nil
5
+ gke.google_region | Google region cluster is in. Can also be set with the env var `GOOGLE_REGION`. `GOOGLE_REGION` takes precedence. | nil
6
+ gke.whitelist_ip | Explicit IP to whitelist. By default the IP address of the current machine is automatically detected and used. | nil
@@ -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">
@@ -83,6 +91,7 @@
83
91
  <ul>
84
92
  <li><a href="{% link _docs/layering/yaml.md %}">YAML</a></li>
85
93
  <li><a href="{% link _docs/layering/dsl.md %}">DSL</a></li>
94
+ <li><a href="{% link _docs/layering/mix.md %}">Mix</a></li>
86
95
  <li><a href="{% link _docs/layering/merge.md %}">Merge Behavior</a></li>
87
96
  </ul>
88
97
  </li>
@@ -99,6 +108,14 @@
99
108
  <li><a href="{% link _docs/dsl/multiple-resources.md %}">Multiple Resources</a>
100
109
  </ul>
101
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>
102
119
  <li><a href="{% link _docs/helpers.md %}">Helpers</a>
103
120
  <ul>
104
121
  <li><a href="{% link _docs/helpers/custom.md %}">Custom</a></li>
@@ -106,7 +123,18 @@
106
123
  <ul>
107
124
  {% assign docs = site.docs | where: "categories","helpers-aws" %}
108
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 %}
109
136
  <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
137
+ {% endif %}
110
138
  {% endfor %}
111
139
  </ul>
112
140
  </li>
@@ -114,7 +142,18 @@
114
142
  <ul>
115
143
  {% assign docs = site.docs | where: "categories","helpers-google" %}
116
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 %}
117
155
  <li><a href="{{ doc.url }}">{{ doc.nav_text }}</a></li>
156
+ {% endif %}
118
157
  {% endfor %}
119
158
  </ul>
120
159
  </li>
@@ -134,6 +173,12 @@
134
173
  <li><a href="{% link _docs/extra-env/dsl.md %}">DSL</a></li>
135
174
  </ul>
136
175
  </li>
176
+ <li><a href="{% link _docs/plugins.md %}">Plugins</a>
177
+ <ul>
178
+ <li><a href="{% link _docs/plugins/aws.md %}">AWS</a></li>
179
+ <li><a href="{% link _docs/plugins/google.md %}">Google</a></li>
180
+ </ul>
181
+ </li>
137
182
  <li>Misc
138
183
  <ul>
139
184
  <li><a href="{% link _docs/misc/kustomize.md %}">Kustomize Support</a></li>
@@ -0,0 +1,12 @@
1
+ ## Generator
2
+
3
+ To help you get started quickly, you can generate starter variable code.
4
+
5
+ $ kubes new variable
6
+ create .kubes/variables/dev.rb
7
+
8
+ .kubes/variables/dev.rb
9
+
10
+ ```ruby
11
+ @example = "dev-value"
12
+ ```
@@ -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
@@ -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
+
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: kubes new resource
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ kubes new resource
9
+
10
+ ## Description
11
+
12
+ Generates Kubes Kubernetes resource definition.
13
+
14
+ ## Examples
15
+
16
+ $ kubes new resource ingress
17
+ create .kubes/resources/web/ingress.yaml
18
+ $ kubes new resource 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/resource/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
+ ```
56
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: kubes new variable
3
+ reference: true
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ kubes new variable
9
+
10
+ ## Description
11
+
12
+ Generates kubes variable file.
13
+
14
+
15
+ ## Options
16
+
17
+ ```
18
+ y, [--force] # Bypass overwrite are you sure prompt for existing files
19
+ ```
20
+
@@ -11,48 +11,16 @@ reference: true
11
11
 
12
12
  Generates new resource.
13
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
14
+ ## Subcommands
44
15
 
16
+ * [kubes new helper]({% link _reference/kubes-new-helper.md %}) - Generates kubes helper file.
17
+ * [kubes new resource]({% link _reference/kubes-new-resource.md %}) - Generates Kubes Kubernetes resource definition.
18
+ * [kubes new variable]({% link _reference/kubes-new-variable.md %}) - Generates kubes variable file.
45
19
 
46
20
  ## Options
47
21
 
48
22
  ```
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]
23
+ [--verbose], [--no-verbose]
24
+ [--noop], [--no-noop]
57
25
  ```
58
26
 
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "zeitwerk"
30
30
 
31
31
  # core helper libs
32
- spec.add_dependency "kubes_aws"
33
- spec.add_dependency "kubes_google"
32
+ spec.add_dependency "kubes_aws", "~> 0.3.0"
33
+ spec.add_dependency "kubes_google", "~> 0.3.2"
34
34
 
35
35
  spec.add_development_dependency "bundler"
36
36
  spec.add_development_dependency "byebug"
@@ -1,6 +1,10 @@
1
1
  $stdout.sync = true unless ENV["KUBES_STDOUT_SYNC"] == "0"
2
2
 
3
3
  $:.unshift(File.expand_path("../", __FILE__))
4
+
5
+ require "kubes/autoloader"
6
+ Kubes::Autoloader.setup
7
+
4
8
  require "active_support/core_ext/class"
5
9
  require "active_support/core_ext/hash"
6
10
  require "active_support/core_ext/string"
@@ -20,9 +24,6 @@ require "kubes_google"
20
24
 
21
25
  DslEvaluator.backtrace_reject = "lib/kubes"
22
26
 
23
- require "kubes/autoloader"
24
- Kubes::Autoloader.setup
25
-
26
27
  module Kubes
27
28
  class Error < StandardError; end
28
29
  class MissingDockerImage < Error; end
@@ -10,11 +10,23 @@ module Kubes
10
10
  klass.new(@image).run
11
11
  end
12
12
 
13
- # Currently only support ECR
13
+ # Currently only support ECR and GCR
14
+ # TODO: consider moving this to plugin gems
14
15
  def strategy_class
16
+ return unless auth?
15
17
  case @image
16
18
  when /\.amazonaws\.com/ # IE: 112233445566.dkr.ecr.us-west-2.amazonaws.com/demo/sinatra
17
19
  Ecr
20
+ when /gcr\.io/
21
+ Gcr
22
+ end
23
+ end
24
+
25
+ def auth?
26
+ if ENV['KUBES_REPO_AUTO_AUTH'].nil?
27
+ Kubes.config.repo_auto_auth
28
+ else
29
+ %w[1 true].include?(ENV['KUBES_REPO_AUTO_AUTH'])
18
30
  end
19
31
  end
20
32
  end