kubernetes-deploy 0.20.0 → 0.20.1

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
  SHA1:
3
- metadata.gz: a581b73a9b59ce7dbc35a528acf269ba9ee12523
4
- data.tar.gz: 4d3b6268317bf30b3011d1eb3e9f8bcc9c731c4f
3
+ metadata.gz: c1da3f74a75f658fb3fd6e31e3ba0a8aa113ad6a
4
+ data.tar.gz: f3d779d8ced5cb12260e039c47bdd9cf8106ce83
5
5
  SHA512:
6
- metadata.gz: 15197ca3f8d90b28927dc8a5ab365bb7f455434c49af708db82b2f8f5dd7430420a8e4819edbc1d4579cd2291df0a002f11924be3a865631a11e5a1fa3f3b344
7
- data.tar.gz: bae4f408b4bfad19e61754991f24bf34d48dca2929f1d33dbd592b2fcc009b7135adc3dc92201c1e8d7633d80520a798e03aedec45778d59d81aa0a872ab7426
6
+ metadata.gz: 6b29bb17f2c20c7c1353f57458c159c63c620f085bb7e0769a0565096c831c7503b92789ac7c7f36118e22cd41f49b0ce0e41392230bee85ac79a2230095cff2
7
+ data.tar.gz: c875779d47150ba2cd8c784622232651c029ec8a8c411d60763e2a73123c4b1d37d62afc801055dd9fac311e8722415f6c12ab9997592c5595eb7c994b024e7b
data/CHANGELOG.md CHANGED
@@ -1,10 +1,16 @@
1
1
  ### Master
2
2
 
3
+ ### 0.20.1
3
4
  *Features*
4
5
 
5
6
  *Bug Fixes*
