Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate progress condition after progress deadline seconds have passed #765

Merged
merged 7 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/krane/kubernetes_resource/deployment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def rollout_annotation_err_msg

def deploy_failing_to_progress?
return false unless progress_condition.present?
# Ensure at least progress_deadline wall clock time has passed before before examining progress_condition
return false if deploy_started? && Time.now.utc - @deploy_started_at < progress_deadline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a comment here, since the deploy is indeed failing to progress, we're just ignoring that for now :)


# This assumes that when the controller bumps the observed generation, it also updates/clears all the status
# conditions. Specifically, it assumes the progress condition is immediately set to True if a rollout is starting.
Expand Down
5 changes: 3 additions & 2 deletions test/unit/krane/kubernetes_resource/deployment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ def test_deploy_timed_out_based_on_progress_deadline
replica_sets: [build_rs_template(status: { "replica" => 1 })]
)
refute(deploy.deploy_timed_out?, "Deploy not started shouldn't have timed out")

deploy.deploy_started_at = Time.now.utc
refute(deploy.deploy_timed_out?, "Deploy should not fail until after progress deadline seconds passed")
deploy.deploy_started_at = Time.now.utc - 3.minutes
assert(deploy.deploy_timed_out?)
assert_equal("Timeout reason: ProgressDeadlineExceeded\nLatest ReplicaSet: web-1", deploy.timeout_message.strip)
Expand Down Expand Up @@ -327,7 +328,7 @@ def test_deploy_timed_out_based_on_timeout_override
deploy.deploy_started_at = Time.now.utc - 11.seconds
refute(deploy.deploy_timed_out?, "Deploy should not timeout based on progressDeadlineSeconds")
deploy.deploy_started_at = Time.now.utc - 16.seconds
assert(deploy.deploy_timed_out?, "Deploy should timeout according to timoeout override")
assert(deploy.deploy_timed_out?, "Deploy should timeout according to timeout override")
assert_equal(Krane::KubernetesResource::STANDARD_TIMEOUT_MESSAGE + "\nLatest ReplicaSet: web-1",
deploy.timeout_message.strip)
assert_equal(deploy.pretty_timeout_type, "timeout override: 15s")
Expand Down