kubes 0.7.0 → 0.7.5
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/.github/ISSUE_TEMPLATE.md +7 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +84 -0
- data/.github/ISSUE_TEMPLATE/documentation.md +12 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +64 -0
- data/.github/ISSUE_TEMPLATE/question.md +14 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +50 -0
- data/CHANGELOG.md +18 -0
- data/README.md +2 -0
- data/docs/_docs/config/reference.md +1 -1
- data/docs/_docs/dsl/multiple-resources.md +14 -17
- data/docs/_docs/intro/concepts.md +8 -9
- data/docs/_docs/intro/docker-image.md +2 -2
- data/docs/_docs/intro/ordering.md +9 -10
- data/docs/_docs/patterns/multiple-envs.md +6 -6
- data/docs/_docs/resources/role.md +8 -9
- data/docs/_docs/yaml.md +4 -5
- data/docs/_docs/yaml/multiple-files.md +6 -7
- data/docs/_docs/yaml/multiple-resources.md +13 -14
- data/docs/_includes/commands.html +8 -9
- data/docs/_includes/header.html +7 -0
- data/docs/_includes/vs/kubes/structure.md +12 -13
- data/docs/_sass/theme.scss +92 -0
- data/docs/search/data.json +44 -0
- data/docs/search/index.html +30 -0
- data/docs/search/lunr.js +3475 -0
- data/docs/search/search.js +247 -0
- data/docs/search/tips.md +48 -0
- data/lib/kubes.rb +1 -0
- data/lib/kubes/cli/compile.rb +1 -1
- data/lib/kubes/command.rb +1 -0
- data/lib/kubes/compiler/decorator/base.rb +2 -2
- data/lib/kubes/compiler/dsl/core/base.rb +2 -6
- data/lib/kubes/compiler/dsl/core/fields.rb +1 -1
- data/lib/kubes/compiler/dsl/syntax/resource.rb +2 -3
- data/lib/kubes/compiler/shared/helpers.rb +4 -2
- data/lib/kubes/compiler/shared/runtime_helpers.rb +78 -0
- data/lib/kubes/compiler/strategy/dispatcher.rb +4 -3
- data/lib/kubes/compiler/strategy/erb.rb +2 -7
- data/lib/kubes/config.rb +1 -1
- data/lib/kubes/core.rb +6 -0
- data/lib/kubes/docker/strategy/image_name.rb +7 -3
- data/lib/kubes/version.rb +1 -1
- metadata +15 -6
- data/lib/kubes/compiler/shared/custom_helpers.rb +0 -17
- data/lib/kubes/compiler/shared/custom_variables.rb +0 -38
- data/lib/kubes/compiler/shared/plugin_helpers.rb +0 -14
@@ -4,8 +4,8 @@ class Kubes::Compiler::Strategy
|
|
4
4
|
result = render(@path) # main
|
5
5
|
results = [result].flatten # ensure array
|
6
6
|
data = results.map! do |main|
|
7
|
-
hash =
|
8
|
-
|
7
|
+
hash = Kubes.deep_merge!(pre_layer, main)
|
8
|
+
Kubes.deep_merge!(hash, post_layer)
|
9
9
|
end
|
10
10
|
Result.new(@save_file, data)
|
11
11
|
end
|
@@ -52,7 +52,8 @@ class Kubes::Compiler::Strategy
|
|
52
52
|
|
53
53
|
def merge_layers(layers)
|
54
54
|
layers.inject({}) do |hash, layer|
|
55
|
-
render(layer)
|
55
|
+
data = render(layer)
|
56
|
+
hash.deep_merge!(data)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
end
|
@@ -5,18 +5,13 @@ class Kubes::Compiler::Strategy
|
|
5
5
|
extend Kubes::Compiler::Dsl::Core::Fields
|
6
6
|
include Kubes::Compiler::Dsl::Core::Helpers
|
7
7
|
include Kubes::Compiler::Layering
|
8
|
-
include Kubes::Compiler::Shared::
|
9
|
-
include Kubes::Compiler::Shared::CustomVariables
|
10
|
-
include Kubes::Compiler::Shared::Helpers
|
11
|
-
include Kubes::Compiler::Shared::PluginHelpers
|
8
|
+
include Kubes::Compiler::Shared::RuntimeHelpers
|
12
9
|
|
13
10
|
def initialize(options={})
|
14
11
|
super
|
15
12
|
# For ERB scope is in this same Strategy::Erb class
|
16
13
|
# For DSL scope is within the each for the Resource classes. IE: kubes/compile/dsl/core/base.rb
|
17
|
-
|
18
|
-
load_custom_variables
|
19
|
-
load_custom_helpers
|
14
|
+
load_runtime_helpers
|
20
15
|
end
|
21
16
|
|
22
17
|
def render_result(path)
|
data/lib/kubes/config.rb
CHANGED
@@ -39,7 +39,7 @@ module Kubes
|
|
39
39
|
config.skip = []
|
40
40
|
|
41
41
|
config.state = ActiveSupport::OrderedOptions.new
|
42
|
-
config.state.
|
42
|
+
config.state.path = "#{Kubes.root}/.kubes/state/#{Kubes.env}/data.json"
|
43
43
|
|
44
44
|
config.suffix_hash = true # append suffix hash to ConfigMap and Secret
|
45
45
|
|
data/lib/kubes/core.rb
CHANGED
@@ -34,5 +34,11 @@ module Kubes
|
|
34
34
|
logger.error "ERROR: It doesnt look like this is a kubes project. Are you sure you are in a kubes project?".color(:red)
|
35
35
|
ENV['TS_TEST'] ? raise : exit(1)
|
36
36
|
end
|
37
|
+
|
38
|
+
# wrapper to ensure we use the same deeper_merge options everywhere
|
39
|
+
def deep_merge!(a, b)
|
40
|
+
a.deeper_merge!(b, overwrite_arrays: true)
|
41
|
+
a
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "json"
|
2
|
+
|
1
3
|
module Kubes::Docker::Strategy
|
2
4
|
module ImageName
|
3
5
|
extend Memoist
|
@@ -13,12 +15,13 @@ module Kubes::Docker::Strategy
|
|
13
15
|
# Only when a new docker build command gets run will the image name state be updated.
|
14
16
|
def store_image_name
|
15
17
|
FileUtils.mkdir_p(File.dirname(image_state_path))
|
16
|
-
|
18
|
+
text = JSON.pretty_generate(image: @@image_name)
|
19
|
+
IO.write(image_state_path, text)
|
17
20
|
end
|
18
21
|
|
19
22
|
# output can get entirely wiped so dont use that folder
|
20
23
|
def image_state_path
|
21
|
-
Kubes.config.state.
|
24
|
+
Kubes.config.state.path
|
22
25
|
end
|
23
26
|
|
24
27
|
# full_image - Includes the tag. Examples:
|
@@ -33,7 +36,8 @@ module Kubes::Docker::Strategy
|
|
33
36
|
logger.error "ERROR: Unable to find #{image_state_path} which contains the last docker image name built with kubes build. Please run `kubes docker build` first."
|
34
37
|
exit 1
|
35
38
|
end
|
36
|
-
IO.read(image_state_path)
|
39
|
+
data = JSON.load(IO.read(image_state_path))
|
40
|
+
data['image']
|
37
41
|
end
|
38
42
|
|
39
43
|
@@timestamp = Time.now.strftime('%Y-%m-%dT%H-%M-%S')
|
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.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -244,6 +244,12 @@ extra_rdoc_files: []
|
|
244
244
|
files:
|
245
245
|
- ".dockerignore"
|
246
246
|
- ".gcloudignore"
|
247
|
+
- ".github/ISSUE_TEMPLATE.md"
|
248
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
249
|
+
- ".github/ISSUE_TEMPLATE/documentation.md"
|
250
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
251
|
+
- ".github/ISSUE_TEMPLATE/question.md"
|
252
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
247
253
|
- ".gitignore"
|
248
254
|
- ".rspec"
|
249
255
|
- CHANGELOG.md
|
@@ -466,6 +472,11 @@ files:
|
|
466
472
|
- docs/opal/sidebar.rb
|
467
473
|
- docs/opal/sidebar/expander.rb
|
468
474
|
- docs/reference.md
|
475
|
+
- docs/search/data.json
|
476
|
+
- docs/search/index.html
|
477
|
+
- docs/search/lunr.js
|
478
|
+
- docs/search/search.js
|
479
|
+
- docs/search/tips.md
|
469
480
|
- docs/support.md
|
470
481
|
- docs/vendor/bootstrap/css/bootstrap-grid.css
|
471
482
|
- docs/vendor/bootstrap/css/bootstrap-grid.css.map
|
@@ -609,11 +620,9 @@ files:
|
|
609
620
|
- lib/kubes/compiler/dsl/syntax/service.rb
|
610
621
|
- lib/kubes/compiler/dsl/syntax/service_account.rb
|
611
622
|
- lib/kubes/compiler/layering.rb
|
612
|
-
- lib/kubes/compiler/shared/custom_helpers.rb
|
613
|
-
- lib/kubes/compiler/shared/custom_variables.rb
|
614
623
|
- lib/kubes/compiler/shared/helpers.rb
|
615
624
|
- lib/kubes/compiler/shared/helpers/deprecated.rb
|
616
|
-
- lib/kubes/compiler/shared/
|
625
|
+
- lib/kubes/compiler/shared/runtime_helpers.rb
|
617
626
|
- lib/kubes/compiler/strategy.rb
|
618
627
|
- lib/kubes/compiler/strategy/base.rb
|
619
628
|
- lib/kubes/compiler/strategy/dispatcher.rb
|
@@ -782,7 +791,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
782
791
|
- !ruby/object:Gem::Version
|
783
792
|
version: '0'
|
784
793
|
requirements: []
|
785
|
-
rubygems_version: 3.
|
794
|
+
rubygems_version: 3.2.5
|
786
795
|
signing_key:
|
787
796
|
specification_version: 4
|
788
797
|
summary: 'Kubernetes Deployment Tool: build docker image, compile Kubernetes YAML
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Kubes::Compiler::Shared
|
2
|
-
module CustomHelpers
|
3
|
-
# Load custom helper methods from project
|
4
|
-
@@custom_helpers_loaded = false
|
5
|
-
def load_custom_helpers
|
6
|
-
return if @@custom_helpers_loaded
|
7
|
-
paths = Dir.glob("#{Kubes.root}/.kubes/helpers/**/*.rb")
|
8
|
-
paths.sort_by! { |p| p.size } # so namespaces are loaded first
|
9
|
-
paths.each do |path|
|
10
|
-
filename = path.sub(%r{.*.kubes/helpers/},'').sub('.rb','')
|
11
|
-
module_name = filename.camelize
|
12
|
-
self.class.send :include, module_name.constantize
|
13
|
-
end
|
14
|
-
@@custom_helpers_loaded = true
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Kubes::Compiler::Shared
|
2
|
-
module CustomVariables
|
3
|
-
include DslEvaluator
|
4
|
-
|
5
|
-
# Load custom variables from project
|
6
|
-
@@custom_variables_loaded = false
|
7
|
-
def load_custom_variables
|
8
|
-
return if Kubes.kustomize?
|
9
|
-
|
10
|
-
ext = File.extname(@path)
|
11
|
-
role = @path.sub(%r{.*\.kubes/resources/},'').sub(ext,'').split('/').first # IE: web
|
12
|
-
kind = File.basename(@path).sub(ext,'') # IE: deployment
|
13
|
-
all = "all"
|
14
|
-
if @block_form
|
15
|
-
kind = kind.pluralize
|
16
|
-
all = all.pluralize
|
17
|
-
end
|
18
|
-
|
19
|
-
layers = [
|
20
|
-
"base.rb",
|
21
|
-
"#{Kubes.env}.rb",
|
22
|
-
"base/all.rb",
|
23
|
-
"base/all/#{Kubes.env}.rb",
|
24
|
-
"base/#{kind}.rb",
|
25
|
-
"base/#{kind}/base.rb",
|
26
|
-
"base/#{kind}/#{Kubes.env}.rb",
|
27
|
-
"#{role}/#{kind}.rb",
|
28
|
-
"#{role}/#{kind}/base.rb",
|
29
|
-
"#{role}/#{kind}/#{Kubes.env}.rb",
|
30
|
-
]
|
31
|
-
|
32
|
-
layers.each do |layer|
|
33
|
-
path = "#{Kubes.root}/.kubes/variables/#{layer}"
|
34
|
-
evaluate_file(path)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Kubes::Compiler::Shared
|
2
|
-
module PluginHelpers
|
3
|
-
# Load plugin helper methods from project
|
4
|
-
@@plugin_helpers_loaded = false
|
5
|
-
def load_plugin_helpers
|
6
|
-
return if @@plugin_helpers_loaded
|
7
|
-
Kubes::Plugin.plugins.each do |klass|
|
8
|
-
helpers_class = "#{klass}::Helpers".constantize # IE: KubesAws::Helpers
|
9
|
-
self.class.send :include, helpers_class
|
10
|
-
end
|
11
|
-
@@plugin_helpers_loaded = true
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|