kubes 0.8.6 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f84754c7f4ac3bb6b4cf9265e9a1996790e16f1a0d559c84a2b12bfd389a08c8
4
- data.tar.gz: 952b720a88afa528925d0fe4f910b211d7891d930903ae36e8e7e35b69eec003
3
+ metadata.gz: 1089172c4489c77f34abd1cc5df408e11467950f40ae67ee062377f078c131d1
4
+ data.tar.gz: 1c29e074651e78963aa1fbc83314e49b6da006c7902056c2ef108dd91302b8a7
5
5
  SHA512:
6
- metadata.gz: c706ad8181772d2c7dbcee9de65d96548068de2840641786c58bc7fdfa1bbe6b1173dc8ec787ad42ef60d02bcce5f6ebc3f56d60549087c72d6f17a9a8cdbb34
7
- data.tar.gz: 4282f36a11382932f19f355c1e9c9f286c191f9486f37de9328719f8ae8b3636f2266751f65c896fd31018396ddadc00803b6b064d83836c9023c751539575a3
6
+ metadata.gz: ac9080b9f30461b48d4d4fbf5e6a9ca6be2a53385a0cde1b649e6da26c265ddb7adb7f3c66714ad179ebac3f3ae3ebd9ea112bc5a0f5e65beab7d51d30f9574d
7
+ data.tar.gz: c6424d462ba9c7b834fcf1944fd75275ae6fa8b6abf7ea7b29fa9575fa6f5ae0853529ca10b32e1eeff11ac094e2ee920008c326936e2c1bd5e153cb8dc3f915
@@ -0,0 +1 @@
1
+ github: boltops-tools
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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.8.9] - 2022-08-11
7
+ - [#64](https://github.com/boltops-tools/kubes/pull/64) extra variable layering
8
+ - add extra layering docs
9
+
10
+ ## [0.8.8] - 2022-08-11
11
+ - add Kubes.extra method
12
+ - update managed_certificate and ingress apiVersion
13
+
14
+ ## [0.8.7] - 2022-06-21
15
+ - [#63](https://github.com/boltops-tools/kubes/pull/63) remove kubes meta from yaml
16
+ - adjust app layer. keep old layer also for now though
17
+
6
18
  ## [0.8.6] - 2022-02-16
7
19
  - [#62](https://github.com/boltops-tools/kubes/pull/62) config map files: add Kubes.app txt layer
8
20
 
@@ -6,6 +6,13 @@ categories: hooks
6
6
 
7
7
  {% include config/hooks/generator.md type="docker" %}
8
8
 
9
+ ## Docker Hooks
10
+
11
+ Hook | Description
12
+ ---|---
13
+ build | When kubes builds Docker image.
14
+ push | When kubes pushes the Docker image.
15
+
9
16
  Here are some examples of running custom hooks before and after the docker commands.
10
17
 
11
18
  ## Build Hooks
@@ -17,7 +17,7 @@ apply | When kubes runs all the `kubectl apply` commands.
17
17
  delete | When kubes runs all the `kubectl delete` commands.
18
18
  prune | When kubes prunes. IE: To clean old secrets.
19
19
 
20
- ## Lifecycle At Kubes Level
20
+ ## Kubes Lifecyle Level
21
21
 
22
22
  These lifecycle points occur at a higher-level than the `kubectl` commands. Here's an example to help explain:
23
23
 
@@ -53,7 +53,7 @@ data:
53
53
 
54
54
  ## Layering Details
55
55
 
56
- Layering for Config Map Files and also supports app-scoped layers.
56
+ Config Map Files also supports App-Scoped Layering.
57
57
 
58
58
  Name | Example
59
59
  --- | ---
@@ -16,7 +16,7 @@ Now, use `kubectl` directly and apply them in the proper order:
16
16
  kubectl apply -f .kubes/output/web/service.yaml
17
17
  kubectl apply -f .kubes/output/web/deployment.yaml
18
18
 
19
- The deploy command simpifily does all 3 steps: build, compile, and apply.
19
+ The deploy command simply does all 3 steps: build, compile, and apply.
20
20
 
21
21
  kubes deploy
22
22
 
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: Extra Layering
3
+ ---
4
+
5
+ Setting KUBES_EXTRA will process extra layers.
6
+
7
+ ## Variables
8
+
9
+ Example
10
+
11
+ KUBES_EXTRA=2 kubes deploy
12
+
13
+ Will process:
14
+
15
+ .kubes/variables/dev.rb
16
+ .kubes/variables/dev-2.rb
@@ -8,3 +8,4 @@ Kubes supports layering files together so you can use the same Kubernetes files
8
8
  * [DSL Layering]({% link _docs/layering/dsl.md %})
9
9
  * [Mix Layering]({% link _docs/layering/mix.md %})
10
10
  * [Merge Behavior]({% link _docs/layering/merge-dsl.md %})
11
+ * [Extra Layering]({% link _docs/layering/extra.md %})
@@ -9,7 +9,7 @@ If you already a project with an existing Dockerfile, you can use that. If you d
9
9
 
10
10
  {% include learn/repos.md %}
11
11
 
12
- Let's generate a starter project:
12
+ Let's initialize a starter kubes project. This is similar to a `git init`.
13
13
 
14
14
  $ kubes init --app demo --repo $REPO --type dsl
15
15
  create .kubes/config.rb
@@ -9,7 +9,7 @@ If you already a project with an existing Dockerfile, you can use that. If you d
9
9
 
10
10
  {% include learn/repos.md %}
11
11
 
12
- Let's generate a starter project:
12
+ Let's initialize a starter kubes project. This is similar to a `git init`.
13
13
 
14
14
  $ kubes init --app demo --repo $REPO
15
15
  create Dockerfile
@@ -1,11 +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
+ * **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 %}).
@@ -2,6 +2,8 @@
2
2
 
3
3
  The `config.rb` is where you can configure Kubes settings.
4
4
 
5
+ .kubes/config.rb
6
+
5
7
  ```ruby
6
8
  Kubes.configure do |config|
7
9
  config.repo = "112233445566.dkr.ecr.us-west-2.amazonaws.com/demo" # may be gcr.io/project-123/demo
@@ -13,7 +15,7 @@ end
13
15
 
14
16
  This is where the `--repo` from `kubes init` got saved. The other options are covered in the [Env Config Docs]({% link _docs/config/env.md %}).
15
17
 
16
- ## Dockerfie
18
+ ## Dockerfile
17
19
 
18
20
  The `Dockerfile` is a simple starter example that just runs nginx
19
21
 
@@ -128,6 +128,7 @@
128
128
  <li><a href="{% link _docs/layering/mix.md %}">Mix</a></li>
129
129
  <li><a href="{% link _docs/layering/merge-dsl.md %}">Merge DSL</a></li>
130
130
  <li><a href="{% link _docs/layering/merge-options.md %}">Merge Options</a></li>
131
+ <li><a href="{% link _docs/layering/extra.md %}">Extra Layering</a></li>
131
132
  </ul>
132
133
  </li>
133
134
  <li><a href="{% link _docs/dsl.md %}">DSL</a>
@@ -411,6 +411,7 @@ ul.toc {
411
411
  .learn {
412
412
  img {
413
413
  max-width: 600px;
414
+ max-width: 100%;
414
415
  }
415
416
  .note {
416
417
  font-size: 0.9em;
@@ -59,14 +59,18 @@ module Kubes::Compiler::Shared
59
59
  layers = [
60
60
  "base.rb",
61
61
  "#{Kubes.env}.rb",
62
+ "#{Kubes.env}-#{Kubes.extra}.rb",
62
63
  "base/all.rb",
63
64
  "base/all/#{Kubes.env}.rb",
65
+ "base/all/#{Kubes.env}-#{Kubes.extra}.rb",
64
66
  "base/#{kind}.rb",
65
67
  "base/#{kind}/base.rb",
66
68
  "base/#{kind}/#{Kubes.env}.rb",
69
+ "base/#{kind}/#{Kubes.env}-#{Kubes.extra}.rb",
67
70
  "#{role}/#{kind}.rb",
68
71
  "#{role}/#{kind}/base.rb",
69
72
  "#{role}/#{kind}/#{Kubes.env}.rb",
73
+ "#{role}/#{kind}/#{Kubes.env}-#{Kubes.extra}.rb",
70
74
  ]
71
75
  if Kubes.app
72
76
  app_layers = ["#{Kubes.app}.rb"]
@@ -22,6 +22,7 @@ class Kubes::Compiler::Strategy
22
22
 
23
23
  def content
24
24
  data = filter_skip(@data)
25
+ data.each { |item| item.delete('kubes') }
25
26
  return if data.empty?
26
27
  result = data.size == 1 ? data.first : data
27
28
  yaml_dump(result)
data/lib/kubes/config.rb CHANGED
@@ -96,8 +96,12 @@ module Kubes
96
96
  evaluate_file(".kubes/config.rb")
97
97
  evaluate_file(".kubes/config/env/#{Kubes.env}.rb")
98
98
  if Kubes.app
99
+ # TODO: deprecate
99
100
  evaluate_file(".kubes/config/env/#{Kubes.app}.rb")
100
101
  evaluate_file(".kubes/config/env/#{Kubes.app}/#{Kubes.env}.rb")
102
+ # newer
103
+ evaluate_file(".kubes/config/app/#{Kubes.app}.rb")
104
+ evaluate_file(".kubes/config/app/#{Kubes.app}/#{Kubes.env}.rb")
101
105
  end
102
106
  Kubes::Plugin.plugins.each do |klass|
103
107
  # klass: IE: KubesAws, KubesGoogle
data/lib/kubes/core.rb CHANGED
@@ -3,11 +3,15 @@ module Kubes
3
3
  extend Memoist
4
4
 
5
5
  def app
6
- ENV['KUBES_APP']
6
+ ENV['KUBES_APP'] unless ENV['KUBES_APP'].blank?
7
7
  end
8
8
 
9
9
  def env
10
- ENV['KUBES_ENV'] || "dev"
10
+ ENV['KUBES_ENV'].blank? ? "dev" : ENV['KUBES_ENV']
11
+ end
12
+
13
+ def extra
14
+ ENV['KUBES_EXTRA'] unless ENV['KUBES_EXTRA'].blank?
11
15
  end
12
16
 
13
17
  def root
@@ -36,7 +40,7 @@ module Kubes
36
40
  def check_project!
37
41
  return if File.exist?("#{Kubes.root}/.kubes/config.rb")
38
42
  logger.error "ERROR: It doesnt look like this is a kubes project. Are you sure you are in a kubes project?".color(:red)
39
- ENV['TS_TEST'] ? raise : exit(1)
43
+ ENV['KUBES_TEST'] ? raise : exit(1)
40
44
  end
41
45
 
42
46
  # wrapper to ensure we use the same deeper_merge options everywhere
data/lib/kubes/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kubes
2
- VERSION = "0.8.6"
2
+ VERSION = "0.8.9"
3
3
  end
@@ -1,12 +1,10 @@
1
- apiVersion: networking.k8s.io/v1beta1
1
+ apiVersion: networking.k8s.io/v1
2
2
  kind: Ingress
3
3
  metadata:
4
4
  name: <%= role %>
5
5
  spec:
6
- rules:
7
- - http:
8
- paths:
9
- - path: "/*"
10
- backend:
11
- serviceName: <%= role %>
12
- servicePort: 80
6
+ defaultBackend:
7
+ service:
8
+ name: web
9
+ port:
10
+ number: 80
@@ -1,7 +1,9 @@
1
- apiVersion: networking.gke.io/v1beta2
1
+ # Docs: https://cloud.google.com/kubernetes-engine/docs/how-to/managed-certs#setting_up_a_google-managed_certificate
2
+ # https://kubes.guru/docs/dsl/resources/managed_certificate/
3
+ apiVersion: networking.gke.io/v1
2
4
  kind: ManagedCertificate
3
5
  metadata:
4
- name: cert1
6
+ name: managed-cert
5
7
  spec:
6
8
  domains:
7
- - cert1.example.com
9
+ - subdomain1.example.com
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.8.6
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-16 00:00:00.000000000 Z
11
+ date: 2022-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -258,6 +258,7 @@ extra_rdoc_files: []
258
258
  files:
259
259
  - ".dockerignore"
260
260
  - ".gcloudignore"
261
+ - ".github/FUNDING.yml"
261
262
  - ".github/ISSUE_TEMPLATE.md"
262
263
  - ".github/ISSUE_TEMPLATE/bug_report.md"
263
264
  - ".github/ISSUE_TEMPLATE/documentation.md"
@@ -367,6 +368,7 @@ files:
367
368
  - docs/_docs/intro/structure.md
368
369
  - docs/_docs/layering.md
369
370
  - docs/_docs/layering/dsl.md
371
+ - docs/_docs/layering/extra.md
370
372
  - docs/_docs/layering/merge-dsl.md
371
373
  - docs/_docs/layering/merge-options.md
372
374
  - docs/_docs/layering/mix.md
@@ -851,7 +853,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
851
853
  - !ruby/object:Gem::Version
852
854
  version: '0'
853
855
  requirements: []
854
- rubygems_version: 3.2.32
856
+ rubygems_version: 3.3.12
855
857
  signing_key:
856
858
  specification_version: 4
857
859
  summary: 'Kubernetes Deployment Tool: build docker image, compile Kubernetes YAML