Apply the libcalico-go write defaults in the CRD schemas - #13872
Open
caseydavenport wants to merge 5 commits into
Open
Apply the libcalico-go write defaults in the CRD schemas#13872caseydavenport wants to merge 5 commits into
caseydavenport wants to merge 5 commits into
Conversation
Native CRD writes bypass libcalico-go, so the schemas carry the IP pool, Felix and kube-controllers defaults it applies on write. blockSize takes a MutatingAdmissionPolicy instead, since the value depends on whether the CIDR is v4 or v6. Found during the v3.33 test cycle, Zephyr OS-R233. CORE-13651
The immutability rule is a CEL transition rule, so it does not fire when the field is absent from the incoming object. Defaulting on update means a write that omits blockSize gets the stored value back rather than zero. CORE-13651
A static schema default also lands on pools that set a namespaceSelector, which the schema then rejects for combining a namespaceSelector with Tunnel. The policy defaults those pools to Workload alone. CORE-13651
Contributor
CI triage — CalicoRecommendation: Re-run CI before merging — PR probably not at fault, but tests did not execute Unrelated failures
workflow_id: 9f07d500-b69e-461b-a509-7b699fe43d3a |
Kubernetes 1.32 has no MutatingAdmissionPolicy, so the schema-defaults test cannot expect a value the policy supplies. CORE-13651
The test compares the stored object against the one it wrote, so every field the schema defaults has to be in the input. CORE-13651
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.
Description
Resources written through the native
projectcalico.org/v3CRDs were stored without the field defaults the aggregated API server used to persist, so a rawkubectlor GitOps reader saw empty values where the docs promise otherwise. Calico's own components were unaffected, since libcalico-go applies the same defaults on read.ipipMode,vxlanModeandallowedUsesnow take CRD schema defaults, matching what libcalico-go writes.floatingIPs,bpfConnectTimeLoadBalancingandbpfHostNetworkedNATWithoutCTLB. These sit at the lowest-precedence config source, below environment variables, and the values match Felix's own built-in defaults.prometheusMetricsPortdefaults to 9094 rather than reading as 0, which meant metrics disabled.blockSizetakes a MutatingAdmissionPolicy rather than a schema default, since IPv4 wants 26 and IPv6 wants 122. It defaults on update as well as create, because the immutability rule is a CEL transition rule that cannot fire on an absent field, so a write omittingblockSizecould otherwise clear it.The defaults land on the v1
crd.projectcalico.orgCRDs as well, since both sets generate from the same Go types. Aggregated-mode writes already persisted these values, and the v1/v3 consistency check still passes.Found during the v3.33 test cycle, Zephyr OS-R233.
Related: CORE-13651
Release note:
AI assistance: Claude Code
By opening this PR you take responsibility for every line in it, and you agree to explain the change yourself during review rather than routing review comments back through an agent. See AI_POLICY.md.