7
+ - Display a nice error instead of crashing when a YAML document is missing 'Kind'
8
+ ([#280](https://github.com/Shopify/kubernetes-deploy/pull/280))
9
+ - Prevent DaemonSet from succeeding before rollout finishes
10
+ ([#288](https://github.com/Shopify/kubernetes-deploy/issues/288))
6
11
 
7
12
  *Enhancements*
13
+ - Merge multiple `--bindings` arguments, to allow a composite bindings map (multiple arguments or files)
8
14
 
9
15
  ### 0.20.0
10
16
 
@@ -15,7 +15,7 @@ max_watch_seconds = nil
15
15
  ARGV.options do |opts|
16
16
  opts.on("--bindings=BINDINGS", "Expose additional variables to ERB templates " \
17
17
  "(format: k1=v1,k2=v2, JSON string or file (JSON or YAML) path prefixed by '@')") do |binds|
18
- bindings = KubernetesDeploy::BindingsParser.parse(binds)
18
+ bindings.merge!(KubernetesDeploy::BindingsParser.parse(binds))
19
19
  end
20
20
 
21
21
  opts.on("--skip-wait", "Skip verification of non-priority-resource success (not recommended)") { skip_wait = true }
@@ -24,8 +24,7 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.required_ruby_version = '>= 2.3.0'
26
26
  spec.add_dependency "activesupport", ">= 5.0"
27
- spec.add_dependency "kubeclient", "~> 2.4"
28
- spec.add_dependency "rest-client", ">= 1.7" # Minimum required by kubeclient. Remove when kubeclient releases v3.0.
27
+ spec.add_dependency "kubeclient", "~> 3.0"
29
28
  spec.add_dependency "googleauth", ">= 0.5"
30
29
  spec.add_dependency "ejson", "1.0.1"
31
30
  spec.add_dependency "colorize", "~> 0.8"
@@ -253,6 +253,7 @@ module KubernetesDeploy
253
253
  yield doc
254
254
  end
255
255
  rescue InvalidTemplateError => e
256
+ e.filename ||= filename
256
257
  record_invalid_template(err: e.message, filename: e.filename, content: e.content)
257
258
  raise FatalDeploymentError, "Failed to render and parse template"
258
259
  rescue Psych::SyntaxError => e
@@ -4,8 +4,9 @@ module KubernetesDeploy
4
4
  class KubectlError < StandardError; end
5
5
 
6
6
  class InvalidTemplateError < FatalDeploymentError
7
- attr_reader :filename, :content
8
- def initialize(err, filename:, content: nil)
7
+ attr_reader :content
8
+ attr_accessor :filename
9
+ def initialize(err, filename: nil, content: nil)
9
10
  @filename = filename
10
11
  @content = content
11
12
  super(err)
@@ -31,7 +31,9 @@ module KubernetesDeploy
31
31
  def build(namespace:, context:, definition:, logger:, statsd_tags:)
32
32
  opts = { namespace: namespace, context: context, definition: definition, logger: logger,
33
33
  statsd_tags: statsd_tags }
34
- if KubernetesDeploy.const_defined?(definition["kind"])
34
+ if definition["kind"].blank?
35
+ raise InvalidTemplateError.new("Template missing 'Kind'", content: definition.to_yaml)
36
+ elsif KubernetesDeploy.const_defined?(definition["kind"])
35
37
  klass = KubernetesDeploy.const_get(definition["kind"])
36
38
  klass.new(**opts)
37
39
  else
@@ -18,7 +18,7 @@ module KubernetesDeploy
18
18
 
19
19
  def deploy_succeeded?
20
20
  return false unless exists?
21
- rollout_data["desiredNumberScheduled"].to_i == rollout_data["currentNumberScheduled"].to_i &&
21
+ rollout_data["desiredNumberScheduled"].to_i == rollout_data["updatedNumberScheduled"].to_i &&
22
22
  rollout_data["desiredNumberScheduled"].to_i == rollout_data["numberReady"].to_i &&
23
23
  current_generation == observed_generation
24
24
  end
@@ -48,7 +48,7 @@ module KubernetesDeploy
48
48
  def rollout_data
49
49
  return { "currentNumberScheduled" => 0 } unless exists?
50
50
  @instance_data["status"]
51
- .slice("currentNumberScheduled", "desiredNumberScheduled", "numberReady")
51
+ .slice("updatedNumberScheduled", "desiredNumberScheduled", "numberReady")
52
52
  end
53
53
 
54
54
  def parent_of_pod?(pod_data)
@@ -74,6 +74,7 @@ module KubernetesDeploy
74
74
  end
75
75
 
76
76
  def deploy_timed_out?
77
+ return false if deploy_failed?
77
78
  # Do not use the hard timeout if progress deadline is set
78
79
  progress_condition.present? ? deploy_failing_to_progress? : super
79
80
  end
@@ -131,11 +131,11 @@ module KubernetesDeploy
131
131
 
132
132
  def patch_kubeclient_deployments(deployments)
133
133
  deployments.each do |record|
134
- response = patch_deployment_with_restart(record)
135
- if HTTP_OK_RANGE.cover?(response.code)
134
+ begin
135
+ patch_deployment_with_restart(record)
136
136
  @logger.info "Triggered `#{record.metadata.name}` restart"
137
- else
138
- raise RestartAPIError.new(record.metadata.name, response)
137
+ rescue Kubeclient::ResourceNotFoundError, Kubeclient::HttpError => e
138
+ raise RestartAPIError.new(record.metadata.name, e.message)
139
139
  end
140
140
  end
141
141
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module KubernetesDeploy
3
- VERSION = "0.20.0"
3
+ VERSION = "0.20.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Verey
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-04-18 00:00:00.000000000 Z
12
+ date: 2018-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -31,28 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '2.4'
34
+ version: '3.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '2.4'
42
- - !ruby/object:Gem::Dependency
43
- name: rest-client
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '1.7'
49
- type: :runtime
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '1.7'
41
+ version: '3.0'
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: googleauth
58
44
  requirement: !ruby/object:Gem::Requirement