Repository navigation
deploy/sbx: a claim class the default StorageClass filled in no longer refuses setup.sh - #945
Conversation
…r knob run applied With SBX_STORAGE_CLASS unset, check_claim_class refused any live claim that carried a storageClassName, as 'set by an earlier SBX_STORAGE_CLASS run'. On a cluster with a default StorageClass, the DefaultStorageClass admission plugin fills that class in when the claim is created, so every deployment set up before rossoctl#887 was refused at its next setup.sh. The claims come from the overlay, which apply_stack applies client-side (kubectl apply -k); its three-way merge removes a field only when the last-applied-configuration annotation has it and the new config does not. A class admission filled in is on the claim but not in that annotation, so a knob-unset apply leaves it alone. Refuse only when the annotation carries the class (an earlier knob run applied it); log the kept class otherwise; and refuse, fail-closed, when the annotation is there but not valid JSON, since the run can't tell who set the class. A set knob that differs is still refused. The StatefulSet half is unchanged: admission does not fill volumeClaimTemplates. Closes rossoctl#935 Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Review — deploy/sbx: a claim class the default StorageClass filled in no longer refuses setup.sh
The premise checks out, and the fix makes the check test exactly what the apply tests. With the knob unset, write_overlay emits no storageClassName patch and base sets none, so a claim's last-applied configuration carries no class; the DefaultStorageClass admission plugin then fills the class in at create, on the claim but not in last-applied, and kc apply -k's three-way merge removes a field only when last-applied had it. So the admission-filled class survives, and the old refusal was over-broad.
claim_class_ownerreads the same source the merge reads. No annotation →{}→none; a class in last-applied →run, still refused; unparsable →unknown, refused fail-closed naming the claim, the cause and the fix. The\u0000sentinel is compared inside jq and onlyrun/none/unknownreach the shell, so it cannot reproduce the literal-NUL class of bug.- A set knob still takes the forward check first, so a differing class is refused even when admission filled it — immutable either way — and the new test pins that.
- The
runcase still dies with the right message, and theunknownadvice (set the knob to the live class, which is then a match and therefore safe) is the correct move for an operator who cannot tell who set it. - The tests now look like what
apply -kleaves: annotation and managedFields split by who set the class, the admission-filled case passing with the log line, the differing knob still refused, and the unparsable case asserting that nothing was applied before the refusal. - The install row and the header say which case is kept rather than only what is refused.
The inline comment is a nit about the mechanism named in the new header sentence, not about the check: the StatefulSet half's refusal holds, but the apply that would drop the field is the overlay's client-side merge, not a server-side apply.
Note on CI: no workflow run has been created for this head sha — only DCO has reported, and the other open PRs from the same fork ran normally, so it looks like a missed trigger rather than a failure. This review is from reading the code and the test diff; re-run or push to get the suite green before merging.
Author: webchang (MEMBER — maintainer). One commit, signed off.
| # where the live object has one and the knob is unset: the server-side | ||
| # apply would DROP the field its manager owns) is refused before | ||
| # an earlier knob run applied while the knob is now unset: the apply | ||
| # would DROP it -- the StatefulSet's server-side apply the field its |
There was a problem hiding this comment.
nit (accuracy of the comment, not of the check). The redis StatefulSet is in the overlay too — deploy/k8s/base/redis.yaml, pulled in through ocp-single — and apply_stack applies the whole overlay with kc apply -k, i.e. the same client-side three-way merge as the claims, not a server-side apply with a field manager. The refusal is right either way (the merge drops storageClassName from volumeClaimTemplates when last-applied had it and the new config does not), but the sentence reads the server-side mechanism as the reason, and that is not what this script does. check_sts_class's reverse comment says the same thing, and the claim comment just below still names apply_manifest, a function that no longer exists in the script — worth one sweep so the mechanism matches the code.
…ge for the StatefulSet too The redis StatefulSet comes from the overlay too (deploy/k8s/base/ redis.yaml through ocp-single), and apply_stack applies the whole overlay client-side (kubectl apply -k): the StatefulSet's refusal reason is the same three-way merge dropping storageClassName from volumeClaimTemplates, not a server-side field manager (setup.sh's server-side applies are its Secrets and ConfigMaps). The header, check_sts_class's reverse comment and the claim comment, which still named the removed apply_manifest, now say so. Comments only. Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
…ss-owner Signed-off-by: Rong Chang <[email protected]> # Conflicts: # docs/operate/sandbox-service/install.md
Carries rossoctl#941-rossoctl#946, rossoctl#948, rossoctl#950 and rossoctl#338's rossoctl#949/rossoctl#951 (API 1.33.0). One conflict: docs/operate/sandbox-service/install.md's settings table; upstream's table kept (its rossoctl#945 SBX_STORAGE_CLASS wording, the OIDC and proxy-hop rows) plus the fork's SBX_GATE_RECORD_SCHEMA row. The fork-only set is unchanged: the same 30 files. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Summary
deploy/sbx/setup.sh's storage-class preflight (#887) refused the first re-run of a deployment on a cluster with a default StorageClass: withSBX_STORAGE_CLASSunset, any live claim carrying astorageClassNamewas refused as "set by an earlier SBX_STORAGE_CLASS run", although the cluster'sDefaultStorageClassadmission plugin had filled it in. This makes the claim check refuse only what the apply would actually remove.What changes
check_claim_class: with the knob unset, a live class is refused only when an earlier run applied it. The claims come from the overlay, whichapply_stackapplies client-side (kubectl apply -k); its three-way merge removes a field only when thekubectl.kubernetes.io/last-applied-configurationannotation has it and the new config doesn't. So the check reads the annotation: a class an earlierSBX_STORAGE_CLASSrun applied is there and is still refused; a class theDefaultStorageClassadmission plugin filled in at create is on the claim but not in the annotation, so a knob-unset apply leaves it alone, and the run now logs that it kept it. A set knob that differs from the live class is still refused (the class is immutable either way).SBX_STORAGE_CLASS=<live class>).volumeClaimTemplates.SBX_STORAGE_CLASSrow say so (the pre-commit Prettier hook re-aligned that table).A read-only check on a live deployment with a default StorageClass confirmed the premise: every claim's
spec.storageClassNameis the cluster's default StorageClass; no field manager (kubectl-client-side-apply,kube-scheduler,kube-controller-manager) claimsf:spec.f:storageClassName; and the overlay claims' last-applied-configuration has nostorageClassName. So the admission-filled class is absent from last-applied, as the fix assumes.Tests
deploy/sbx/tests/setup.test.sh, the component-claims section: the fake PVCs now look like what a client-sideapply -kleaves, with the last-applied annotation carrying the class (an earlier knob run) or not (admission filled it in).setup.shwith the new tests): the admission-filled case fails ("a knob-unset run was refused by a claim class the default StorageClass filled in"). After: the suite passes.Closes #935
Assisted-By: Claude Code