krane 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop-http---shopify-github-io-ruby-style-guide-rubocop-yml +0 -9
- data/.shopify-build/krane.yml +16 -2
- data/1.0-Upgrade.md +1 -1
- data/CHANGELOG.md +9 -1
- data/README.md +3 -5
- data/bin/ci +1 -1
- data/dev.yml +1 -1
- data/krane.gemspec +3 -1
- data/lib/krane/cluster_resource_discovery.rb +7 -5
- data/lib/krane/deploy_task.rb +2 -2
- data/lib/krane/global_deploy_task.rb +2 -2
- data/lib/krane/kubectl.rb +1 -0
- data/lib/krane/kubernetes_resource.rb +2 -2
- data/lib/krane/kubernetes_resource/custom_resource.rb +1 -1
- data/lib/krane/kubernetes_resource/custom_resource_definition.rb +1 -1
- data/lib/krane/kubernetes_resource/deployment.rb +2 -2
- data/lib/krane/render_task.rb +2 -2
- data/lib/krane/restart_task.rb +2 -2
- data/lib/krane/runner_task.rb +2 -2
- data/lib/krane/statsd.rb +2 -2
- data/lib/krane/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d24b8a158239b66ab2f5ee126937935c9942dfea2336fe213410326e446c30dc
|
4
|
+
data.tar.gz: 44ee52b5123fd507c62f266b371f14edc606f2738550e47c39b5e2995b907b0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c9f7d48d131277dac55b357ef895b63e5822ab7428954a1d7b871ce50594908df47bfc82320dd4f01b4e6d790b3383e9eb214ba42f98f03afd0c5332ebcb4c
|
7
|
+
data.tar.gz: e3f98ac0a1c55fdb63f88977cc9fad4d72c3ec437f7795ceaffbcc2664387b60d7f4ea6e75e3cc596f73b823371063d7dcc5d80ba63efe44b000dd9b02498551
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# Recommended rubocop version: ~> 0.78.0
|
2
|
-
|
3
1
|
AllCops:
|
4
2
|
Exclude:
|
5
3
|
- 'db/schema.rb'
|
@@ -78,13 +76,6 @@ Style/BlockDelimiters:
|
|
78
76
|
- proc
|
79
77
|
- it
|
80
78
|
|
81
|
-
Style/BracesAroundHashParameters:
|
82
|
-
EnforcedStyle: no_braces
|
83
|
-
SupportedStyles:
|
84
|
-
- braces
|
85
|
-
- no_braces
|
86
|
-
- context_dependent
|
87
|
-
|
88
79
|
Layout/CaseIndentation:
|
89
80
|
EnforcedStyle: end
|
90
81
|
SupportedStyles:
|
data/.shopify-build/krane.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
containers:
|
2
2
|
default:
|
3
|
-
docker: circleci/ruby:2.
|
3
|
+
docker: circleci/ruby:2.5.7
|
4
4
|
|
5
5
|
steps:
|
6
6
|
- label: Lint
|
@@ -9,6 +9,21 @@ steps:
|
|
9
9
|
- bundle exec rubocop
|
10
10
|
dependencies:
|
11
11
|
- bundler
|
12
|
+
- label: 'Run Test Suite (:kubernetes: 1.17-latest :ruby: 2.7)'
|
13
|
+
command: bin/ci
|
14
|
+
agents:
|
15
|
+
queue: k8s-ci
|
16
|
+
env:
|
17
|
+
LOGGING_LEVEL: "4"
|
18
|
+
KUBERNETES_VERSION: v1.17-latest
|
19
|
+
RUBY_VERSION: "2.7"
|
20
|
+
- label: 'Run Test Suite (:kubernetes: 1.17-latest)'
|
21
|
+
command: bin/ci
|
22
|
+
agents:
|
23
|
+
queue: k8s-ci
|
24
|
+
env:
|
25
|
+
LOGGING_LEVEL: "4"
|
26
|
+
KUBERNETES_VERSION: v1.17-latest
|
12
27
|
- label: 'Run Test Suite (:kubernetes: 1.16-latest)'
|
13
28
|
command: bin/ci
|
14
29
|
agents:
|
@@ -51,4 +66,3 @@ steps:
|
|
51
66
|
env:
|
52
67
|
LOGGING_LEVEL: "4"
|
53
68
|
KUBERNETES_VERSION: v1.11-latest
|
54
|
-
|
data/1.0-Upgrade.md
CHANGED
@@ -119,7 +119,7 @@ Old flag | New flag | Comments
|
|
119
119
|
--skip-wait | --verify-result=true |
|
120
120
|
--allow-protected-ns | --protected-namespaces=default,kube-system,kube-public | Added the ability to specify which namespaces are protected
|
121
121
|
--no-prune | --prune=true |
|
122
|
-
--template-dir | -f, --
|
122
|
+
--template-dir | -f, --filenames | Makes all krane commands accept this argument, which is now required for the deploy task
|
123
123
|
--verbose-log-prefix | --verbose-log-prefix |
|
124
124
|
--max-watch-seconds=seconds | --global-timeout=300s | Changed flag name and default value to be a duration (expressed using strings like "300s" or "1h")
|
125
125
|
--selector | --selector |
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
## next
|
2
2
|
|
3
|
-
|
3
|
+
## 1.1.3
|
4
|
+
|
5
|
+
*Bug Fixes*
|
6
|
+
- Retry dry-run validation when no error is returned. [#705](https://github.com/Shopify/krane/pull/705)
|
7
|
+
- Stop deploys if ClusterResourceDiscovery's kubectl calls fail. [#701](https://github.com/Shopify/krane/pull/701)
|
8
|
+
|
9
|
+
*Other*
|
10
|
+
- Dropped support for Ruby 2.4 since it will be EoL shortly. [#693](https://github.com/Shopify/krane/pull/693).
|
11
|
+
- Ruby 2.7 support: fix deprecation warnings, add testing. [#710](https://github.com/Shopify/krane/pull/705)
|
4
12
|
|
5
13
|
## 1.1.2
|
6
14
|
*Enhancements*
|
data/README.md
CHANGED
@@ -73,7 +73,7 @@ If you need the ability to render dynamic values in templates before deploying,
|
|
73
73
|
|
74
74
|
## Prerequisites
|
75
75
|
|
76
|
-
* Ruby 2.
|
76
|
+
* Ruby 2.5+
|
77
77
|
* Your cluster must be running Kubernetes v1.11.0 or higher<sup>1</sup>
|
78
78
|
|
79
79
|
<sup>1</sup> We run integration tests against these Kubernetes versions. You can find our
|
@@ -103,7 +103,7 @@ official compatibility chart below.
|
|
103
103
|
|
104
104
|
*Environment variables:*
|
105
105
|
|
106
|
-
- `$KUBECONFIG`: points to one or multiple valid kubeconfig files that include the context you want to deploy to. File names are separated by colon for Linux and Mac, and semi-colon for Windows. If
|
106
|
+
- `$KUBECONFIG`: points to one or multiple valid kubeconfig files that include the context you want to deploy to. File names are separated by colon for Linux and Mac, and semi-colon for Windows. If omitted, Krane will use the Kubernetes default of `~/.kube/config`.
|
107
107
|
- `$GOOGLE_APPLICATION_CREDENTIALS`: points to the credentials for an authenticated service account (required if your kubeconfig `user`'s auth provider is GCP)
|
108
108
|
|
109
109
|
|
@@ -544,9 +544,7 @@ krane render -f ./path/to/template/dir/template.yaml.erb > template.yaml
|
|
544
544
|
- `--bindings=BINDINGS`: Makes additional variables available to your ERB templates. For example, `krane render --bindings=color=blue size=large -f some-template.yaml.erb` will expose `color` and `size` to `some-template.yaml.erb`.
|
545
545
|
- `--current-sha`: Expose SHA `current_sha` in ERB bindings
|
546
546
|
|
547
|
-
You can add additional variables using the `--bindings=BINDINGS` option which can be
|
548
|
-
file path prefixed with an `@` sign. An argument error will be raised if the string argument cannot be parsed, the referenced file does not include a
|
549
|
-
valid extension (`.json`, `.yaml` or `.yml`) or the referenced file does not exist.
|
547
|
+
You can add additional variables using the `--bindings=BINDINGS` option which can be formatted as a string, JSON string or path to a JSON or YAML file. Complex JSON or YAML data will be converted to a Hash for use in templates. To load a file, the argument should include the relative file path prefixed with an `@` sign. An argument error will be raised if the string argument cannot be parsed, the referenced file does not include a valid extension (`.json`, `.yaml` or `.yml`) or the referenced file does not exist.
|
550
548
|
|
551
549
|
#### Bindings examples
|
552
550
|
|
data/bin/ci
CHANGED
data/dev.yml
CHANGED
data/krane.gemspec
CHANGED
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = %w(lib)
|
25
25
|
|
26
|
-
spec.
|
26
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
27
|
+
|
28
|
+
spec.required_ruby_version = '>= 2.5.0'
|
27
29
|
spec.add_dependency("activesupport", ">= 5.0")
|
28
30
|
spec.add_dependency("kubeclient", "~> 4.3")
|
29
31
|
spec.add_dependency("googleauth", "~> 0.8")
|
@@ -37,7 +37,7 @@ module Krane
|
|
37
37
|
def fetch_resources(namespaced: false)
|
38
38
|
command = %w(api-resources)
|
39
39
|
command << "--namespaced=#{namespaced}"
|
40
|
-
raw,
|
40
|
+
raw, err, st = kubectl.run(*command, output: "wide", attempts: 5,
|
41
41
|
use_namespace: false)
|
42
42
|
if st.success?
|
43
43
|
rows = raw.split("\n")
|
@@ -59,7 +59,7 @@ module Krane
|
|
59
59
|
resource
|
60
60
|
end
|
61
61
|
else
|
62
|
-
|
62
|
+
raise FatalKubeAPIError, "Error retrieving api-resources: #{err}"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -68,7 +68,7 @@ module Krane
|
|
68
68
|
# kubectl api-versions returns a list of group/version strings e.g. autoscaling/v2beta2
|
69
69
|
# A kind may not exist in all versions of the group.
|
70
70
|
def fetch_api_versions
|
71
|
-
raw,
|
71
|
+
raw, err, st = kubectl.run("api-versions", attempts: 5, use_namespace: false)
|
72
72
|
# The "core" group is represented by an empty string
|
73
73
|
versions = { "" => %w(v1) }
|
74
74
|
if st.success?
|
@@ -78,6 +78,8 @@ module Krane
|
|
78
78
|
versions[group] ||= []
|
79
79
|
versions[group] << version
|
80
80
|
end
|
81
|
+
else
|
82
|
+
raise FatalKubeAPIError, "Error retrieving api-versions: #{err}"
|
81
83
|
end
|
82
84
|
versions
|
83
85
|
end
|
@@ -98,12 +100,12 @@ module Krane
|
|
98
100
|
end
|
99
101
|
|
100
102
|
def fetch_crds
|
101
|
-
raw_json,
|
103
|
+
raw_json, err, st = kubectl.run("get", "CustomResourceDefinition", output: "json", attempts: 5,
|
102
104
|
use_namespace: false)
|
103
105
|
if st.success?
|
104
106
|
JSON.parse(raw_json)["items"]
|
105
107
|
else
|
106
|
-
|
108
|
+
raise FatalKubeAPIError, "Error retrieving CustomResourceDefinition: #{err}"
|
107
109
|
end
|
108
110
|
end
|
109
111
|
|
data/lib/krane/deploy_task.rb
CHANGED
data/lib/krane/kubectl.rb
CHANGED
@@ -572,7 +572,7 @@ module Krane
|
|
572
572
|
def validate_with_server_side_dry_run(kubectl)
|
573
573
|
command = ["apply", "-f", file_path, "--server-dry-run", "--output=name"]
|
574
574
|
kubectl.run(*command, log_failure: false, output_is_sensitive: sensitive_template_content?,
|
575
|
-
retry_whitelist: [:client_timeout], attempts: 3)
|
575
|
+
retry_whitelist: [:client_timeout, :empty], attempts: 3)
|
576
576
|
end
|
577
577
|
|
578
578
|
# Local dry run is supported on only create and apply
|
@@ -582,7 +582,7 @@ module Krane
|
|
582
582
|
verb = deploy_method == :apply ? "apply" : "create"
|
583
583
|
command = [verb, "-f", file_path, "--dry-run", "--output=name"]
|
584
584
|
kubectl.run(*command, log_failure: false, output_is_sensitive: sensitive_template_content?,
|
585
|
-
retry_whitelist: [:client_timeout], attempts: 3, use_namespace: !global?)
|
585
|
+
retry_whitelist: [:client_timeout, :empty], attempts: 3, use_namespace: !global?)
|
586
586
|
end
|
587
587
|
|
588
588
|
def labels
|
@@ -97,7 +97,7 @@ module Krane
|
|
97
97
|
progress_condition.present? ? deploy_failing_to_progress? : super
|
98
98
|
end
|
99
99
|
|
100
|
-
def validate_definition(
|
100
|
+
def validate_definition(*, **)
|
101
101
|
super
|
102
102
|
|
103
103
|
unless REQUIRED_ROLLOUT_TYPES.include?(required_rollout) || percent?(required_rollout)
|
@@ -191,7 +191,7 @@ module Krane
|
|
191
191
|
def min_available_replicas
|
192
192
|
if percent?(required_rollout)
|
193
193
|
(desired_replicas * required_rollout.to_i / 100.0).ceil
|
194
|
-
elsif max_unavailable =~ /%/
|
194
|
+
elsif max_unavailable.is_a?(String) && max_unavailable =~ /%/
|
195
195
|
(desired_replicas * (100 - max_unavailable.to_i) / 100.0).ceil
|
196
196
|
else
|
197
197
|
desired_replicas - max_unavailable.to_i
|
data/lib/krane/render_task.rb
CHANGED
data/lib/krane/restart_task.rb
CHANGED
data/lib/krane/runner_task.rb
CHANGED
data/lib/krane/statsd.rb
CHANGED
@@ -35,10 +35,10 @@ module Krane
|
|
35
35
|
end
|
36
36
|
|
37
37
|
metric ||= "#{method_name}.duration"
|
38
|
-
self::InstrumentationProxy.send(:define_method, method_name) do |*args, &block|
|
38
|
+
self::InstrumentationProxy.send(:define_method, method_name) do |*args, **kwargs, &block|
|
39
39
|
begin
|
40
40
|
start_time = Time.now.utc
|
41
|
-
super(*args, &block)
|
41
|
+
super(*args, **kwargs, &block)
|
42
42
|
rescue
|
43
43
|
error = true
|
44
44
|
raise
|
data/lib/krane/version.rb
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.3
|
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: 2020-
|
13
|
+
date: 2020-04-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -498,7 +498,8 @@ files:
|
|
498
498
|
homepage: https://github.com/Shopify/krane
|
499
499
|
licenses:
|
500
500
|
- MIT
|
501
|
-
metadata:
|
501
|
+
metadata:
|
502
|
+
allowed_push_host: https://rubygems.org
|
502
503
|
post_install_message:
|
503
504
|
rdoc_options: []
|
504
505
|
require_paths:
|
@@ -507,7 +508,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
507
508
|
requirements:
|
508
509
|
- - ">="
|
509
510
|
- !ruby/object:Gem::Version
|
510
|
-
version: 2.
|
511
|
+
version: 2.5.0
|
511
512
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
512
513
|
requirements:
|
513
514
|
- - ">="
|