kubes 0.8.9 → 0.8.10
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/docs/_docs/layering/debugging.md +62 -0
- data/docs/_docs/layering/dsl.md +3 -0
- data/docs/_docs/layering/extra.md +2 -0
- data/docs/_docs/layering/merge-dsl.md +3 -0
- data/docs/_docs/layering/merge-options.md +2 -0
- data/docs/_docs/layering/mix.md +3 -0
- data/docs/_docs/layering/yaml.md +3 -0
- data/docs/_docs/layering.md +4 -5
- data/docs/_includes/sidebar.html +4 -6
- data/lib/kubes/compiler/shared/runtime_helpers.rb +20 -0
- data/lib/kubes/compiler/strategy/base.rb +1 -0
- data/lib/kubes/compiler/strategy/dispatcher.rb +2 -0
- data/lib/kubes/config.rb +3 -0
- data/lib/kubes/util/pretty.rb +7 -0
- data/lib/kubes/version.rb +1 -1
- data/lib/templates/base/.kubes/config.rb.tt +2 -1
- data/lib/templates/new/resource/yaml/secret.yaml +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 306b63f7f97138b489a5877a2726499b8329c805787e282f1e856ad76226ebec
|
4
|
+
data.tar.gz: 1943fd0f6e702d8bf285ba201d89da359f8425988a542a408f6635b70e57d3c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32d2554b904d987cf40271cf1f924fc8c5aae7c309395c70bd0cef6ccd2b88fee401e34ad3b9f99f4c10056530b456be0713e740bb58972775b5e9e957b5e2c8
|
7
|
+
data.tar.gz: 7deec002773c177e201d5b8712a350cf087349260ecbc8945292325c76df4e9c4382be8ba9070a23493838c752281b204650538dcd71d0b71c8a6214496e7f63
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
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.10] - 2022-08-18
|
7
|
+
- [#65](https://github.com/boltops-tools/kubes/pull/65) show variables layers support
|
8
|
+
- improve new secret generator
|
9
|
+
|
6
10
|
## [0.8.9] - 2022-08-11
|
7
11
|
- [#64](https://github.com/boltops-tools/kubes/pull/64) extra variable layering
|
8
12
|
- add extra layering docs
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
title: "Debugging Layering"
|
3
|
+
category: layering
|
4
|
+
order: 9
|
5
|
+
---
|
6
|
+
|
7
|
+
Kube's Layering abilities are so powerful that they can be difficult to debug when overly used. It is recommend you chose only a few layers that make sense for your goals and stick to them. Essentially, limit the rope length. Here are also some debugging tips.
|
8
|
+
|
9
|
+
## Enable Logging
|
10
|
+
|
11
|
+
You can debug layers by turning a config to show the **found** layers. Currently, only variables layering is shown.
|
12
|
+
|
13
|
+
.kubes/config.rb
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
Kubes.configure do |config|
|
17
|
+
config.layering.show = true
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
This will show the **found** layers.
|
22
|
+
|
23
|
+
$ kubes compile
|
24
|
+
Compiling .kubes/resources/shared/namespace.yaml
|
25
|
+
.kubes/variables/base.rb
|
26
|
+
.kubes/variables/dev.rb
|
27
|
+
Compiling .kubes/resources/web/deployment.yaml
|
28
|
+
.kubes/variables/base.rb
|
29
|
+
.kubes/variables/dev.rb
|
30
|
+
Compiling .kubes/resources/web/service.yaml
|
31
|
+
.kubes/variables/base.rb
|
32
|
+
.kubes/variables/dev.rb
|
33
|
+
|
34
|
+
## All Considered Layers
|
35
|
+
|
36
|
+
If you want to also see all the considered layers use `KUBES_LAYERING_SHOW_ALL=1`. Note, this will show a lot of layers. Kubes considers many layers and for files `base/all.yml` also perform layering and results are ultimately merged together. Here's an example snippet of the output.
|
37
|
+
|
38
|
+
$ export KUBES_LAYERING_SHOW_ALL=1
|
39
|
+
Compiling .kubes/resources/web/deployment.yaml
|
40
|
+
Rendering .kubes/resources/web/deployment.yaml
|
41
|
+
.kubes/variables/base.rb
|
42
|
+
.kubes/variables/dev.rb
|
43
|
+
.kubes/variables/base/all.rb
|
44
|
+
.kubes/variables/base/all/dev.rb
|
45
|
+
.kubes/variables/base/deployment.rb
|
46
|
+
.kubes/variables/base/deployment/base.rb
|
47
|
+
.kubes/variables/base/deployment/dev.rb
|
48
|
+
.kubes/variables/web/deployment.rb
|
49
|
+
.kubes/variables/web/deployment/base.rb
|
50
|
+
.kubes/variables/web/deployment/dev.rb
|
51
|
+
Rendering .kubes/resources/base/all.yaml
|
52
|
+
.kubes/variables/base.rb
|
53
|
+
.kubes/variables/dev.rb
|
54
|
+
.kubes/variables/base/all.rb
|
55
|
+
.kubes/variables/base/all/dev.rb
|
56
|
+
.kubes/variables/base/deployment.rb
|
57
|
+
.kubes/variables/base/deployment/base.rb
|
58
|
+
.kubes/variables/base/deployment/dev.rb
|
59
|
+
.kubes/variables/web/deployment.rb
|
60
|
+
.kubes/variables/web/deployment/base.rb
|
61
|
+
.kubes/variables/web/deployment/dev.rb
|
62
|
+
...
|
data/docs/_docs/layering/dsl.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
---
|
2
2
|
title: Merge Options
|
3
|
+
category: layering
|
4
|
+
order: 5
|
3
5
|
---
|
4
6
|
|
5
7
|
Underneath the hood, Kubes uses the [danielsdeleo/deep_merge](https://github.com/danielsdeleo/deep_merge) library to merge layers together. You can control the merge behavior options with [config.merger.options]({% link _docs/config/reference.md %}).
|
data/docs/_docs/layering/mix.md
CHANGED
data/docs/_docs/layering/yaml.md
CHANGED
data/docs/_docs/layering.md
CHANGED
@@ -4,8 +4,7 @@ title: Layering
|
|
4
4
|
|
5
5
|
Kubes supports layering files together so you can use the same Kubernetes files to build multiple environments like dev and prod.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
* [
|
10
|
-
|
11
|
-
* [Extra Layering]({% link _docs/layering/extra.md %})
|
7
|
+
{% assign docs = site.docs | where: "categories","layering" | sort: "order" %}
|
8
|
+
{% for doc in docs -%}
|
9
|
+
* [{{ doc.title }}]({{ doc.url }})
|
10
|
+
{% endfor %}
|
data/docs/_includes/sidebar.html
CHANGED
@@ -123,12 +123,10 @@
|
|
123
123
|
</li>
|
124
124
|
<li><a href="{% link _docs/layering.md %}">Layering</a>
|
125
125
|
<ul>
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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>
|
126
|
+
{% assign docs = site.docs | where: "categories","layering" | sort: "order" %}
|
127
|
+
{% for doc in docs -%}
|
128
|
+
<li><a href="{{ doc.url }}">{% if doc.nav_text %}{{ doc.nav_text }}{% else %}{{ doc.title }}{% endif %}</a></li>
|
129
|
+
{% endfor %}
|
132
130
|
</ul>
|
133
131
|
</li>
|
134
132
|
<li><a href="{% link _docs/dsl.md %}">DSL</a>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Kubes::Compiler::Shared
|
2
2
|
module RuntimeHelpers
|
3
3
|
include Kubes::Compiler::Shared::Helpers
|
4
|
+
include Kubes::Util::Pretty
|
4
5
|
|
5
6
|
def load_runtime_helpers
|
6
7
|
load_plugin_helpers
|
@@ -72,6 +73,10 @@ module Kubes::Compiler::Shared
|
|
72
73
|
"#{role}/#{kind}/#{Kubes.env}.rb",
|
73
74
|
"#{role}/#{kind}/#{Kubes.env}-#{Kubes.extra}.rb",
|
74
75
|
]
|
76
|
+
# filter out the -.rb layers when Kubes.extra is not set
|
77
|
+
# IE: .kubes/variables/dev-.rb
|
78
|
+
layers.reject! { |layer| layer.ends_with?('-.rb') }
|
79
|
+
|
75
80
|
if Kubes.app
|
76
81
|
app_layers = ["#{Kubes.app}.rb"]
|
77
82
|
app_layers += layers.map do |path|
|
@@ -82,8 +87,23 @@ module Kubes::Compiler::Shared
|
|
82
87
|
|
83
88
|
layers.each do |layer|
|
84
89
|
path = "#{Kubes.root}/.kubes/variables/#{layer}"
|
90
|
+
show_variable_layer_path(path)
|
85
91
|
evaluate_file(path)
|
86
92
|
end
|
87
93
|
end
|
94
|
+
|
95
|
+
@@shown = {}
|
96
|
+
def show_variable_layer_path(path)
|
97
|
+
# Examples:
|
98
|
+
# .kubes/resources/web/deployment.yaml
|
99
|
+
# .kubes/resources/shared/namespace.yaml
|
100
|
+
main_path = @path # main path is main resource file
|
101
|
+
show_once = !@@shown.dig(main_path, path)
|
102
|
+
if ENV['KUBES_LAYERING_SHOW_ALL'] || (Kubes.config.layering.show && show_once && File.exist?(path))
|
103
|
+
logger.info " #{pretty_path(path)}"
|
104
|
+
@@shown[main_path] ||= {}
|
105
|
+
@@shown[main_path][path] = true
|
106
|
+
end
|
107
|
+
end
|
88
108
|
end
|
89
109
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Kubes::Compiler::Strategy
|
2
2
|
class Dispatcher < Base
|
3
3
|
def dispatch
|
4
|
+
logger.info "Compiling #{pretty_path(@path)}" if Kubes.config.layering.show
|
4
5
|
result = render(@path) # main
|
5
6
|
results = [result].flatten # ensure array
|
6
7
|
data = results.map! do |main|
|
@@ -16,6 +17,7 @@ class Kubes::Compiler::Strategy
|
|
16
17
|
klass = dsl_class(path) # IE: Kubes::Compiler::Dsl::Syntax::Deployment or Kubes::Compiler::Dsl::Core::Blocks
|
17
18
|
klass.new(@options.merge(path: path, data: @data)).run
|
18
19
|
else
|
20
|
+
logger.info "Rendering #{pretty_path(path)}" if ENV['KUBES_LAYERING_SHOW_ALL']
|
19
21
|
Erb.new(@options.merge(data: @data)).render_result(path)
|
20
22
|
end
|
21
23
|
end
|
data/lib/kubes/config.rb
CHANGED
@@ -33,6 +33,9 @@ module Kubes
|
|
33
33
|
config.repo = nil # expected to be set by .kubes/config.rb
|
34
34
|
config.repo_auto_auth = true
|
35
35
|
|
36
|
+
config.layering = ActiveSupport::OrderedOptions.new
|
37
|
+
config.layering.show = ENV['KUBES_LAYERING_SHOW'] || false
|
38
|
+
|
36
39
|
config.logger = Logger.new($stderr)
|
37
40
|
config.logger.level = ENV['KUBES_LOG_LEVEL'] || :info
|
38
41
|
|
data/lib/kubes/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Kubes.configure do |config|
|
2
2
|
config.repo = "<%= @options[:repo] %>"
|
3
|
-
config.logger.level = "
|
3
|
+
# config.logger.level = "debug"
|
4
|
+
# config.layering.show = true
|
4
5
|
# auto-switching
|
5
6
|
# config.kubectl.context = "dev-cluster"
|
6
7
|
# config.kubectl.context_keep = true # keep context after switching
|
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.
|
4
|
+
version: 0.8.10
|
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-08-
|
11
|
+
date: 2022-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -367,6 +367,7 @@ files:
|
|
367
367
|
- docs/_docs/intro/ordering/custom.md
|
368
368
|
- docs/_docs/intro/structure.md
|
369
369
|
- docs/_docs/layering.md
|
370
|
+
- docs/_docs/layering/debugging.md
|
370
371
|
- docs/_docs/layering/dsl.md
|
371
372
|
- docs/_docs/layering/extra.md
|
372
373
|
- docs/_docs/layering/merge-dsl.md
|
@@ -722,6 +723,7 @@ files:
|
|
722
723
|
- lib/kubes/logging.rb
|
723
724
|
- lib/kubes/plugin.rb
|
724
725
|
- lib/kubes/util/consider.rb
|
726
|
+
- lib/kubes/util/pretty.rb
|
725
727
|
- lib/kubes/util/sh.rb
|
726
728
|
- lib/kubes/util/sure.rb
|
727
729
|
- lib/kubes/util/time.rb
|