Skip to content

Commit 7b86b91

Browse files
committed
Version 3.8.1
1 parent de30560 commit 7b86b91

4 files changed

Lines changed: 20 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## next
22

3+
## 3.8.1
4+
5+
- check if observedGeneration is present before comparing with generation for custom resources
6+
37
## 3.8.0
48

59
- Add Elasticsearch resource to the black list so it is not marked for deletion

lib/krane/kubernetes_resource/custom_resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def failure_message
3939
end
4040

4141
def timeout_message
42-
if rollout_conditions && current_generation != observed_generation
42+
if observed_generation.present? && rollout_conditions && current_generation != observed_generation
4343
TIMEOUT_MESSAGE_DIFFERENT_GENERATIONS
4444
else
4545
super

lib/krane/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# frozen_string_literal: true
22
module Krane
3-
VERSION = "3.8.0"
3+
VERSION = "3.8.1"
44
end

test/unit/krane/kubernetes_resource/custom_resource_definition_test.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,20 @@ def test_instance_timeout_annotation
159159
end
160160

161161
def test_instance_timeout_messages_with_rollout_conditions
162+
rollout_conditions = {
163+
success_conditions: [
164+
{
165+
path: "$.status.conditions[?(@.type == 'Ready')].status",
166+
value: "True",
167+
},
168+
],
169+
}.to_json
170+
162171
crd = build_crd(crd_spec.merge(
163172
"metadata" => {
164173
"name" => "unittests.stable.example.io",
165174
"annotations" => {
166-
rollout_conditions_annotation_key => "true",
175+
rollout_conditions_annotation_key => rollout_conditions,
167176
},
168177
},
169178
))
@@ -176,12 +185,12 @@ def test_instance_timeout_messages_with_rollout_conditions
176185
},
177186
})
178187

179-
cr.expects(:current_generation).returns(1)
180-
cr.expects(:observed_generation).returns(1)
188+
cr.expects(:current_generation).at_least_once.returns(1)
189+
cr.expects(:observed_generation).at_least_once.returns(1)
181190
assert_equal(cr.timeout_message, Krane::KubernetesResource::STANDARD_TIMEOUT_MESSAGE)
182191

183-
cr.expects(:current_generation).returns(1)
184-
cr.expects(:observed_generation).returns(2)
192+
cr.expects(:current_generation).at_least_once.returns(1)
193+
cr.expects(:observed_generation).at_least_once.returns(2)
185194
assert_equal(cr.timeout_message, Krane::CustomResource::TIMEOUT_MESSAGE_DIFFERENT_GENERATIONS)
186195
end
187196

0 commit comments

Comments
 (0)