diff --git a/controllers/dnspolicy_controller_single_cluster_test.go b/controllers/dnspolicy_controller_single_cluster_test.go index 0e14adee4..e636f749c 100644 --- a/controllers/dnspolicy_controller_single_cluster_test.go +++ b/controllers/dnspolicy_controller_single_cluster_test.go @@ -137,7 +137,7 @@ var _ = Describe("DNSPolicy Single Cluster", func() { g.Expect(dnsPolicy.Status.Conditions).To( ContainElement(MatchFields(IgnoreExtras, Fields{ "Type": Equal(string(kuadrant.PolicyConditionEnforced)), - "Status": Equal(metav1.ConditionFalse), + "Status": Equal(metav1.ConditionTrue), "Reason": Equal(string(kuadrant.PolicyReasonEnforced)), "Message": Equal("DNSPolicy has been partially enforced"), })), diff --git a/controllers/dnspolicy_controller_test.go b/controllers/dnspolicy_controller_test.go index 07ae37d14..ea095d8ef 100644 --- a/controllers/dnspolicy_controller_test.go +++ b/controllers/dnspolicy_controller_test.go @@ -344,7 +344,7 @@ var _ = Describe("DNSPolicy controller", func() { }), MatchFields(IgnoreExtras, Fields{ "Type": Equal(string(kuadrant.PolicyConditionEnforced)), - "Status": Equal(metav1.ConditionFalse), + "Status": Equal(metav1.ConditionTrue), "Reason": Equal(string(kuadrant.PolicyReasonEnforced)), "Message": Equal("DNSPolicy has been partially enforced"), })), diff --git a/controllers/dnspolicy_status.go b/controllers/dnspolicy_status.go index 8ccc1f825..cf45ae594 100644 --- a/controllers/dnspolicy_status.go +++ b/controllers/dnspolicy_status.go @@ -124,7 +124,7 @@ func (r *DNSPolicyReconciler) enforcedCondition(recordsList *kuadrantdnsv1alpha1 } } - // at least one DNS record is controlled byt the policy + // at least one DNS record is controlled by the policy // and all controlled records are accepted if controlled { return kuadrant.EnforcedCondition(dnsPolicy, nil, true) diff --git a/pkg/library/kuadrant/apimachinery_status_conditions.go b/pkg/library/kuadrant/apimachinery_status_conditions.go index b6d8e8065..fb0822ac5 100644 --- a/pkg/library/kuadrant/apimachinery_status_conditions.go +++ b/pkg/library/kuadrant/apimachinery_status_conditions.go @@ -107,14 +107,12 @@ func AcceptedCondition(p Policy, err error) *metav1.Condition { func EnforcedCondition(policy Policy, err PolicyError, allSubresourcesReady bool) *metav1.Condition { // Enforced message := fmt.Sprintf("%s has been successfully enforced", policy.Kind()) - status := metav1.ConditionTrue if !allSubresourcesReady { message = fmt.Sprintf("%s has been partially enforced", policy.Kind()) - status = metav1.ConditionFalse } cond := &metav1.Condition{ Type: string(PolicyConditionEnforced), - Status: status, + Status: metav1.ConditionTrue, Reason: string(PolicyReasonEnforced), Message: message, }