fix: surface namespace cache errors and avoid redundant VAP status updates (CP #4656, CP #4703) - #4795
Merged
JaydipGabani merged 2 commits intoAug 27, 2026
Conversation
…-agent#4656) Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@gmail.com> Co-authored-by: Jaydip Gabani <gabanijaydip@gmail.com> (cherry picked from commit 68079d0)
Signed-off-by: Jaydip Gabani <gabanijaydip@gmail.com> (cherry picked from commit 6f898fe)
Contributor
There was a problem hiding this comment.
Pull request overview
Backports fixes for namespace cache diagnostics and redundant VAP/VAPB status writes.
Changes:
- Wraps underlying namespace conversion errors.
- Persists controller status only when semantically changed.
- Improves VAP eligibility handling and related tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pkg/target/ns_cache.go |
Surfaces namespace conversion errors. |
pkg/controller/constrainttemplate/constrainttemplate_controller.go |
Deduplicates template status writes. |
pkg/controller/constrainttemplate/constrainttemplate_controller_test.go |
Tests template status persistence. |
pkg/controller/constraint/constraint_controller.go |
Deduplicates constraint status writes and refines VAPB handling. |
pkg/controller/constraint/constraint_controller_test.go |
Adds VAPB status regression coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+670
to
+679
| case err != nil: | ||
| log.Error(err, "could not determine if ConstraintTemplate is configured to generate ValidatingAdmissionPolicy", "constraint", instance.GetName(), "constraint_template", unversionedCT.GetName()) | ||
| r.reporter.ReportVAPBStatus(vapBindingKey, metrics.VAPStatusError) | ||
| status.Status.Errors = append(status.Status.Errors, constraintstatusv1beta1.Error{Message: fmt.Sprintf("could not determine if ConstraintTemplate is configured to generate ValidatingAdmissionPolicy: %s", err)}) | ||
| shouldGenerateVAPB = false | ||
| case !hasVAP: | ||
| log.Error(ErrVAPConditionsNotSatisfied, "Cannot generate ValidatingAdmissionPolicyBinding", "constraint", instance.GetName(), "constraint_template", unversionedCT.GetName()) | ||
| r.reporter.ReportVAPBStatus(vapBindingKey, metrics.VAPStatusError) | ||
| status.Status.Errors = append(status.Status.Errors, constraintstatusv1beta1.Error{Message: fmt.Sprintf("cannot generate ValidatingAdmissionPolicyBinding: %s", ErrVAPConditionsNotSatisfied)}) | ||
| shouldGenerateVAPB = false |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-3.23 #4795 +/- ##
===============================================
Coverage ? 45.47%
===============================================
Files ? 284
Lines ? 21104
Branches ? 0
===============================================
Hits ? 9596
Misses ? 10695
Partials ? 813
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JaydipGabani
approved these changes
Aug 27, 2026
JaydipGabani
merged commit Aug 27, 2026
00eab8b
into
open-policy-agent:release-3.23
22 of 24 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
(cherry picked from commit 68079d0)
(cherry picked from commit 6f898fe)
Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when the PR gets merged):Fixes #
Special notes for your reviewer: