-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: ur not cleaned up when deleting namespaced policy #17
base: develop
Are you sure you want to change the base?
Conversation
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.
don't we need to add any unit test for this?
1fbb596
to
8748a78
Compare
0d69c9f
to
7f2bd21
Compare
logger.V(4).Info("deleting policy", "name", p.Name) | ||
key, err := cache.MetaNamespaceKeyFunc(kubeutils.GetObjectWithTombstone(obj)) | ||
if err != nil { | ||
logger.Error(err, "failed to load policy key") |
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.
can we put a return
here, so that rest of the code can come out of else block?
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.
Done.
@@ -370,6 +370,50 @@ func (c *controller) deletePolicy(obj interface{}) { | |||
} | |||
} | |||
|
|||
func (c *controller) deleteNSPolicy(obj interface{}) { |
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.
It will be good if we can write unit tests for deleteNSPolicy function?
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.
Unit test cant be added for this function. i tried with fake client as well.
7f2bd21
to
3d28050
Compare
d269b5e
to
3dc454a
Compare
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
Closes kyverno#5187 The test command was resetting the return value to "pass", even if it was already marked failed, in some cases. This solves by moving the "pass" into an else-if clause. Signed-off-by: Eric Miller <[email protected]> Signed-off-by: Eric Miller <[email protected]> Co-authored-by: Vyankatesh Kudtarkar <[email protected]> Co-authored-by: shuting <[email protected]>
* Adds tests for fixes in kyverno#4767 Signed-off-by: Tobias Dahlberg <[email protected]> Signed-off-by: Tobias Dahlberg <[email protected]> Co-authored-by: shuting <[email protected]>
Signed-off-by: Sandesh More <[email protected]>
3dc454a
to
5c8e78e
Compare
Signed-off-by: Sandesh More [email protected]
Explanation
Currently same handler function is used in both
ClusterPolicy
andPolicy
deletion, due to which a type error prevents clean up of UR while policy deletion.Related issue
closes: 5101
Milestone of this PR
What type of PR is this
bug
Proposed Changes
Added seperate handler for Namespaced Policy deletion which takes care of UR clean up.
Proof Manifests
$ k -n poltest create secret generic noodles --from-literal=foo=bar
$ k -n poltest delete pol pol-sync-data
$ k -n kyverno get ur
Checklist
Further Comments