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
[k8s] Fix panic in WaitUntilDeploymentAvailable #1330
[k8s] Fix panic in WaitUntilDeploymentAvailable #1330
Conversation
fc83b09
to
2e00fea
Compare
Relevant tests:
Pre-commit hooks: goimports................................................................Passed
Terraform fmt........................................(no files to check)Skipped
test-interfaces-used.....................................................Passed |
dc.Reason == "NewReplicaSetAvailable" { | ||
return true | ||
dc := getDeploymentCondition(deploy, appsv1.DeploymentProgressing) | ||
return dc != nil && dc.Status == v1.ConditionTrue && dc.Reason == "NewReplicaSetAvailable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if it's possible to implement a test case that would generate such a situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which situation are you referring to? The panic?
Won't be possible to reproduce with a real K8s apiserver. However, I just updated the commit to add unit tests.
The `func (err DeploymentNotAvailable) Error()` method should not assume that `Status.Conditions[0]` is always valid for the Deployment. Fixes gruntwork-io#1329 Signed-off-by: Antonin Bas <abas@vmware.com>
2e00fea
to
f689e8c
Compare
Description
Fixes #1329
The
func (err DeploymentNotAvailable) Error()
method should not assume thatStatus.Conditions[0]
is always valid for the Deployment.TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Fixed panic in WaitUntilDeploymentAvailable in the k8s module.
Migration Guide
N/A