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

Partially Enforced sets Enforced status to true #679

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/dnspolicy_controller_single_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
})),
Expand Down
2 changes: 1 addition & 1 deletion controllers/dnspolicy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
})),
Expand Down
2 changes: 1 addition & 1 deletion controllers/dnspolicy_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions pkg/library/kuadrant/apimachinery_status_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just the Status is the problem. The rest should stay

Expand Down
Loading