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.
fix: validate podspec scheduling syntax on WekaCluster/WekaClient admission (OP-361) #2734
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
Uh oh!
There was an error while loading. Please reload this page.
fix: validate podspec scheduling syntax on WekaCluster/WekaClient admission (OP-361) #2734
Changes from all commits
f7ac4cfFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
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.
Relaxed: Errorhere (and line 20) is defensible — a syntactically invalid podspec can never schedule, so warning about it is pointless. But note the interaction with the grandfathering behaviour:ValidateUpdateshort-circuits only whilespecis byte-identical (wekacluster.go:57), so the first unrelated edit to an existing bad CR (image bump, core count change) gets denied with a toleration/nodeSelector error the user didn't touch in that apply.For a relaxed-posture fleet that's a rollout surprise on operator upgrade. Two mitigations worth considering: ship
Relaxed: Warnfor one release and flip toErrorafter, or make sure the release note explicitly tells relaxed-posture operators to pre-scan existing CRs (the per-policy override inadmissionPoliciesis the escape hatch either way — maybe mention it in the note).Check warning on line 34 in internal/validation/client_podspec_syntax_test.go
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.
The four role tables here (and the mirrored role lists in
cluster_podspec_syntax_test.go:178-179) are hand-maintained. If someone adds anenvoy/dataServicesfield toRoleNodeSelector/RoleAffinity/RoleTopologySpreadConstraintsinweka-k8s-api, that field is silently unvalidated and no test fails — the tests enumerate the same hardcoded list, so they agree with the bug.Cheap guard: a reflection assertion in the test, e.g.
(one per struct). That turns a silent coverage hole into a compile-time-ish failure at the next API bump.
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.
The precedence mirrored here matches the code (
container_factory.go:220-240:Label != nilwins,CompositeLabelsonly in theelse), which is the right thing to mirror. But the published API doc says the opposite —doc/api_dump/wekacluster.md:185: "IfcompositeLabelsis set,labelandskewwill be ignored."Consequence: a user who follows the doc and sets both gets their
compositeLabelsneither used nor validated, and a typo there stays invisible. Worth fixing the field comment inweka-k8s-api(source of the generated dump) as a follow-up so doc and validator agree — otherwise this validator quietly cements the undocumented precedence.Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.