rke2-snapshot-controller

by CodeScriptum

Helm chartv5.4.4App v8.7.0Apache-2.0

Deploys a Snapshot Controller in a cluster. Snapshot Controllers are often bundled with the Kubernetes distribution, this chart is meant for cases where it is not.

About this chart

snapshot-controller

Deploys the snapshot-controller in a cluster. The controller is required for CSI snapshotting to work and is not specific to any CSI driver.

While many Kubernetes distributions already package this controller, some do not. If your cluster does NOT have the following CRDs, you likely also do not have a snapshot controller deployed:

kubectl get crd volumesnapshotclasses.snapshot.storage.k8s.io
kubectl get crd volumesnapshots.snapshot.storage.k8s.io
kubectl get crd volumesnapshotcontents.snapshot.storage.k8s.io

Usage

See below for available configuration options.

helm repo add piraeus-charts https://piraeus.io/helm-charts/
helm install snapshot-controller piraeus-charts/snapshot-controller

Using cert-manager

The following configuration allows you to create cert-manager certificates for the webhook.

First create an issuer for selfsigned certificates in the namespace of the snapshot-controller installation:

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: selfsigned
spec:
  selfSigned: {}

After that we can configure the webhook (values.yaml):

webhook:
  tls:
    # disable tls generation with helm
    autogenerate: false
    # configure certManager issuer
    certManagerIssuerRef: 
      name: selfsigned
      kind: Issuer

Upgrades

Upgrades can be done using the normal Helm upgrade mechanism

helm repo update
helm upgrade snapshot-controller piraeus-charts/snapshot-controller

Upgrading from Chart Version v4

The following changes have been made when moving to Chart v5.0.0+:

  • CRDs are deployed as part of the regular resource. Installation can be controlled using the installCRDs value.
  • The Snapshot Conversion Webhook can be deployed to convert Volume Group Snapshot Content between v1beta1 and v1beta2. It is disabled by default; enable it with webhook.enabled=true only if your cluster still holds group snapshot objects in those older API versions. When disabled, no conversion strategy is injected into the volumegroupsnapshotcontents CRD (it defaults to None, matching upstream).
  • volumeSnapshotClasses and volumeGroupSnapshotClasses have been moved from controller to the top of the values.

Upgrades may fail to apply because of the changed deployment strategy for CRDs with an error such as:

Error: UPGRADE FAILED: Unable to continue with update: CustomResourceDefinition "volumesnapshotclasses.snapshot.storage.k8s.io" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "snapshot-controller"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "snapshot-controller"

In this case, in order to proceed with the upgrade, annotate and label the CRDs like so:

kubectl annotate crds volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io meta.helm.sh/release-name=snapshot-controller meta.helm.sh/release-namespace=snapshot-controller
kubectl label crds volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io app.kubernetes.io/managed-by=Helm
kubectl annotate crds volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io meta.helm.sh/release-name=snapshot-controller meta.helm.sh/release-namespace=snapshot-controller
kubectl label crds volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io app.kubernetes.io/managed-by=Helm
kubectl annotate crds volumegroupsnapshots.groupsnapshot.storage.k8s.io meta.helm.sh/release-name=snapshot-controller meta.helm.sh/release-namespace=snapshot-controller
kubectl label crds volumegroupsnapshots.groupsnapshot.storage.k8s.io app.kubernetes.io/managed-by=Helm
kubectl annotate crds volumesnapshotclasses.snapshot.storage.k8s.io meta.helm.sh/release-name=snapshot-controller meta.helm.sh/release-namespace=snapshot-controller
kubectl label crds volumesnapshotclasses.snapshot.storage.k8s.io app.kubernetes.io/managed-by=Helm
kubectl annotate crds volumesnapshotcontents.snapshot.storage.k8s.io meta.helm.sh/release-name=snapshot-controller meta.helm.sh/release-namespace=snapshot-controller
kubectl label crds volumesnapshotcontents.snapshot.storage.k8s.io app.kubernetes.io/managed-by=Helm
kubectl annotate crds volumesnapshots.snapshot.storage.k8s.io meta.helm.sh/release-name=snapshot-controller meta.helm.sh/release-namespace=snapshot-controller
kubectl label crds volumesnapshots.snapshot.storage.k8s.io app.kubernetes.io/managed-by=Helm

Then, retry the upgrade.

Configuration

Snapshot controller

The following options are available:

OptionUsageDefault
installCRDsInstall the CustomResourceDefinitions necessary for Kubernetes Volume Snapshots.true
keepCRDsAnnotate the CRDs with helm.sh/resource-policy: keep, so helm uninstall does not delete them and the VolumeSnapshots they hold.false
controller.enabledToggle to disable the deployment of the snapshot controller.true
controller.fullnameOverrideSet the base name of deployed resources. Defaults to snapshot-controller.""
controller.argsArguments to pass to the snapshot controller. Note: Keys will be converted to kebab-case, i.e. oneArg -> --one-arg...
controller.replicaCountNumber of replicas to deploy.1
controller.revisionHistoryLimitNumber of revisions to keep.10
controller.image.repositoryRepository to pull the image from.registry.k8s.io/sig-storage/snapshot-controller
controller.image.pullPolicyPull policy to use. Possible values: IfNotPresent, Always, NeverIfNotPresent
controller.image.tagOverride the tag to pull. If not given, defaults to charts AppVersion.""
controller.imagePullSecretsImage pull secrets to add to the deployment.[]
controller.podAnnotationsAnnotations to add to every pod in the deployment.{}
controller.podLabelsLabels to add to every pod in the deployment.{}
controller.podSecurityContextSecurity context to set on the webhook pod.{}
controller.priorityClassNamePriority Class to set on the deployment pods.""
controller.securityContextConfigure container security context. Defaults to dropping all capabilties and running as user 1000.{capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000}
controller.resourcesResources to request and limit on the pod.{}
controller.nodeSelectorNode selector to add to each webhook pod.{}
controller.tolerationsTolerations to add to each webhook pod.[]
controller.topologySpreadConstraintsTopology spread constraints to set on each pod.[]
controller.affinityAffinity to set on each webhook pod.{}
controller.pdbPodDisruptionBudget to set on the webhook pod.{}
controller.rbac.createCreate the necessary roles and bindings for the snapshot controller.true
controller.serviceAccount.createCreate the service account resourcetrue
controller.serviceAccount.nameSets the name of the service account. If left empty, will use the release name as default""
controller.hostNetworkChange hostNetwork to true when you want the pod to share its host's network namespace.false
controller.dnsConfigDNS settings for controller pod.{}
controller.dnsPolicyDNS Policy for controller pod. For Pods running with hostNetwork, set to ClusterFirstWithHostNet.ClusterFirst
webhook.enabledDeploy the conversion webhook and inject the Webhook conversion strategy into the volumegroupsnapshotcontents CRD. Only needed for clusters still holding v1beta1/v1beta2 group snapshot objects.false
webhook.fullnameOverrideSet the base name of deployed resources. Defaults to snapshot-controller-conversion-webhook.""
webhook.argsArguments to pass to the snapshot conversion webhook. Note: Keys will be converted to kebab-case, i.e. oneArg -> --one-arg...
webhook.tls.certificateSecretName of the certificate secret to use for se

Deploy rke2-snapshot-controller with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has rke2-snapshot-controller on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartrke2-snapshot-controller is pinned at v5.4.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply