rke2-snapshot-validation-webhook
by CodeScriptum
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:
-
Remove the old snapshot controller, if any (since you are upgrading, you probably already have one deployed manually).
-
Install this webhook chart.
-
Install the snapshot controller using one of the
3.x.xreleases:helm install piraeus-charts/snapshot-controller --set image.tag=v3.0.3 -
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-namespacesIf the above commands output any resource, they have to be removed
-
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 -
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.renewtotrueand 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: ClusterIssuerTo apply the override, use
--values <override-file>. -
A pre-existing
kubernetes.io/tlssecret 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.
| Option | Usage | Default |
|---|---|---|
args | Arguments to pass to the snapshot controller. Note: Keys will be converted to kebab-case, i.e. oneArg -> --one-arg | ... |
replicaCount | Number of replicas to deploy. | 1 |
image.repository | Repository to pull the image from. | registry.k8s.io/sig-storage/snapshot-validation-webhook |
image.pullPolicy | Pull policy to use. Possible values: IfNotPresent, Always, Never | IfNotPresent |
image.tag | Override the tag to pull. If not given, defaults to charts AppVersion. | "" |
webhook.timeoutSeconds | Timeout to use when contacting webhook server. | 2 |
webhook.failurePolicy | Policy to apply when webhook is unavailable. Possible values: Fail, Ignore. | Fail |
tls.certificateSecret | Name of the static tls secret to use for serving the HTTPS endpoint. | "" |
tls.autogenerate | Automatically generate the TLS secret for serving the HTTPS endpoint. | true |
tls.renew | Force renewal of certificate when auto-generating. | false |
tls.certManagerIssuerRef | Issuer to use for provisioning the TLS certificate. If this is used, tls.certificateSecret can be left empty. | {} |
imagePullSecrets | Image pull secrets to add to the deployment. | [] |
podAnnotations | Annotations to add to every pod in the deployment. | {} |
podLabels | Labels to add to every pod in the deployment. | {} |
networkPolicy.enabled | Should a network policy be created. | false |
networkPolicy.ingress | Additional ingress rules to be added to the network policy. | {} |
podDisruptionBudget.enabled | Should a pod disruption budget be created. | false |
podDisruptionBudget.maxUnavailable | The maximum number of pods that are allowed to be unavailable. | "" |
podDisruptionBudget.minAvailable | The minimum number of pods that are required to be available. | "" |
priorityClassName | The name of the priority class to assign to the deployment. | "" |
topologySpreadConstraints | A list of topology constraints to assign to the deployment. | [] |
podSecurityContext | Security context to set on the webhook pod. | {} |
securityContext | Configure container security context. Defaults to dropping all capabilties and running as user 1000. | {capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000} |
resources | Resources to request and limit on the pod. | {} |
nodeSelector | Node selector to add to each webhook pod. | {} |
tolerations | Tolerations to add to each webhook pod. | [] |
affinity | Affinity to set on each webhook pod. | {} |
serviceAccount.create | Create the service account resource | true |
serviceAccount.name | Sets 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartrke2-snapshot-validation-webhook is pinned at v1.9.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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