kubes 0.8.10 → 0.9.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 +4 -0
- data/docs/_docs/layering/{debugging.md → debug.md} +13 -13
- data/lib/kubes/compiler/shared/runtime_helpers.rb +13 -4
- data/lib/kubes/compiler/strategy/dispatcher.rb +11 -2
- data/lib/kubes/util/sh.rb +1 -1
- data/lib/kubes/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db6959c3513133da9d5340dc8c332e15f86be47e5f72d47188243fafb21b3bd0
|
4
|
+
data.tar.gz: 94762322cb38b47c1d4167060545012dd6416515628801efdd969fc8dd189b91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a506b81df303fd915146596f792fcbd6b0ede5b93c81d6bcd75f0fa3123a47129086969decef3d44b273e6740d518facf91053c8f10e61ad3de6698c673a0e9
|
7
|
+
data.tar.gz: f2ddb1238b542b0279069a5b7417d4ed458384729cdd3859511b55222161c6443131ade97534f91fe19df9f20fae3074943a40120a3470bbf91142cd8d419a89
|
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.9.0] - 2022-08-24
|
7
|
+
- [#66](https://github.com/boltops-tools/kubes/pull/66) show layering improvements: show resource layers also
|
8
|
+
- only show error if exit_on_fail
|
9
|
+
|
6
10
|
## [0.8.10] - 2022-08-18
|
7
11
|
- [#65](https://github.com/boltops-tools/kubes/pull/65) show variables layers support
|
8
12
|
- improve new secret generator
|
@@ -1,10 +1,10 @@
|
|
1
1
|
---
|
2
|
-
title: "
|
2
|
+
title: "Debug Layering"
|
3
3
|
category: layering
|
4
4
|
order: 9
|
5
5
|
---
|
6
6
|
|
7
|
-
Kube's Layering abilities are so powerful that they can be difficult to debug when overly used. It is
|
7
|
+
Kube's Layering abilities are so powerful that they can be difficult to debug when overly used. It is recommended that 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
8
|
|
9
9
|
## Enable Logging
|
10
10
|
|
@@ -20,16 +20,16 @@ end
|
|
20
20
|
|
21
21
|
This will show the **found** layers.
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
33
|
|
34
34
|
## All Considered Layers
|
35
35
|
|
@@ -59,4 +59,4 @@ If you want to also see all the considered layers use `KUBES_LAYERING_SHOW_ALL=1
|
|
59
59
|
.kubes/variables/web/deployment.rb
|
60
60
|
.kubes/variables/web/deployment/base.rb
|
61
61
|
.kubes/variables/web/deployment/dev.rb
|
62
|
-
...
|
62
|
+
...
|
@@ -85,21 +85,30 @@ module Kubes::Compiler::Shared
|
|
85
85
|
layers += app_layers
|
86
86
|
end
|
87
87
|
|
88
|
-
layers.
|
89
|
-
|
88
|
+
layer_paths = layers.map { |layer| "#{Kubes.root}/.kubes/variables/#{layer}" }
|
89
|
+
layer_paths = layer_paths.select { |path| File.exist?(path) } unless ENV['KUBES_LAYERING_SHOW_ALL']
|
90
|
+
layer_paths.each do |path|
|
90
91
|
show_variable_layer_path(path)
|
91
92
|
evaluate_file(path)
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
96
|
+
@@header_shown = {} # key is main @path
|
95
97
|
@@shown = {}
|
96
98
|
def show_variable_layer_path(path)
|
99
|
+
main_path = @path # main path is main resource file
|
100
|
+
|
101
|
+
show_header = !@@header_shown.dig(main_path)
|
102
|
+
if show_header && Kubes.config.layering.show
|
103
|
+
logger.info " Variables layers:"
|
104
|
+
@@header_shown[main_path] = true
|
105
|
+
end
|
97
106
|
# Examples:
|
98
107
|
# .kubes/resources/web/deployment.yaml
|
99
108
|
# .kubes/resources/shared/namespace.yaml
|
100
|
-
main_path = @path # main path is main resource file
|
101
109
|
show_once = !@@shown.dig(main_path, path)
|
102
|
-
|
110
|
+
show_layer = Kubes.config.layering.show && show_once
|
111
|
+
if show_layer
|
103
112
|
logger.info " #{pretty_path(path)}"
|
104
113
|
@@shown[main_path] ||= {}
|
105
114
|
@@shown[main_path][path] = true
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Kubes::Compiler::Strategy
|
2
2
|
class Dispatcher < Base
|
3
3
|
def dispatch
|
4
|
-
|
4
|
+
show_layers if Kubes.config.layering.show
|
5
5
|
result = render(@path) # main
|
6
6
|
results = [result].flatten # ensure array
|
7
7
|
data = results.map! do |main|
|
@@ -11,13 +11,22 @@ class Kubes::Compiler::Strategy
|
|
11
11
|
Result.new(@save_file, data)
|
12
12
|
end
|
13
13
|
|
14
|
+
def show_layers
|
15
|
+
logger.info "Compiling #{pretty_path(@path)}"
|
16
|
+
logger.info " Resource layers:"
|
17
|
+
all_layers = pre_layers + [@path] + post_layers
|
18
|
+
all_layers.each do |layer|
|
19
|
+
logger.info " #{pretty_path(layer)}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
14
23
|
# Render via to Erb or one of the DSL syntax classes or Core/Blocks class
|
15
24
|
def render(path)
|
16
25
|
if path.include?('.rb')
|
17
26
|
klass = dsl_class(path) # IE: Kubes::Compiler::Dsl::Syntax::Deployment or Kubes::Compiler::Dsl::Core::Blocks
|
18
27
|
klass.new(@options.merge(path: path, data: @data)).run
|
19
28
|
else
|
20
|
-
logger.info "Rendering #{pretty_path(path)}" if ENV['
|
29
|
+
logger.info "Rendering #{pretty_path(path)}" if ENV['KUBES_LAYERING_SHOW_RENDERING']
|
21
30
|
Erb.new(@options.merge(data: @data)).render_result(path)
|
22
31
|
end
|
23
32
|
end
|
data/lib/kubes/util/sh.rb
CHANGED
@@ -24,7 +24,7 @@ module Kubes::Util
|
|
24
24
|
logger.info "=> #{command}" if show_command
|
25
25
|
success = system(env, command)
|
26
26
|
unless success
|
27
|
-
logger.error "ERROR: running #{command}".color(:red)
|
27
|
+
logger.error "ERROR: running #{command}".color(:red) if exit_on_fail
|
28
28
|
exit $?.exitstatus if exit_on_fail
|
29
29
|
end
|
30
30
|
success
|
data/lib/kubes/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.0
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -367,7 +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/
|
370
|
+
- docs/_docs/layering/debug.md
|
371
371
|
- docs/_docs/layering/dsl.md
|
372
372
|
- docs/_docs/layering/extra.md
|
373
373
|
- docs/_docs/layering/merge-dsl.md
|