Repository navigation
Description
What happens
Upgrading the substrate chart from 0.5.0-alpha2 to 0.6.0-alpha3, with substrate-crds upgraded first as its own release, fails. The rollback then fails too, and the release is stuck until someone deletes the admission policy by hand.
The sandboxconfig-assets ValidatingAdmissionPolicy lives in the main chart (templates/sandboxconfig-validation.yaml) and changed between the two versions:
- 0.5: checks
object.spec.assets - 0.6: checks
object.spec.versions.all(v, has(v.assets) ...)
The 0.6 CRDs move assets under spec.versions[]. During the main chart's upgrade the new gvisor-default SandboxConfig (no spec.assets) is applied while the 0.5 policy is still in place, and is denied:
Helm upgrade failed for release ate-system/substrate with chart substrate@0.6.0-alpha3: server-side apply failed for object /gvisor-default ate.dev/v1alpha1, Kind=SandboxConfig: sandboxconfigs.ate.dev "gvisor-default" is forbidden: ValidatingAdmissionPolicy 'sandboxconfig-assets' with binding 'sandboxconfig-assets' denied request: a gvisor SandboxConfig must define a 'gvisor' (release tarball) or legacy 'runsc' asset for every architecture under spec.assets
The rollback to 0.5 cannot apply the old SandboxConfig either, because the 0.6 CRD no longer declares the field:
Helm rollback to previous release ate-system/substrate.v1 with chart substrate@0.5.0-alpha2 failed: server-side apply failed for object /gvisor-default ate.dev/v1alpha1, Kind=SandboxConfig: failed to create typed patch object (/gvisor-default; ate.dev/v1alpha1, Kind=SandboxConfig): .spec.assets: field not declared in schema
The live 0.5 policy also reports the schema mismatch in its type checking: undefined field 'assets'.
Workaround
kubectl delete validatingadmissionpolicybinding sandboxconfig-assets
kubectl delete validatingadmissionpolicy sandboxconfig-assets
flux reconcile helmrelease substrate -n ate-system --force # or helm upgradeHelm then recreates the 0.6 policy, and the upgrade completes.
Suggestion
The policy validates the CRD's schema, so it should change together with the CRD rather than one chart later. Two ways to get there:
- ship it in
substrate-crds; - in the main chart, give each schema generation its own policy name, and write the expressions so an old policy admits new-shape objects (
!has(object.spec.assets)short-circuits).
Failing either, an upgrade note in the 0.6 release about deleting the old policy first would save the next person the rollback loop.
Environment
Substrate 0.6.0-alpha3 (charts from oci://ghcr.io/kagent-dev/substrate/helm), installed by Flux HelmReleases, with the CRDs as a separate release applied first.
Activity