-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add KDP - Mutate Existing Resources #4
Conversation
Signed-off-by: ShutingZhao <[email protected]>
What I don't see here is a pseudo policy on the background mutation use case (i.e., where there is no triggering resource). I think that's the primary use case for background mutation here. Couple suggestions on that:
|
Signed-off-by: ShutingZhao <[email protected]>
Signed-off-by: ShutingZhao <[email protected]>
@chipzoller - sorry I missed your comments. For some reason the notification goes into spam :( To answer your questions:
1.1. ""new" resources which can be mutated" - can be defined in 1.2. ""old" resources which should be mutated (those which already exist)" - I assume old and new resources are the same in this case? If so, such use cases can be addressed by example 3, when the policy is installed, Kyverno will mutate existing resources.
Good point! I've added it in the requirement. |
Signed-off-by: ShutingZhao <[email protected]>
But doesn't
I think there needs to be a clear way to distinguish between the two. There are three permutations here:
|
The existing mutate policy can support this.
2.1 "new" and "old" are the same - example 3, setting 2.2 "new" and "old" are different - example 1 or 2
Good point, we can let the user set |
Signed-off-by: ShutingZhao <[email protected]>
I went back and studied this a bit more and will add more thoughts and comments. I identify three use cases for this enhancement. Let me know if these sound right:
Should we provide for distinction between use cases 1 and 2? Use case for 1 is a one-time mutation whereas use case for 2 is a continual mutation, similar to a generate rule with Also at least one use case that we might want to call as out of scope:
Couple additions I thought of we should consider:
|
Signed-off-by: ShutingZhao <[email protected]>
Just a clarification of the current proposal, there's no support as of now to mutate resources once. Like the existing mutate policies, resources will be mutated whenever there's an admission operation. The only difference with this feature is that the trigger can be from two sources:
If one-time mutation is something we want to support, we can extend this flag |
This is an interesting use case, I'm not sure if the previous state is stored and we can use that for rolling back since mutation happens during admission review. Do you know if
Yes, will support.
Good catch, will need to check this during implementation. |
Signed-off-by: ShutingZhao <[email protected]>
Signed-off-by: ShutingZhao <[email protected]>
Signed-off-by: ShutingZhao <[email protected]>
Signed-off-by: ShutingZhao <[email protected]>
I've updated Can we merge this @prateekpandey14 @chipzoller @JimBugwadia ? |
I think so. I have resolved my comments. |
@prateekpandey14 @JimBugwadia - needs another approval :) |
I don't follow....if the user wants to apply the rule on existing resources in the cluster, will we not apply it as a background operation when the rule is created or modified? |
As stated here: This feature is can be triggered from two sources:
The "policy events" means when a policy/rule is added/updated/removed. |
@realshuting what do we do with this now it's implemented yet the PR was never merged? Do we merge for posterity's sake or close? |
I'll update to the current implementation today and we can then merge. |
Signed-off-by: ShutingZhao <[email protected]>
@chipzoller - I have updated the KDP to reflect the current implementation. |
Needs second review by @JimBugwadia |
Signed-off-by: ShutingZhao [email protected]
This KDP addresses: