-
Notifications
You must be signed in to change notification settings - Fork 127
Apply PolicyAffected status for target refs #3535
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3535 +/- ##
==========================================
+ Coverage 86.82% 86.84% +0.02%
==========================================
Files 127 127
Lines 15079 15154 +75
Branches 62 62
==========================================
+ Hits 13092 13161 +69
- Misses 1836 1841 +5
- Partials 151 152 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bed6023
to
fb9cf54
Compare
fb9cf54
to
e3bd76e
Compare
@salonichf5 I see in the issue |
if conditionsList == nil { | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have to worry about this case? Will the conditionsList ever be nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of minor suggestions, otherwise looks good, great work!
@@ -185,6 +197,33 @@ func ConvertConditions( | |||
return apiConds | |||
} | |||
|
|||
// HasMatchingCondition checks if the given condition matches any of the existing conditions. | |||
func HasMatchingCondition(existingConditions []Condition, cond Condition) bool { | |||
condMap := make(map[Condition]struct{}, len(existingConditions)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because existingConditions
is unlikely to be very long, do we think this could be updated to use a simple iteration instead? e.g. something like
for _, existing := range existingConditions {
if existing.Type == cond.Type &&
existing.Status == cond.Status &&
existing.Reason == cond.Reason &&
existing.Message == cond.Message {
return true
}
}
return false
@@ -105,3 +105,43 @@ func TestConvertConditions(t *testing.T) { | |||
result := ConvertConditions(conds, generation, time) | |||
g.Expect(result).Should(Equal(expected)) | |||
} | |||
|
|||
func TestHasMatchingConding(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestHasMatchingConding(t *testing.T) { | |
func TestHasMatchingCondition(t *testing.T) { |
@@ -448,3 +448,60 @@ func refGroupKind(group v1.Group, kind v1.Kind) string { | |||
|
|||
return fmt.Sprintf("%s/%s", group, kind) | |||
} | |||
|
|||
// addPolicyAffectedStatusToTargetRefs adds the policyAffected status to the target references | |||
// of ClientSetttingsPolicies and ObservabilityPolicies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// of ClientSetttingsPolicies and ObservabilityPolicies. | |
// of ClientSettingsPolicies and ObservabilityPolicies. |
Proposed changes
Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:
Problem: As a user I would like to know which target refs are affected by ClientSettingsPolicy or ObservabilityPolicy
Solution: Adds new conditions
NewObservabilityPolicyAffected
andNewClientSettingsPolicyAffected
Testing: Manual testing
Apply
ObservabilityPolicy
andClientSettingsPolicy
totargetRefs
targetRefs
conditions list.targetRefs
conditions list -- Status is removed from the resources (Gateways, HTTPRoute, GRPCRoute)ClientSettingsPolicy for Gateway, HTTPRoutes and GRPCRoutes
policyAffected
was removed from the resources.ObservabilityPolicy for HTTPRoutes and GRPCRoutes
Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.
Closes #1761
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.