krane 2.4.4 → 2.4.7

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: 64b26c01ccbf33a59a0b18463afdcde52c7b223f120b804dd865e99a7fa1195c
4
- data.tar.gz: bcd0a549f67c53e23f5c8ea556c8a97d847f30d9e54e088b0e26f0c9059c51d0
3
+ metadata.gz: 4ea2d6805d4bcb71c3d3f70d99cb27a6bd392636a19077cea322f782e815b072
4
+ data.tar.gz: a7aaf751e8d1de0f47006b41bd115615f49b2ba05ff1486447e3747bd467722b
5
5
  SHA512:
6
- metadata.gz: f617f7580dd5de9630ac439f2b0ded0aed198db11a2fbaa3a6ec72d4745c43001e9ffcea7570432ae13dab9224118f50da448958294317a5dd104597809e3dcf
7
- data.tar.gz: 7a8807bdc559e2fe1b92734a347809f24cade1fac10bd00510b3667b3e9880bd7c37e75c1bf0dee44488a9972ad2f9c1b498a3e96107c143583fb018da2ed6f0
6
+ metadata.gz: b6f742a8c88c993c9c255ce27ae1419989e03810a21cc656bcc6b0766496b0fdeed7ead385e97d30a77c5c03b56c3fac5039e5c2556ed8ceb4a04a6fca31f7e1
7
+ data.tar.gz: 9ec49b7ffdacf6a58a1e498c1c17be51a2a2c063c613d5ecb391d704383803d3b8911e91bcca125e14fa03b82252ad3e040511e9cc7c632506a9074cd2dafff3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  ## next
2
2
 
3
+ ## 2.4.7
4
+
5
+ *Bug fixes*
6
+
7
+ - Fix `replace-force` deployment method override.
8
+ ```
9
+ /usr/local/bundle/gems/krane-2.4.6/lib/krane/resource_deployer.rb:119:in `block in deploy_resources': Unexpected deploy method! (:"replace-force") (ArgumentError)
10
+ ```
11
+ Dash (-) must be replaced with underscore (_) before applying it as method on kubernetes resource.
12
+
13
+ ## 2.4.6
14
+
15
+ *Bug fixes*
16
+
17
+ - Extend [#886](https://github.com/Shopify/krane/pull/886) to not only secrets but anything that doesn't match `failed to sync %s cache` [#886](https://github.com/Shopify/krane/pull/886)
18
+ It seems an issue when too many pods are referencing the same secret/configmap https://github.com/kubernetes/kubernetes/pull/74755, so instead of failing fast, it'll now let the resources attempt to succeed.
19
+ - Add missing unit test for above feature.
20
+
21
+ ## 2.4.5
22
+
23
+ *Bug fixes*
24
+
25
+ - Do not fail fast for CreateContainerConfigError when message include issues mounting the secret, to let the pods be recreated and possible succeed [#885](https://github.com/Shopify/krane/pull/885)
26
+
3
27
  ## 2.4.4
4
28
 
5
29
  *Enhancements*
data/lib/krane/kubectl.rb CHANGED
@@ -82,9 +82,17 @@ module Krane
82
82
  def version_info
83
83
  @version_info ||=
84
84
  begin
85
- response, _, status = run("version", use_namespace: false, log_failure: true, attempts: 2)
85
+ response, _, status = run("version", output: "json", use_namespace: false, log_failure: true, attempts: 2)
86
86
  raise KubectlError, "Could not retrieve kubectl version info" unless status.success?
87
- extract_version_info_from_kubectl_response(response)
87
+
88
+ version_data = JSON.parse(response)
89
+ client_version = platform_agnostic_version(version_data.dig("clientVersion", "gitVersion").to_s)
90
+ server_version = platform_agnostic_version(version_data.dig("serverVersion", "gitVersion").to_s)
91
+ unless client_version && server_version
92
+ raise KubectlError, "Received invalid kubectl version data: #{version_data}"
93
+ end
94
+
95
+ { client: client_version, server: server_version }
88
96
  end
89
97
  end
90
98
 
@@ -127,15 +135,10 @@ module Krane
127
135
  end
128
136
  end
129
137
 
130
- def extract_version_info_from_kubectl_response(response)
131
- info = {}
132
- response.each_line do |l|
133
- match = l.match(/^(?<kind>Client|Server).* GitVersion:"v(?<version>\d+\.\d+\.\d+)/)
134
- if match
135
- info[match[:kind].downcase.to_sym] = Gem::Version.new(match[:version])
136
- end
138
+ def platform_agnostic_version(version_string)
139
+ if match = version_string.match(/v(?<version>\d+\.\d+\.\d+)/)
140
+ Gem::Version.new(match[:version])
137
141
  end
138
- info
139
142
  end
140
143
  end
141
144
  end
@@ -229,7 +229,11 @@ module Krane
229
229
  elsif limbo_reason == "ErrImagePull" && limbo_message.match(/not found/i)
230
230
  "Failed to pull image #{@image}. "\
231
231
  "Did you wait for it to be built and pushed to the registry before deploying?"
232
- elsif limbo_reason == "CreateContainerConfigError"
232
+ # Only fail fast when message doesn't include `failed to sync %s cache`.
233
+ # It's possible that a secret/configmap is still trying to be mounted to the pod, it seems related
234
+ # to too many pods referencing the same secret/configmap: https://github.com/kubernetes/kubernetes/pull/74755
235
+ # Error message format source: https://github.com/kubernetes/kubernetes/pull/75260
236
+ elsif limbo_reason == "CreateContainerConfigError" && !limbo_message.match("failed to sync (.*?) cache")
233
237
  "Failed to generate container configuration: #{limbo_message}"
234
238
  elsif @status.dig("lastState", "terminated", "reason") == "ContainerCannotRun"
235
239
  # ref: https://github.com/kubernetes/kubernetes/blob/562e721ece8a16e05c7e7d6bdd6334c910733ab2/pkg/kubelet/dockershim/docker_container.go#L353
@@ -250,7 +250,7 @@ module Krane
250
250
  end
251
251
 
252
252
  def deploy_method_override
253
- krane_annotation_value(DEPLOY_METHOD_OVERRIDE_ANNOTATION)&.to_sym
253
+ krane_annotation_value(DEPLOY_METHOD_OVERRIDE_ANNOTATION)&.gsub("-", "_")&.to_sym
254
254
  end
255
255
 
256
256
  def sync_debug_info(kubectl)
data/lib/krane/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Krane
3
- VERSION = "2.4.4"
3
+ VERSION = "2.4.7"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: krane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Verey
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-04-01 00:00:00.000000000 Z
13
+ date: 2022-05-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport