Skip to content

Commit

Permalink
Fix DependsOn readiness check
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Eagan <[email protected]>
  • Loading branch information
seaneagan committed Apr 18, 2024
1 parent 5e760db commit db9dc32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
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

0 comments on commit db9dc32

Please sign in to comment.