krane 2.4.5 → 2.4.8

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
  SHA256:
3
- metadata.gz: 0231d6f4ef50874282ebc4456e5a13ba48408ec22a2b9caef05229323561c2f3
4
- data.tar.gz: b3007f0d090526b1552638e63aa3a350e6cc8182aab6abc536f1eafe0acb02fb
3
+ metadata.gz: a785ceec99d9fef8328e541744ece449fde68685d953f410ad6ce4413c51e33b
4
+ data.tar.gz: 8a96a80cbed3f02d7bd5d241b12572f90de6432904535839843cac328894a9fa
5
5
  SHA512:
6
- metadata.gz: 21b40ac3a9ad836e29f293a1ddd293991ab8c784c54869d705496a101500d22893f3033d28632f8175f49b23397fa74f8cd3b98f18bf614447c30568f13f7bfa
7
- data.tar.gz: 89d62f90ddccbfcea97abd44dc304f846f639d6a94781efef2f99b361bdd2e604233e6a968a1f8b583ea213b9d6052f6c52ca9fa6526312bb52cc14ba2172e70
6
+ metadata.gz: ba81377d1e1bb58ae30b6a19254d3403c4d1e18cd7bc748e7b6fa43dba54366a81f539e721febed5bb7c4e97dffb48c56c6ab5af04c193557d794cd5941cd638
7
+ data.tar.gz: 919a14fff6f1116eb587b1e5521255fc2a498de3139d7fd0402ce89a492fb18d5bb2e6cc53d08a4006e92ea10ca0b46b935c3386c964374130920b3463151f5f
data/CHANGELOG.md CHANGED
@@ -1,10 +1,32 @@
1
1
  ## next
2
2
 
3
+ ## 2.4.8
4
+
5
+ - update googleauth gem version to 1.2
6
+ - add the `ruby-lsp` gem to development group in the Gemfile
7
+ ## 2.4.7
8
+
9
+ *Bug fixes*
10
+
11
+ - Fix `replace-force` deployment method override.
12
+ ```
13
+ /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)
14
+ ```
15
+ Dash (-) must be replaced with underscore (_) before applying it as method on kubernetes resource.
16
+
17
+ ## 2.4.6
18
+
19
+ *Bug fixes*
20
+
21
+ - 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)
22
+ 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.
23
+ - Add missing unit test for above feature.
24
+
3
25
  ## 2.4.5
4
26
 
5
27
  *Bug fixes*
6
28
 
7
- - Revert PR that tried to fail fast when there are container initialization issues to give pods time to be recreated and possible succeed [#885](https://github.com/Shopify/krane/pull/885)
29
+ - 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)
8
30
 
9
31
  ## 2.4.4
10
32
 
data/Gemfile CHANGED
@@ -3,3 +3,5 @@ source 'https://rubygems.org'
3
3
 
4
4
  # Specify your gem's dependencies in krane.gemspec
5
5
  gemspec
6
+
7
+ gem "ruby-lsp", "~> 0.2.0", :group => :development
data/dev.yml CHANGED
@@ -3,19 +3,10 @@ name: krane
3
3
  up:
4
4
  - ruby: '3.0.3' # Matches gemspec
5
5
  - bundler
6
- - custom:
7
- name: Install Kubernetes in Docker (KinD)
8
- met?: bin/kind version 2>&1 | grep -q v0.11.1
9
- meet: |
10
- mkdir -p bin
11
- curl -sLo bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-darwin-amd64"
12
- chmod +x bin/kind
13
- - custom:
14
- name: Create KinD Cluster
15
- met?: bin/kind get clusters | grep -q krane
16
- meet: bin/kind create cluster --name krane --image "kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047"
17
- down: |
18
- ((bin/kind get clusters | grep -q krane) && bin/kind delete cluster --name krane) || true
6
+ - podman
7
+ - kind:
8
+ name: krane
9
+ image: kindest/node:v1.22.0@sha256:b8bda84bb3a190e6e028b1760d277454a72267a5454b57db34437c34a588d047
19
10
  commands:
20
11
  test:
21
12
  run: bin/test
data/krane.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.required_ruby_version = '>= 2.6.0'
29
29
  spec.add_dependency("activesupport", ">= 5.0")
30
30
  spec.add_dependency("kubeclient", "~> 4.9")
31
- spec.add_dependency("googleauth", "~> 0.8")
31
+ spec.add_dependency("googleauth", "~> 1.2")
32
32
  spec.add_dependency("ejson", "~> 1.0")
33
33
  spec.add_dependency("colorize", "~> 0.8")
34
34
  spec.add_dependency("statsd-instrument", ['>= 2.8', "< 4"])
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,9 +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
- # Only fail fast when message doesn't include `failed to sync secret cache`.
233
- # It's possible that a secret is being created and the pod could get recreated and succeed
234
- elsif limbo_reason == "CreateContainerConfigError" && !limbo_message.include?("failed to sync secret cache")
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")
235
237
  "Failed to generate container configuration: #{limbo_message}"
236
238
  elsif @status.dig("lastState", "terminated", "reason") == "ContainerCannotRun"
237
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.5"
3
+ VERSION = "2.4.8"
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.5
4
+ version: 2.4.8
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-05 00:00:00.000000000 Z
13
+ date: 2022-07-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0.8'
49
+ version: '1.2'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0.8'
56
+ version: '1.2'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: ejson
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -526,7 +526,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
526
526
  - !ruby/object:Gem::Version
527
527
  version: '0'
528
528
  requirements: []
529
- rubygems_version: 3.2.20
529
+ rubygems_version: 3.3.3
530
530
  signing_key:
531
531
  specification_version: 4
532
532
  summary: A command line tool that helps you ship changes to a Kubernetes namespace