From 1cecb59014beb56cc3e3b468be1525cac1df8d3a Mon Sep 17 00:00:00 2001 From: Edmund Ochieng Date: Tue, 26 Sep 2023 08:37:44 -0500 Subject: [PATCH 1/3] Clean up conditions in tests Signed-off-by: Edmund Ochieng --- .../ansible/controller/status/utils_test.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/ansible/controller/status/utils_test.go b/internal/ansible/controller/status/utils_test.go index 1671dc156d..334f086ced 100644 --- a/internal/ansible/controller/status/utils_test.go +++ b/internal/ansible/controller/status/utils_test.go @@ -96,7 +96,7 @@ func TestGetCondition(t *testing.T) { condType: RunningConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: RunningConditionType, }, }, @@ -110,7 +110,7 @@ func TestGetCondition(t *testing.T) { condType: RunningConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: FailureConditionType, }, }, @@ -122,7 +122,7 @@ func TestGetCondition(t *testing.T) { condType: FailureConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: FailureConditionType, }, }, @@ -136,7 +136,7 @@ func TestGetCondition(t *testing.T) { condType: FailureConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: RunningConditionType, }, }, @@ -167,7 +167,7 @@ func TestRemoveCondition(t *testing.T) { condType: RunningConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: RunningConditionType, }, }, @@ -179,7 +179,7 @@ func TestRemoveCondition(t *testing.T) { condType: RunningConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: FailureConditionType, }, }, @@ -191,7 +191,7 @@ func TestRemoveCondition(t *testing.T) { condType: FailureConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: FailureConditionType, }, }, @@ -203,7 +203,7 @@ func TestRemoveCondition(t *testing.T) { condType: FailureConditionType, status: Status{ Conditions: []Condition{ - Condition{ + { Type: RunningConditionType, }, }, @@ -247,7 +247,7 @@ func TestSetCondition(t *testing.T) { name: "update running condition", status: &Status{ Conditions: []Condition{ - Condition{ + { Type: RunningConditionType, Status: v1.ConditionTrue, Reason: SuccessfulReason, @@ -264,7 +264,7 @@ func TestSetCondition(t *testing.T) { name: "do not update running condition", status: &Status{ Conditions: []Condition{ - Condition{ + { Type: RunningConditionType, Status: v1.ConditionTrue, Reason: RunningReason, From 9ce0b008e6be671fc899655439871cb6a43050e2 Mon Sep 17 00:00:00 2001 From: Edmund Ochieng Date: Tue, 26 Sep 2023 08:38:37 -0500 Subject: [PATCH 2/3] Don't reset previous failure condition during reconcile Don't reset previous failure condition until reconcile completes and custom resource is successfully deployed. Signed-off-by: Edmund Ochieng --- internal/ansible/controller/reconcile.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/internal/ansible/controller/reconcile.go b/internal/ansible/controller/reconcile.go index 362a5d7178..bcf9bb1030 100644 --- a/internal/ansible/controller/reconcile.go +++ b/internal/ansible/controller/reconcile.go @@ -302,11 +302,6 @@ func (r *AnsibleOperatorReconciler) markRunning(ctx context.Context, nn types.Na crStatus := getStatus(u) // If there is no current status add that we are working on this resource. - errCond := ansiblestatus.GetCondition(crStatus, ansiblestatus.FailureConditionType) - if errCond != nil { - errCond.Status = v1.ConditionFalse - ansiblestatus.SetCondition(&crStatus, *errCond) - } successCond := ansiblestatus.GetCondition(crStatus, ansiblestatus.SuccessfulConditionType) if successCond != nil { successCond.Status = v1.ConditionFalse From 1fa0bfa6bf3e7da1e7001765301c8eced2da4103 Mon Sep 17 00:00:00 2001 From: Edmund Ochieng Date: Tue, 26 Sep 2023 09:17:29 -0500 Subject: [PATCH 3/3] Add changelog notes Signed-off-by: Edmund Ochieng --- .../ansible-operator-conditions.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 changelog/fragments/ansible-operator-conditions.yaml diff --git a/changelog/fragments/ansible-operator-conditions.yaml b/changelog/fragments/ansible-operator-conditions.yaml new file mode 100644 index 0000000000..7c01636e98 --- /dev/null +++ b/changelog/fragments/ansible-operator-conditions.yaml @@ -0,0 +1,21 @@ +# entries is a list of entries to include in +# release notes and/or the migration guide +entries: + - description: > + For ansible-based-operators, we will no longer set the status of + the failure condition to `False` when a subsequent reconcile commences. + + The failure condition will however been removed when reconcile is complete + and the custom resource was successfully deployed. + + # kind is one of: + # - addition + # - change + # - deprecation + # - removal + # - bugfix + kind: "change" + + # Is this a breaking change? + breaking: false +