rke2-snapshot-validation-webhook

by CodeScriptum

Helm chartv1.9.1App v8.1.0Apache-2.0

Deploys the snapshot-validation-webhook and configures your cluster to validate every `VolumeSnapshot` and `VolumeSnapshotContent` resource by sending it to the webhook.

About this chart

snapshot-validation-webhook

Discontinuing notice: The chart has been merged with the snapshot-controller chart in the same repository. This chart has been archived.

Deploys the snapshot-validation-webhook and configures your cluster to validate every VolumeSnapshot and VolumeSnapshotContent resource by sending it to the webhook.

This webhook should be deployed on all clusters that are using the snapshot-controller chart, or are in the process of installing it.

Usage

The following commands install this chart in your cluster. See below for available configuration options.

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

Upgrades

Upgrades can be done using the normal Helm upgrade mechanism

helm repo update
helm upgrade snapshot-validation-webhook piraeus-charts/snapshot-validation-webhook

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 this 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

Webhooks in Kubernetes are required to run on HTTPS. To that end, this charts needs to be configured with one of the following options:

  • An auto-generated certificate, valid for 10 years. This is the default. If you want to renew the certificate, set tls.renew to true and run an upgrade.

  • A cert-manager.io issuer able to create a certificate for the webhook service.

    To use this method, create an override file like:

    tls:
      certManagerIssuerRef:
        name: internal-issuer
        kind: ClusterIssuer
    

    To apply the override, use --values <override-file>.

  • A pre-existing kubernetes.io/tls secret and the certificate of the CA used to sign said tls secret.

    To use this method, set --set tls.certificateSecret=<secretname>. The secret must be in the same namespace as the deployment and be valid for <release-name>.<namespace>.svc.

There are additional options that allow customization outside of HTTPS concerns. This is the full list of options 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-validation-webhook
image.pullPolicyPull policy to use. Possible values: IfNotPresent, Always, NeverIfNotPresent
image.tagOverride the tag to pull. If not given, defaults to charts AppVersion.""
webhook.timeoutSecondsTimeout to use when contacting webhook server.2
webhook.failurePolicyPolicy to apply when webhook is unavailable. Possible values: Fail, Ignore.Fail
tls.certificateSecretName of the static tls secret to use for serving the HTTPS endpoint.""
tls.autogenerateAutomatically generate the TLS secret for serving the HTTPS endpoint.true
tls.renewForce renewal of certificate when auto-generating.false
tls.certManagerIssuerRefIssuer to use for provisioning the TLS certificate. If this is used, tls.certificateSecret can be left empty.{}
imagePullSecretsImage pull secrets to add to the deployment.[]
podAnnotationsAnnotations to add to every pod in the deployment.{}
podLabelsLabels to add to every pod in the deployment.{}
networkPolicy.enabledShould a network policy be created.false
networkPolicy.ingressAdditional ingress rules to be added to the network policy.{}
podDisruptionBudget.enabledShould a pod disruption budget be created.false
podDisruptionBudget.maxUnavailableThe maximum number of pods that are allowed to be unavailable.""
podDisruptionBudget.minAvailableThe minimum number of pods that are required to be available.""
priorityClassNameThe name of the priority class to assign to the deployment.""
topologySpreadConstraintsA list of topology constraints to assign to 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.{}
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 rke2-snapshot-validation-webhook 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-validation-webhook 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-validation-webhook is pinned at v1.9.1 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