kubernetes-deploy 0.20.5 → 0.20.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +3 -17
- data/kubernetes-deploy.gemspec +1 -1
- data/lib/kubernetes-deploy/deploy_task.rb +4 -0
- data/lib/kubernetes-deploy/kubernetes_resource.rb +11 -0
- data/lib/kubernetes-deploy/kubernetes_resource/bucket.rb +0 -4
- data/lib/kubernetes-deploy/kubernetes_resource/cloudsql.rb +0 -4
- data/lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb +2 -11
- data/lib/kubernetes-deploy/kubernetes_resource/deployment.rb +3 -1
- data/lib/kubernetes-deploy/kubernetes_resource/elasticsearch.rb +0 -4
- data/lib/kubernetes-deploy/kubernetes_resource/memcached.rb +0 -4
- data/lib/kubernetes-deploy/kubernetes_resource/pod_disruption_budget.rb +1 -1
- data/lib/kubernetes-deploy/kubernetes_resource/redis.rb +0 -4
- data/lib/kubernetes-deploy/kubernetes_resource/replica_set.rb +4 -1
- data/lib/kubernetes-deploy/kubernetes_resource/stateful_set.rb +3 -1
- data/lib/kubernetes-deploy/kubernetes_resource/statefulservice.rb +0 -4
- data/lib/kubernetes-deploy/kubernetes_resource/topic.rb +0 -4
- data/lib/kubernetes-deploy/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4739131c95e48be2df66d1ca820fc63fa92a0f
|
4
|
+
data.tar.gz: ef6afd733102c00d3ac9b42571da84a1edde0970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a025aaf9b1e4cb4689e8ad0e4101502f460146f5dbe36ed1da096a5b53679e24cf75dbb5f84cbe1ec0b739988a0eafebe20237c69a51614d130b551b8456fbfa
|
7
|
+
data.tar.gz: 4364997f2d82b1b80530ba1c5c52797dd009e5a6ab882570df0937479200cd17099fb8ac9d99527bc98dd0dfa4b8859ca6a9bd4e075d25d2fe055c32ea0fd40c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
### Master
|
2
2
|
|
3
|
+
*Enhancements*
|
4
|
+
|
5
|
+
## 0.20.6
|
6
|
+
|
7
|
+
*Enhancements*
|
8
|
+
- All resources marked as prunable will now be added to the prune whitelist ([#326](https://github.com/Shopify/kubernetes-deploy/pull/326))
|
9
|
+
- Improve deploy status detection by ensuring we examine the correct generation ([#325](https://github.com/Shopify/kubernetes-deploy/pull/325))
|
10
|
+
|
11
|
+
*Bug Fixes*
|
12
|
+
|
13
|
+
## 0.20.5
|
3
14
|
*Enhancements*
|
4
15
|
- Add Job resource class ([#295](https://github.com/Shopify/kubernetes-deploy/pull/296))
|
5
16
|
- Add CustomResourceDefinition resource class ([#306](https://github.com/Shopify/kubernetes-deploy/pull/306))
|
@@ -9,6 +20,9 @@ being tracked ([#316](https://github.com/Shopify/kubernetes-deploy/pull/316))
|
|
9
20
|
- Allow CRs to be pruned based on `kubernetes-deploy.shopify.io/prunable` annotation on the custom resource definitions ([312](https://github.com/Shopify/kubernetes-deploy/pull/312))
|
10
21
|
- Add HorizontalPodAutoscaler resource class ([#305](https://github.com/Shopify/kubernetes-deploy/pull/305))
|
11
22
|
|
23
|
+
*Bug Fixes*
|
24
|
+
- Prevent crash when STATSD_IMPLEMENTATION isn't set. ([#3242](https://github.com/Shopify/kubernetes-deploy/pull/324))
|
25
|
+
|
12
26
|
### 0.20.4
|
13
27
|
*Enhancements*
|
14
28
|
- Don't consider pod preempting a failure ([#317](https://github.com/shopify/kubernetes-deploy/pull/317))
|
data/README.md
CHANGED
@@ -180,7 +180,7 @@ Both `.yaml.erb` and `.yml.erb` file extensions are supported. Templates must re
|
|
180
180
|
|
181
181
|
##### Limitations when using partials
|
182
182
|
|
183
|
-
Partials can be included almost everywhere in ERB templates
|
183
|
+
Partials can be included almost everywhere in ERB templates. Note: when using a partial to insert additional key-value pairs to a map you must use [YAML merge keys](http://yaml.org/type/merge.html). For example, given a partial `p` defining two fields 'a' and 'b',
|
184
184
|
|
185
185
|
```yaml
|
186
186
|
a: 1
|
@@ -205,22 +205,8 @@ b: 2
|
|
205
205
|
but you can do:
|
206
206
|
|
207
207
|
```yaml
|
208
|
-
|
209
|
-
|
210
|
-
```
|
211
|
-
|
212
|
-
or even
|
213
|
-
|
214
|
-
```yaml
|
215
|
-
x: <%= partial 'p' %>
|
216
|
-
```
|
217
|
-
|
218
|
-
which both will result in
|
219
|
-
|
220
|
-
```yaml
|
221
|
-
x:
|
222
|
-
a: 1
|
223
|
-
b: 2
|
208
|
+
<<: <%= partial 'p' %>
|
209
|
+
x: yz
|
224
210
|
```
|
225
211
|
|
226
212
|
This is a limitation of the current implementation.
|
data/kubernetes-deploy.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency "activesupport", ">= 5.0"
|
27
27
|
spec.add_dependency "kubeclient", "~> 3.0"
|
28
28
|
spec.add_dependency "googleauth", "= 0.6.2" # https://github.com/google/google-auth-library-ruby/issues/153
|
29
|
-
spec.add_dependency "ejson", "1.0
|
29
|
+
spec.add_dependency "ejson", "~> 1.0"
|
30
30
|
spec.add_dependency "colorize", "~> 0.8"
|
31
31
|
spec.add_dependency "statsd-instrument", "~> 2.2"
|
32
32
|
|
@@ -82,6 +82,7 @@ module KubernetesDeploy
|
|
82
82
|
extensions/v1beta1/Ingress
|
83
83
|
apps/v1beta1/StatefulSet
|
84
84
|
autoscaling/v1/HorizontalPodAutoscaler
|
85
|
+
policy/v1beta1/PodDisruptionBudget
|
85
86
|
)
|
86
87
|
if server_version >= Gem::Version.new('1.8.0')
|
87
88
|
wl << "batch/v1beta1/CronJob"
|
@@ -359,6 +360,9 @@ module KubernetesDeploy
|
|
359
360
|
|
360
361
|
# Apply can be done in one large batch, the rest have to be done individually
|
361
362
|
applyables, individuals = resources.partition { |r| r.deploy_method == :apply }
|
363
|
+
# Prunable resources should also applied so that they can be pruned
|
364
|
+
pruneable_types = prune_whitelist.map { |t| t.split("/").last }
|
365
|
+
applyables += individuals.select { |r| pruneable_types.include?(r.type) }
|
362
366
|
|
363
367
|
individuals.each do |r|
|
364
368
|
@logger.info("- #{r.id} (#{r.pretty_timeout_type})") if resources.length > 1
|
@@ -139,6 +139,17 @@ module KubernetesDeploy
|
|
139
139
|
@instance_data.present?
|
140
140
|
end
|
141
141
|
|
142
|
+
def current_generation
|
143
|
+
return -1 unless exists? # must be different default than observed_generation
|
144
|
+
@instance_data["metadata"]["generation"]
|
145
|
+
end
|
146
|
+
|
147
|
+
def observed_generation
|
148
|
+
return -2 unless exists?
|
149
|
+
# populating this is a best practice, but not all controllers actually do it
|
150
|
+
@instance_data["status"]["observedGeneration"]
|
151
|
+
end
|
152
|
+
|
142
153
|
def status
|
143
154
|
exists? ? "Exists" : "Unknown"
|
144
155
|
end
|
@@ -24,7 +24,8 @@ module KubernetesDeploy
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def deploy_failed?
|
27
|
-
pods.present? && pods.any?(&:deploy_failed?)
|
27
|
+
pods.present? && pods.any?(&:deploy_failed?) &&
|
28
|
+
observed_generation == current_generation
|
28
29
|
end
|
29
30
|
|
30
31
|
def fetch_logs(kubectl)
|
@@ -35,16 +36,6 @@ module KubernetesDeploy
|
|
35
36
|
|
36
37
|
private
|
37
38
|
|
38
|
-
def current_generation
|
39
|
-
return -1 unless exists? # must be different default than observed_generation
|
40
|
-
@instance_data["metadata"]["generation"]
|
41
|
-
end
|
42
|
-
|
43
|
-
def observed_generation
|
44
|
-
return -2 unless exists?
|
45
|
-
@instance_data["status"]["observedGeneration"]
|
46
|
-
end
|
47
|
-
|
48
39
|
def rollout_data
|
49
40
|
return { "currentNumberScheduled" => 0 } unless exists?
|
50
41
|
@instance_data["status"]
|
@@ -31,6 +31,7 @@ module KubernetesDeploy
|
|
31
31
|
|
32
32
|
def deploy_succeeded?
|
33
33
|
return false unless exists? && @latest_rs.present?
|
34
|
+
return false unless observed_generation == current_generation
|
34
35
|
|
35
36
|
if required_rollout == 'full'
|
36
37
|
@latest_rs.deploy_succeeded? &&
|
@@ -51,7 +52,8 @@ module KubernetesDeploy
|
|
51
52
|
end
|
52
53
|
|
53
54
|
def deploy_failed?
|
54
|
-
@latest_rs&.deploy_failed?
|
55
|
+
@latest_rs&.deploy_failed? &&
|
56
|
+
observed_generation == current_generation
|
55
57
|
end
|
56
58
|
|
57
59
|
def failure_message
|
@@ -26,12 +26,15 @@ module KubernetesDeploy
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def deploy_succeeded?
|
29
|
+
observed_generation == current_generation &&
|
29
30
|
desired_replicas == rollout_data["availableReplicas"].to_i &&
|
30
31
|
desired_replicas == rollout_data["readyReplicas"].to_i
|
31
32
|
end
|
32
33
|
|
33
34
|
def deploy_failed?
|
34
|
-
pods.present? &&
|
35
|
+
pods.present? &&
|
36
|
+
pods.all?(&:deploy_failed?) &&
|
37
|
+
observed_generation == current_generation
|
35
38
|
end
|
36
39
|
|
37
40
|
def desired_replicas
|
@@ -30,6 +30,7 @@ module KubernetesDeploy
|
|
30
30
|
end
|
31
31
|
true
|
32
32
|
else
|
33
|
+
observed_generation == current_generation &&
|
33
34
|
status_data['currentRevision'] == status_data['updateRevision'] &&
|
34
35
|
desired_replicas == status_data['readyReplicas'].to_i &&
|
35
36
|
desired_replicas == status_data['currentReplicas'].to_i
|
@@ -38,7 +39,8 @@ module KubernetesDeploy
|
|
38
39
|
|
39
40
|
def deploy_failed?
|
40
41
|
return false if update_strategy == ONDELETE
|
41
|
-
pods.present? && pods.any?(&:deploy_failed?)
|
42
|
+
pods.present? && pods.any?(&:deploy_failed?) &&
|
43
|
+
observed_generation == current_generation
|
42
44
|
end
|
43
45
|
|
44
46
|
private
|
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.
|
4
|
+
version: 0.20.6
|
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-
|
12
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -57,16 +57,16 @@ dependencies:
|
|
57
57
|
name: ejson
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.0
|
62
|
+
version: '1.0'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.0
|
69
|
+
version: '1.0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: colorize
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|