feat: import snapshot-controller surface to enable migration#21
Merged
feat: import snapshot-controller surface to enable migration#21
Conversation
Merged
4 tasks
13120d3 to
58fe6d7
Compare
Prepare storage-foundation for parallel coexistence with the
snapshot-controller module while migration is in progress:
* RBAC: extend rbac-for-us.yaml, user-authz-cluster-roles.yaml and
rbacv2/{manage,use}/{edit,view}.yaml with snapshot.storage.k8s.io
rules (volumesnapshots, volumesnapshotclasses, volumesnapshotcontents)
so that admin-kubeconfig and user-authz roles keep covering snapshot
resources after snapshot-controller is replaced.
* Hooks: port 030-remove-finalizers-on-module-delete from
snapshot-controller as-is, add CRGVK type and the matching variables
(AllowedProvisioners, WebhookConfigurationsToDelete,
CRGVKsForFinalizerRemoval) to consts; bump hooks go.mod to bring in
module-sdk v0.7.0, sds-common-lib, external-snapshotter client/v8 and
controller-runtime so the hook compiles.
* CRDs: copy snapshot.storage.k8s.io_volumesnapshot{,classes,contents}.yaml
from snapshot-controller (newer upstream content) and update the
module label to storage-foundation.
* Docs: add Russian doc-ru-snapshot.storage.k8s.io_* counterparts.
58fe6d7 to
3bc3a79
Compare
szhem
approved these changes
May 8, 2026
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
Bring the surface previously owned by the
snapshot-controllermodule intostorage-foundationso the two modules can coexist while clusters are being migrated.templates/rbac-for-us.yaml,templates/user-authz-cluster-roles.yamlandtemplates/rbacv2/{manage,use}/{edit,view}.yamlget the missing rules forsnapshot.storage.k8s.io(volumesnapshots,volumesnapshotclasses,volumesnapshotcontents). Previously these roles only covered the newstorage.deckhouse.ioresources, so after a hand-offadmin-kubeconfigand the user-authz roles would have lost access to snapshot objects.030-remove-finalizers-on-module-deleteis ported fromsnapshot-controlleras is (the existingstorage-foundationhooks have no extra logic oversnapshot-controller, so we add it verbatim with the import path adjusted).consts/consts.goregainsAllowedProvisioners,WebhookConfigurationsToDelete,CRGVKsForFinalizerRemovaland theCRGVKtype.hooks/go/go.modis bumped to bring inmodule-sdk@v0.7.0,sds-common-lib,external-snapshotter/client/v8@v8.2.0,controller-runtime@v0.20.4and the matchingk8s.io/*packages so the hook compiles.go build ./...andgo vet ./...pass.crds/snapshot.storage.k8s.io_volumesnapshot{,classes,contents}.yamlare replaced with the (newer) versions fromsnapshot-controller; only themodule:label is rewritten tostorage-foundation. CRD uniqueness across modules is intentionally not enforced at this stage.crds/doc-ru-snapshot.storage.k8s.io_*.yamlfiles are added (they don't carry themodulelabel, so no rewriting was required).This change does not restart any critical cluster components on its own; it only enriches what
storage-foundationwould render when actually enabled.Why do we need it, and what problem does it solve?
We need to migrate users from the
snapshot-controllermodule tostorage-foundationwithout forcing a hard cutover. To do that:storage-foundationmust be a strict superset ofsnapshot-controllerin terms of RBAC, CRDs and finalizer cleanup, otherwise turningsnapshot-controlleroff after the migration drops permissions and leaks finalizers.snapshot-controllermust yield tostorage-foundationwhile both are enabled — this is solved by the companion PR feat: gate all templates on storage-foundation not being enabled snapshot-controller#72, which gates every template behindstorage-foundationnot being enabled.Together the two PRs let an operator enable
storage-foundation, observe the migration succeed, and then disablesnapshot-controllerwithout RBAC regressions or stuck finalizers onSecrets/ConfigMaps/StorageClasses/VolumeSnapshot*.What is the expected result?
With this PR alone (other module untouched):
helm templateofstorage-foundationnow emits RBAC objects whose rules cover bothstorage.deckhouse.io(existing) andsnapshot.storage.k8s.io(new) — verified locally forrbac-for-us,user-authz-cluster-roles,rbacv2/manage/{edit,view},rbacv2/use/{edit,view}.crds/snapshot.storage.k8s.io_volumesnapshot{,classes,contents}.yamlcarrymodule: storage-foundation.crds/doc-ru-snapshot.storage.k8s.io_*.yamlare present.hooks/goregisters030-remove-finalizers-on-module-deleteand successfully runsOnAfterDeleteHelmon module uninstall (clearing finalizers from in-namespaceSecrets/ConfigMaps, optionalValidatingWebhookConfigurationsfromWebhookConfigurationsToDelete,StorageClassesforAllowedProvisioners, and CRs listed inCRGVKsForFinalizerRemoval— by default the threesnapshot.storage.k8s.iokinds).storage-foundationyet.Checklist