orchparty 2.0.0.rc1 → 2.0.0.rc2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6da1869574cdc30632755d3c697b0f67a6cf5c66
|
4
|
+
data.tar.gz: b840711e9f9ecd544d0b3afb83360c35ecbe75a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c56f79dce8504a78a2848dde0754eb9ac3f7c2ebc1d5e6e70606fd26a010194d17e81fe89e4df40a550ce0a507d6076248a2ea1e66c2150fcbc8b87935257fd2
|
7
|
+
data.tar.gz: a3f0f28d0e3a3ba2d58803d1f274bf5ea13aea28e3879d825a1c56c104861e2acf0c371d363ee7a356243a4f35a0b3dfae0fd73751b25b3d28ea034bfd1ff30f
|
data/lib/orchparty/ast.rb
CHANGED
@@ -27,7 +27,7 @@ module Orchparty
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.mixin(args = {})
|
30
|
-
Node.new({services: {}, _mixins: {}, volumes: {}, _variables: {}, networks: {}}).merge(args)
|
30
|
+
Node.new({services: {}, _mixins: {}, volumes: {}, _variables: {}, networks: {}, _service_order: []}).merge(args)
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.application(args = {})
|
@@ -68,10 +68,32 @@ module Orchparty
|
|
68
68
|
@mixin = AST.mixin(name: name)
|
69
69
|
end
|
70
70
|
|
71
|
+
def template(path)
|
72
|
+
chart_name = "_mixin_temp_name"
|
73
|
+
unless @mixin.services[chart_name]
|
74
|
+
@mixin.services[chart_name] = AST.chart(name: chart_name, _type: "chart" )
|
75
|
+
@mixin._service_order << chart_name
|
76
|
+
end
|
77
|
+
chart = @mixin.services[chart_name]
|
78
|
+
chart.template = path
|
79
|
+
self
|
80
|
+
end
|
81
|
+
|
71
82
|
def service(name, &block)
|
72
|
-
|
83
|
+
|
84
|
+
chart_name = "_mixin_temp_name"
|
85
|
+
unless @mixin.services[chart_name]
|
86
|
+
@mixin.services[chart_name] = AST.chart(name: chart_name, _type: "chart" )
|
87
|
+
@mixin._service_order << chart_name
|
88
|
+
end
|
89
|
+
chart = @mixin.services[chart_name]
|
90
|
+
|
91
|
+
result = ServiceBuilder.build(name, "chart-service", block)
|
92
|
+
|
93
|
+
name = "chart-#{chart.name}-#{name}"
|
73
94
|
@mixin.services[name] = result
|
74
|
-
@mixin.
|
95
|
+
@mixin._service_order << name
|
96
|
+
chart._services << name
|
75
97
|
self
|
76
98
|
end
|
77
99
|
|
@@ -30,7 +30,7 @@ module Orchparty
|
|
30
30
|
file_path = File.join(self.dir_path, file_path)
|
31
31
|
if(file_path.end_with?(".erb"))
|
32
32
|
helm.application = OpenStruct.new(cluster_name: cluster_name, namespace: namespace)
|
33
|
-
template =
|
33
|
+
template = Erubis::Eruby.new(File.read(file_path))
|
34
34
|
yaml = template.result(helm.get_binding)
|
35
35
|
file = Tempfile.new("kube-deploy.yaml")
|
36
36
|
file.write(yaml)
|
@@ -72,7 +72,7 @@ module Orchparty
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def upgrade_cmd(helm, fix_file_path = nil)
|
75
|
-
"helm upgrade --namespace #{namespace} --kube-context #{cluster_name} --version #{helm.version} #{helm.name} #{helm.chart} #{template(value_path(helm), helm, fix_file_path: fix_file_path)}"
|
75
|
+
"helm upgrade --namespace #{namespace} --kube-context #{cluster_name} --force --version #{helm.version} #{helm.name} #{helm.chart} #{template(value_path(helm), helm, fix_file_path: fix_file_path)}"
|
76
76
|
end
|
77
77
|
|
78
78
|
def install_cmd(helm, fix_file_path = nil)
|
@@ -206,6 +206,11 @@ module Orchparty
|
|
206
206
|
end
|
207
207
|
|
208
208
|
def generate_documents_from_erbs(templates_path:, app_name:, params:, output_chart_path:)
|
209
|
+
if params[:kind].nil?
|
210
|
+
warn "ERROR: Could not generate service '#{app_name}'. Missing key: 'kind'."
|
211
|
+
exit 1
|
212
|
+
end
|
213
|
+
|
209
214
|
kind = params.fetch(:kind)
|
210
215
|
|
211
216
|
Dir[File.join(templates_path, kind, '*.erb')].each do |template_path|
|
@@ -6,6 +6,7 @@ module Orchparty
|
|
6
6
|
current = AST.application
|
7
7
|
application._mix.each do |mixin_name|
|
8
8
|
mixin = application._mixins[mixin_name] || ast._mixins[mixin_name]
|
9
|
+
mixin = resolve_chart_name(mixin, application)
|
9
10
|
current = current.deep_merge_concat(mixin)
|
10
11
|
end
|
11
12
|
transform_application(current.deep_merge_concat(application), ast)
|
@@ -13,6 +14,16 @@ module Orchparty
|
|
13
14
|
ast
|
14
15
|
end
|
15
16
|
|
17
|
+
def resolve_chart_name(mixin, application)
|
18
|
+
if mixin.services[:_mixin_temp_name]
|
19
|
+
mixin.services[application.name.to_s] = mixin.services.delete("_mixin_temp_name")
|
20
|
+
mixin.services[application.name.to_s][:name] = application.name.to_s
|
21
|
+
mixin._service_order.delete("_mixin_temp_name")
|
22
|
+
mixin._service_order << application.name.to_s
|
23
|
+
end
|
24
|
+
mixin
|
25
|
+
end
|
26
|
+
|
16
27
|
def transform_application(application, ast)
|
17
28
|
application.services = application.services.transform_values! do |service|
|
18
29
|
current = AST.service
|
@@ -31,11 +42,16 @@ module Orchparty
|
|
31
42
|
else
|
32
43
|
application._mixins[mix]
|
33
44
|
end
|
45
|
+
if mixin.nil?
|
46
|
+
warn "ERROR: Could not find mixin '#{mix}'."
|
47
|
+
exit 1
|
48
|
+
end
|
34
49
|
transform_mixin(mixin, application, ast)
|
35
50
|
end
|
36
51
|
|
37
52
|
def transform_mixin(mixin, application, ast)
|
38
53
|
current = AST.application_mixin
|
54
|
+
|
39
55
|
mixin[:_mix].each do |mix|
|
40
56
|
current = current.deep_merge_concat(resolve_mixin(mix, application, ast))
|
41
57
|
end
|
data/lib/orchparty/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jannis Huebl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|