feat: expose reinvocationPolicy on kubernetesMutating bindings - #932
Open
marxus wants to merge 1 commit into
Open
feat: expose reinvocationPolicy on kubernetesMutating bindings#932marxus wants to merge 1 commit into
marxus wants to merge 1 commit into
Conversation
Wire the ReinvocationPolicy field from MutatingWebhook through hook config: add an optional `reinvocationPolicy: Never|IfNeeded` knob to kubernetesMutating entries, mirror it into the v1.MutatingWebhook spec, and add the enum to the schema. Unset stays nil so the API server owns the default. The schema restricts the field to kubernetesMutating; the equivalent knob does not exist on validating webhooks (they run once, after all mutations), and additionalProperties already rejects it on kubernetesValidating. Signed-off-by: Amit Marcus <marxus@gmail.com>
marxus
force-pushed
the
feat/mutating-webhook-reinvocation-policy
branch
from
September 8, 2026 09:03
d637224 to
fe2835a
Compare
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.
Overview
Wire
reinvocationPolicyfromadmissionregistration.k8s.io/v1 MutatingWebhookthrough hook config, so hook authors can opt intoIfNeededwhen their mutation depends on the object state after other mutators run.What this PR does / why we need it
PR #439 landed mutating-webhook support but did not surface the
reinvocationPolicyknob. Without it, every mutating hook registered via shell-operator gets the API server default (Never), and there's no config-level way to change that — you'd have to hand-patch the generatedMutatingWebhookConfiguration.This adds an optional
reinvocationPolicy: Never|IfNeededfield onkubernetesMutatingentries and maps it intov1.MutatingWebhook.ReinvocationPolicy. When unset the field stays nil, so the API server keeps owning the default (no behavior change for existing hooks).Example:
Changes:
pkg/hook/config/config_v1.go— newReinvocationPolicy *v1.ReinvocationPolicyTypeonKubernetesAdmissionConfigV1; passed through inconvertMutating.pkg/hook/config/schemas.go—reinvocationPolicyenum added underkubernetesMutatingonly. The knob does not exist onValidatingWebhook(validating webhooks run once, after all mutations), andadditionalProperties: falsealready rejects it onkubernetesValidating.pkg/hook/config/config_test.go— three cases: pass-through (IfNeededand unset), invalid enum rejected, and rejection onkubernetesValidating.Docs are not touched — there is no
BINDING_MUTATING.mdin the repo yet (the mutating example already references a missing file); that gap is out of scope here.Does this PR introduce a user-facing change?