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

Fix DependsOn readiness check #947

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/controller/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ func (r *HelmReleaseReconciler) checkDependencies(ctx context.Context, obj *v2.H
return fmt.Errorf("unable to get '%s' dependency: %w", ref, err)
}

if dHr.Generation != dHr.Status.ObservedGeneration || !conditions.IsTrue(dHr, meta.ReadyCondition) {
if dHr.Generation != conditions.GetObservedGeneration(dHr, meta.ReadyCondition) || !conditions.IsTrue(dHr, meta.ReadyCondition) {
return fmt.Errorf("dependency '%s' is not ready", ref)
}
}
Expand Down
16 changes: 5 additions & 11 deletions internal/controller/helmrelease_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2037,9 +2037,8 @@ func TestHelmReleaseReconciler_checkDependencies(t *testing.T) {
Namespace: "some-namespace",
},
Status: v2.HelmReleaseStatus{
ObservedGeneration: 1,
Conditions: []metav1.Condition{
{Type: meta.ReadyCondition, Status: metav1.ConditionTrue},
{Type: meta.ReadyCondition, Status: metav1.ConditionTrue, ObservedGeneration: 1},
},
},
},
Expand All @@ -2050,9 +2049,8 @@ func TestHelmReleaseReconciler_checkDependencies(t *testing.T) {
Namespace: "some-other-namespace",
},
Status: v2.HelmReleaseStatus{
ObservedGeneration: 2,
Conditions: []metav1.Condition{
{Type: meta.ReadyCondition, Status: metav1.ConditionTrue},
{Type: meta.ReadyCondition, Status: metav1.ConditionTrue, ObservedGeneration: 2},
},
},
},
Expand Down Expand Up @@ -2084,9 +2082,8 @@ func TestHelmReleaseReconciler_checkDependencies(t *testing.T) {
Namespace: "some-namespace",
},
Status: v2.HelmReleaseStatus{
ObservedGeneration: 1,
Conditions: []metav1.Condition{
{Type: meta.ReadyCondition, Status: metav1.ConditionTrue},
{Type: meta.ReadyCondition, Status: metav1.ConditionTrue, ObservedGeneration: 1},
},
},
},
Expand Down Expand Up @@ -2119,9 +2116,8 @@ func TestHelmReleaseReconciler_checkDependencies(t *testing.T) {
Namespace: "some-namespace",
},
Status: v2.HelmReleaseStatus{
ObservedGeneration: 1,
Conditions: []metav1.Condition{
{Type: meta.ReadyCondition, Status: metav1.ConditionFalse},
{Type: meta.ReadyCondition, Status: metav1.ConditionFalse, ObservedGeneration: 1},
},
},
},
Expand Down Expand Up @@ -2153,9 +2149,7 @@ func TestHelmReleaseReconciler_checkDependencies(t *testing.T) {
Name: "dependency-1",
Namespace: "some-namespace",
},
Status: v2.HelmReleaseStatus{
ObservedGeneration: 1,
},
Status: v2.HelmReleaseStatus{},
},
},
expect: func(g *WithT, err error) {
Expand Down