Import MutatingAdmissionPolicies from Calico#4457
Import MutatingAdmissionPolicies from Calico#4457caseydavenport wants to merge 11 commits intotigera:masterfrom
Conversation
40c2363 to
c70dc0e
Compare
| os.Exit(1) | ||
| } | ||
|
|
||
| if err := admission.Ensure(mgr.GetClient(), variant, v3CRDs, setupLog); err != nil { |
There was a problem hiding this comment.
Wouldn't it be more obvious if we didn't pass the v3CRDs into this function and the one above and just call the appropriate one depending on its value?
There was a problem hiding this comment.
But maybe not including that condition at this level pushes the context down a level, maybe that is better?
There was a problem hiding this comment.
Yeah, I had the same back and forth. I think I like it better pushing the context inside the Ensure function to keep that complexity out of main?
| return false | ||
| } | ||
|
|
||
| // ProvidesMutatingAdmissionPolicyV1Beta1 returns if admissionregistration.k8s.io/v1beta1 MutatingAdmissionPolicy |
There was a problem hiding this comment.
Should there be a call to this in main also?
There was a problem hiding this comment.
Yeah, perhaps - right now, if the cluster doesn't support it, the operator will skip MAPs and then get to the core controller where it will set degraded.
If we did this check in main, what would the desired behavior be in the case of failure? Just logging an error? Or exiting?
Description
When using v3 CRDs, we need to manage MutatingAdmissionPolicies. These files live in the Calico repository alongside CRDs, so we should import them in much the same way.
This refactors the codebase to include a new
pkg/imports/crdsandpkg/imports/admissioninstead of a singularpkg/crds, and adds thenecessary logic to the operator to manage these new objects.
Release Note
For PR author
make gen-filesmake gen-versionsFor PR reviewers
A note for code reviewers - all pull requests must have the following:
kind/bugif this is a bugfix.kind/enhancementif this is a a new feature.enterpriseif this PR applies to Calico Enterprise only.