minfra-cli 1.6.1 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cee136b8311f1099c78490bfcf6da7be65e5fd8dc0cb029e8dc3828646e6631
4
- data.tar.gz: 46d3929cc27282bc0ed1ac63c4db00c64a7e55e6dbd311319a29dff7d68ab403
3
+ metadata.gz: b5f12534bfcd73e84a69435f5cd58d9884d595a90c387518a663621c2a03e17a
4
+ data.tar.gz: bd8bdc596ea6fef14fa55f187710b6841cd31df32447b76b63bf6bd4cf96e1ab
5
5
  SHA512:
6
- metadata.gz: 469d14ac4671707412d214cd24d7c682bbd5ea62a1ee23dc87d0512eab1ec4ca51223751cfab73c2e96f96ccdba20f25f1394b32d61dd57a231862c1ff3fa25b
7
- data.tar.gz: 70f3bc9ea2ec6f6509d709a6c68969453335f47063086063194cb616aa5db6131b8af69377fe935c329f25df8cbd0096e9fbb9ae44fbfd9035c8be1640b1982a
6
+ metadata.gz: a15f204d44ba8432ff2a36d73b3e5069689dcc3307bb036e6492bbbc01fbbe8aeeb3fec40d098d28199658d32c487e6c10bc7a9391800800556f5972ca80e5ca
7
+ data.tar.gz: 5dc1e214bf4a90d699c2cdbf47018c7966f303c4e990ff9aea1c5adaa09b7c50322ca34e765ae2f3b46fa2787e8609a0ee978e65a26eaee605875486c793cb25
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.6.2
2
+ * fixing templater
3
+ * generating Chart.yaml only once with the namespaces name
1
4
  # 1.6.1
2
5
  * adding minfra_path to hiera scope
3
6
  * fixing state preparation when state dir not yet there
@@ -14,7 +14,7 @@ module Minfra
14
14
  raise "file #{path} not found"
15
15
  end
16
16
  end
17
- render(template, params)
17
+ render(content, params)
18
18
  end
19
19
 
20
20
  def self.render(template, params)
@@ -1,5 +1,5 @@
1
1
  module Minfra
2
2
  module Cli
3
- VERSION = '1.6.1'.freeze
3
+ VERSION = '1.6.2'.freeze
4
4
  end
5
5
  end
data/lib/minfra/cli.rb CHANGED
@@ -5,13 +5,14 @@ require 'ostruct'
5
5
  require 'hiera'
6
6
 
7
7
  require_relative 'cli/logging'
8
+ require_relative 'cli/templater'
9
+
8
10
  require 'orchparty'
9
11
  require_relative 'cli/config'
10
12
  require_relative 'cli/version'
11
13
  require_relative 'cli/hook'
12
14
  require_relative 'cli/common'
13
15
  require_relative 'cli/command'
14
- require_relative 'cli/templater'
15
16
  require_relative 'cli/ask'
16
17
  require_relative 'cli/document'
17
18
  require_relative 'cli/runner'
@@ -179,7 +179,7 @@ module Orchparty
179
179
  end
180
180
 
181
181
  def install(chart)
182
- info("Install: #{chart}")
182
+ info("Install: #{chart.name}")
183
183
  build_chart(chart) do |chart_path|
184
184
  @out_io.puts system("helm install --create-namespace --namespace #{namespace} --kube-context #{cluster_name} #{chart.name} #{chart_path}")
185
185
  end
@@ -211,11 +211,6 @@ module Orchparty
211
211
 
212
212
  def run(templates_path:, params:, output_chart_path:, chart: )
213
213
 
214
- generate_chart_yaml(
215
- templates_path: templates_path,
216
- output_chart_path: output_chart_path,
217
- chart_name: chart.name,
218
- )
219
214
 
220
215
  File.open(File.join(output_chart_path, 'values.yaml'),'a') do |helm_values|
221
216
  params.each do |app_name, subparams|
@@ -265,16 +260,6 @@ module Orchparty
265
260
  params._used_vars
266
261
  end
267
262
 
268
- def generate_chart_yaml(templates_path:, output_chart_path:, chart_name: )
269
- template_path = File.join(templates_path, 'Chart.yaml.erb')
270
- output_path = File.join(output_chart_path, 'Chart.yaml')
271
-
272
- template = Erubis::Eruby.new(File.read(template_path))
273
- template.filename = template_path
274
- params = Hashie::Mash.new(chart_name: chart_name)
275
- document = template.result(CleanBinding.new.get_binding(params))
276
- File.write(output_path, document)
277
- end
278
263
  end
279
264
  end
280
265
  end
@@ -311,11 +296,18 @@ class KubernetesApplication
311
296
 
312
297
  private
313
298
  def prepare
299
+
314
300
  output_chart_path = @status_dir.join('helm')
315
301
  output_chart_path.rmtree if output_chart_path.exist?
316
302
  output_chart_path.mkpath
317
303
  templates_path = file_path.join('../../chart-templates').expand_path #don't ask. the whole concept of multiple charts in an app stinks...
318
304
 
305
+ generate_chart_yaml(
306
+ templates_path: templates_path,
307
+ output_chart_path: output_chart_path,
308
+ chart_name: namespace,
309
+ )
310
+
319
311
  info("generating base helm structure from: #{output_chart_path} from #{templates_path}")
320
312
  system("mkdir -p #{File.join(output_chart_path, 'templates')}")
321
313
 
@@ -324,6 +316,14 @@ class KubernetesApplication
324
316
  system("cp #{File.join(templates_path, 'templates/_helpers.tpl')} #{File.join(output_chart_path, 'templates/_helpers.tpl')}")
325
317
 
326
318
  end
319
+
320
+ def generate_chart_yaml(templates_path:, output_chart_path:, chart_name: )
321
+ template_path = File.join(templates_path, 'Chart.yaml.erb')
322
+ output_path = File.join(output_chart_path, 'Chart.yaml')
323
+
324
+ res=Minfra::Cli::Templater.read(template_path, params: {chart_name: chart_name})
325
+ File.write(output_path, res)
326
+ end
327
327
 
328
328
  def combine_charts(app_config)
329
329
  services = app_config._service_order.map(&:to_s)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minfra-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Schrammel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-03 00:00:00.000000000 Z
11
+ date: 2023-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor