snapshot-controller

by apecloud

Helm chartv1.7.2App v6.2.1Apache-2.0Verified publisher

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

First, please ensure you have the snapshot validation webhook installed. Then, install this chart. See below for available configuration options.

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

Upgrades

Upgrades can be done using the normal Helm upgrade mechanism

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

To enjoy all the latest features of the snapshot controller, you may want to upgrade your CRDs as well:

kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml

Upgrade from older CRDs

In an effort to tighten validation, the CSI project started enforcing stricter requirements on VolumeSnapshot and VolumeSnapshotContent resources when switching from v1beta1 to v1 CRDs. This webhook is part of enforcing these requirements. When upgrading you have to ensure non of your resources violate the requirements for v1.

The upgrade procedure can be summarized by the following steps:

  1. Remove the old snapshot controller, if any (since you are upgrading, you probably already have one deployed manually).

  2. Install the validation webhook chart.

  3. Install the snapshot controller using one of the 3.x.x releases:

    helm install piraeus-charts/snapshot-controller --set image.tag=v3.0.3
    
  4. Ensure that none of the resources are labelled as invalid:

    kubectl get volumesnapshots --selector=snapshot.storage.kubernetes.io/invalid-snapshot-resource="" --all-namespaces
    kubectl get volumesnapshotcontents --selector=snapshot.storage.kubernetes.io/invalid-snapshot-resource="" --all-namespaces
    

    If the above commands output any resource, they have to be removed

  5. Upgrade the CRDs

    kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
    kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
    kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
    
  6. Upgrade the snapshot controller to the latest version:

    helm upgrade piraeus-charts/snapshot-controller --set image.tag=v5.0.0
    

Configuration

The following options are available:

OptionUsageDefault
argsArguments to pass to the snapshot controller. Note: Keys will be converted to kebab-case, i.e. oneArg -> --one-arg...
replicaCountNumber of replicas to deploy.1
image.repositoryRepository to pull the image from.registry.k8s.io/sig-storage/snapshot-controller
image.pullPolicyPull policy to use. Possible values: IfNotPresent, Always, NeverIfNotPresent
image.tagOverride the tag to pull. If not given, defaults to charts AppVersion.""
imagePullSecretsImage pull secrets to add to the deployment.[]
podAnnotationsAnnotations to add to every pod in the deployment.{}
podSecurityContextSecurity context to set on the webhook pod.{}
securityContextConfigure container security context. Defaults to dropping all capabilties and running as user 1000.{capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000}
resourcesResources to request and limit on the pod.{}
nodeSelectorNode selector to add to each webhook pod.{}
tolerationsTolerations to add to each webhook pod.[]
affinityAffinity to set on each webhook pod.{}
rbac.createCreate the necessary roles and bindings for the snapshot controller.true
serviceAccount.createCreate the service account resourcetrue
serviceAccount.nameSets the name of the service account. If left empty, will use the release name as default""

Deploy 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 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 chartsnapshot-controller is pinned at v1.7.2 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