mina-kubernetes 3.0.0 → 3.1.0

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: c9e6f3074267ba8ee5a81ea32236f2710b7cd5279cca64ca2307fb14002d4f8f
4
- data.tar.gz: e08d008d5f4994b0159548146df2e94dfc0e993dd3c2808f1c63ab7a83d5df74
3
+ metadata.gz: e4803de1f3f3decf1da5772d6ac1a9cbaa20810e722fc273e981071f57b219b7
4
+ data.tar.gz: 5b011e4604e76d94866888c5ab3676b740237d4cb5becf04e2a24f857c144960
5
5
  SHA512:
6
- metadata.gz: d2435a682a59c5d1bca7a6257eb352a34b92900dfea28ef975e9b85b7fece25e14b99f0b2af751d191539b90ac286bd13f075a4be0177c7a98fde6297e3ead49
7
- data.tar.gz: 760d3d1981dc80c48fb7652a7f97fd142bacbf616a3d8e45da7ac91b412842fcde3cbf0738a6e73abd57180847dbec916ed5c6ccf72cc59be6455e34107473c0
6
+ metadata.gz: 32284456c631a418eae7c04feca2d3ce5b059095012af00c90e5fd291002844f68aafdf919a6c435afb7c29ddc05c7f0c0f6527e71de0bfc945c43c13cf32bc6
7
+ data.tar.gz: c468d84b45f08bddad72937500f8e7054c87b5ee1d14dbc8b7d7ae903c96ae900330e6063b3f8250ba2bb1849bbe8debde463565d741db5bd31c155ad33b43b5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.0.1
2
+
3
+ *Fixes*
4
+
5
+ - Use `File.exist?` instead of `File.exists?` which was removed from Ruby 3.2
6
+
1
7
  ## 3.0.0
2
8
 
3
9
  *Breaking change*
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module Kubernetes
3
- VERSION = "3.0.0"
3
+ VERSION = "3.1.0"
4
4
  end
5
5
  end
@@ -8,19 +8,26 @@ set :execution_mode, :pretty
8
8
 
9
9
  namespace :kubernetes do
10
10
  set :proxy, nil
11
+ set :skip_image_ready_check, false
11
12
 
12
13
  task :deploy, [:options] do |task, args|
13
14
  desc "Set image tag to be latest commit of prompted branch (unless provided) then applies resources to cluster"
14
15
  set_tag_from_branch_commit unless fetch(:image_tag)
15
- wait_until_image_ready(fetch(:image_tag))
16
+ wait_until_image_ready(fetch(:image_tag)) unless fetch(:skip_image_ready_check)
16
17
  create_namespace_on_cluster
17
18
  apply_kubernetes_resources(args[:options])
18
19
  end
19
20
 
21
+ task :global_deploy, [:options] do |task, args|
22
+ set_tag_from_branch_commit unless fetch(:image_tag)
23
+ wait_until_image_ready(fetch(:image_tag)) unless fetch(:skip_image_ready_check)
24
+ apply_global_kubernetes_resources(args[:options])
25
+ end
26
+
20
27
  task :bash do
21
28
  desc "Spins up temporary pod with image and opens remote interactive bash"
22
29
  set_tag_from_branch_commit unless fetch(:image_tag)
23
- wait_until_image_ready(fetch(:image_tag))
30
+ wait_until_image_ready(fetch(:image_tag)) unless fetch(:skip_image_ready_check)
24
31
  run_command("bash")
25
32
  end
26
33
 
@@ -118,7 +125,7 @@ def run_command(command, env_hash = {})
118
125
  when :replace
119
126
  system delete_command
120
127
  run :local do
121
- comment "Lauching Pod #{color(pod_name, 36)} to run #{color(command, 36)}"
128
+ comment "Launching Pod #{color(pod_name, 36)} to run #{color(command, 36)}"
122
129
  end
123
130
  wait_for_image_and_run_command("#{pod_run_command} -- #{command}")
124
131
  when :other
@@ -144,7 +151,25 @@ def apply_kubernetes_resources(options)
144
151
  deploy_cmd += options[:deployment_options] if options&.[](:deployment_options)
145
152
 
146
153
  ejson_secrets_path = "#{filepaths}/secrets.ejson"
147
- deploy_cmd += " --filenames #{ejson_secrets_path}" if File.exists?(ejson_secrets_path)
154
+ deploy_cmd += " --filenames #{ejson_secrets_path}" if File.exist?(ejson_secrets_path)
155
+
156
+ command "#{render_cmd} | #{deploy_cmd}"
157
+ end
158
+ end
159
+
160
+ def apply_global_kubernetes_resources(options)
161
+ run :local do
162
+ comment "Applying all global Kubernetes resources..."
163
+
164
+ proxy_env = "HTTPS_PROXY=#{fetch(:proxy)}" if fetch(:proxy)
165
+ filepaths = options&.[](:filepaths) || "config/deploy/#{fetch(:stage)}"
166
+
167
+ render_cmd = "#{proxy_env} krane render --bindings=image_repo=#{fetch(:image_repo)},image_tag=#{fetch(:image_tag)},nzamespace=#{fetch(:namespace)} --current_sha #{fetch(:image_tag)} -f #{filepaths}"
168
+ deploy_cmd = "#{proxy_env} krane global-deploy #{fetch(:kubernetes_context)} --selector #{fetch(:global_deploy_selector_key)}=#{fetch(:global_deploy_selector_value)} --stdin "
169
+ deploy_cmd += options[:deployment_options] if options&.[](:deployment_options)
170
+
171
+ ejson_secrets_path = "#{filepaths}/secrets.ejson"
172
+ deploy_cmd += " --filenames #{ejson_secrets_path}" if File.exist?(ejson_secrets_path)
148
173
 
149
174
  command "#{render_cmd} | #{deploy_cmd}"
150
175
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-kubernetes
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antoine Sabourin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-03 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler