krane 2.1.9 → 2.1.10

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: 6126a210b181939121f8639ea63915439fb4188f0a82220b8c6db53cf7aa4980
4
- data.tar.gz: f1808e32d27cae24775e65fa6fbb0ddb47e99b6b0ca1a62456ec721d386b94d8
3
+ metadata.gz: 41b26bfb1a0aee84de5462ef6f2e9421e208ead40437e1175c5fffcbbee10a65
4
+ data.tar.gz: bd21cd0c3ac2c5eeebb75883bb671da5847561e85173a0ffbf40f0b420ff0b57
5
5
  SHA512:
6
- metadata.gz: 3fe412af18f0473f2fbb25b03ec34beee430f2d9483884af66e24220b4823059caf0b9b9974ba3bbc62481fe42bea8b86eda4efb341f335e259c631f85dfdbab
7
- data.tar.gz: 8cb300e21c0608ad62b3caa3f82fc818e6de7cb11a2c8c8c63607b1b92335f6d0c198916f2b2fabd271646958e64db78a67d3251d492607d2d4301b5b0fe3e35
6
+ metadata.gz: 8d53a59534ce296455aaf8b964aec3c0af378da315e7f1d45d56d8f9cb141f9992a72a594146e048487945e17551c6fddb62a46bc52244c8f7af49b5d83c0f88
7
+ data.tar.gz: 9a2764c120e71f0b429ea2c764ac56bbbedf91d42da5b94a97686809d33025fe81049692b3290970a12768402d2a69891443128b882aa10aafe0d179b6a250ae
@@ -8,6 +8,14 @@ steps:
8
8
  run:
9
9
  - bundle: ~
10
10
  - bundle exec rubocop
11
+ - label: 'Run Test Suite (:kubernetes: 1.21-latest :ruby: 3.0)'
12
+ command: bin/ci
13
+ agents:
14
+ queue: k8s-ci
15
+ env:
16
+ LOGGING_LEVEL: "4"
17
+ KUBERNETES_VERSION: v1.21-latest
18
+ RUBY_VERSION: "3.0"
11
19
  - label: 'Run Test Suite (:kubernetes: 1.20-latest :ruby: 3.0)'
12
20
  command: bin/ci
13
21
  agents:
@@ -38,17 +46,3 @@ steps:
38
46
  env:
39
47
  LOGGING_LEVEL: "4"
40
48
  KUBERNETES_VERSION: v1.17-latest
41
- - label: 'Run Test Suite (:kubernetes: 1.16-latest)'
42
- command: bin/ci
43
- agents:
44
- queue: k8s-ci
45
- env:
46
- LOGGING_LEVEL: "4"
47
- KUBERNETES_VERSION: v1.16-latest
48
- - label: 'Run Test Suite (:kubernetes: 1.15-latest)'
49
- command: bin/ci
50
- agents:
51
- queue: k8s-ci
52
- env:
53
- LOGGING_LEVEL: "4"
54
- KUBERNETES_VERSION: v1.15-latest
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## next
2
2
 
3
+ ## 2.1.10
4
+
5
+ *Bug Fixes*
6
+
7
+ - Don't gather prunable resources by calling uniq only on `kind`: use `group` as well. Otherwise certain resources may not be added to the prune whitelist if the same kind exists across multiple groups [#825](https://github.com/Shopify/krane/pull/825)
8
+ - Fix resource discovery failures when API paths are not located at the root of the API server (this occurs, for example, when using Rancher proxy) [#827](https://github.com/Shopify/krane/pull/827)
9
+
10
+ *Other*
11
+
12
+ - Fix ERB deprecation of positional arguments [#828](https://github.com/Shopify/krane/pull/828)
13
+
3
14
  ## 2.1.9
4
15
 
5
16
  *Other*
@@ -34,7 +34,7 @@ module Krane
34
34
  end
35
35
  responses.flat_map do |path, resources|
36
36
  resources.map { |r| resource_hash(path, namespaced, r) }
37
- end.compact.uniq { |r| r["kind"] }
37
+ end.compact.uniq { |r| "#{r['apigroup']}/#{r['kind']}" }
38
38
  end
39
39
 
40
40
  def fetch_mutating_webhook_configurations
@@ -52,9 +52,20 @@ module Krane
52
52
 
53
53
  private
54
54
 
55
+ # During discovery, the api paths may not actually be at the root, so we must programatically find it.
56
+ def base_api_path
57
+ @base_api_path ||= begin
58
+ raw_response, err, st = kubectl.run("config", "view", "--minify", "--output",
59
+ "jsonpath={.clusters[*].cluster.server}", attempts: 5, use_namespace: false)
60
+ raise FatalKubeAPIError, "Error retrieving cluster url: #{err}" unless st.success?
61
+
62
+ URI(raw_response).path.blank? ? "/" : URI(raw_response).path
63
+ end
64
+ end
65
+
55
66
  def api_paths
56
67
  @api_path_cache["/"] ||= begin
57
- raw_json, err, st = kubectl.run("get", "--raw", "/", attempts: 5, use_namespace: false)
68
+ raw_json, err, st = kubectl.run("get", "--raw", base_api_path, attempts: 5, use_namespace: false)
58
69
  paths = if st.success?
59
70
  JSON.parse(raw_json)["paths"]
60
71
  else
@@ -39,7 +39,7 @@ module Krane
39
39
  erb_binding = TemplateContext.new(self).template_binding
40
40
  bind_template_variables(erb_binding, template_variables)
41
41
 
42
- ERB.new(raw_template, nil, '-').result(erb_binding)
42
+ ERB.new(raw_template, trim_mode: '-').result(erb_binding)
43
43
  rescue InvalidPartialError => err
44
44
  err.parents = err.parents.dup.unshift(filename)
45
45
  err.filename = "#{err.filename} (partial included from: #{err.parents.join(' -> ')})"
@@ -56,7 +56,7 @@ module Krane
56
56
 
57
57
  partial_path = find_partial(partial)
58
58
  template = File.read(partial_path)
59
- expanded_template = ERB.new(template, nil, '-').result(erb_binding)
59
+ expanded_template = ERB.new(template, trim_mode: '-').result(erb_binding)
60
60
 
61
61
  docs = Psych.parse_stream(expanded_template, partial_path)
62
62
  # If the partial contains multiple documents or has an explicit document header,
data/lib/krane/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Krane
3
- VERSION = "2.1.9"
3
+ VERSION = "2.1.10"
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.1.9
4
+ version: 2.1.10
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: 2021-05-28 00:00:00.000000000 Z
13
+ date: 2021-06-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport