diff --git a/.gitignore b/.gitignore index f1b99efdb..4f8bfd2ab 100644 --- a/.gitignore +++ b/.gitignore @@ -127,6 +127,7 @@ examples/backups/*/.sentinel.env examples/backups/*/.backup-name.env examples/backups/*/.source-dump.txt packages/core/platform/images/migrations/etcd-operator-crds/ +packages/core/platform/images/migrations/snapshot-controller-crds/ # CI scratch: promote-rc.yaml checks the dispatch ref here so release tooling # (validator, agent instructions) is current even when the checked-out rc tag diff --git a/hack/migration-62-snapshot-crds.bats b/hack/migration-62-snapshot-crds.bats new file mode 100644 index 000000000..4d6bf351d --- /dev/null +++ b/hack/migration-62-snapshot-crds.bats @@ -0,0 +1,378 @@ +#!/usr/bin/env bats +# ----------------------------------------------------------------------------- +# Unit tests for platform migration 62 --> 63 (hand the snapshot CRDs over to +# the snapshot-controller release and replace the empty v1alpha1 +# VolumeGroupSnapshot CRDs with v1beta2 ones). See +# packages/core/platform/images/migrations/migrations/62 for the mechanism. +# +# The fake keeps the CRDs in a state file and applies each annotate, label, +# delete and create to it, so a second run reads what the first one wrote. The +# v1beta2 CRDs the migration creates come from group-crds/, standing in for the +# copies `make image-migrations` bakes into the image. +# +# The harness (docker, jq baked onto the migrations base image, the explicit +# `return` in run_migration) is the one hack/migration-55-fluxcd-orphan.bats +# describes; see there for why each piece is load-bearing. +# +# Run with: hack/cozytest.sh hack/migration-62-snapshot-crds.bats +# ----------------------------------------------------------------------------- + +load test_helper + +FIXTURES="$PWD/hack/testdata/migration-62-snapshot-crds" +MIG_DIR="$PWD/packages/core/platform/images/migrations/migrations" +ALPINE=$(sed -n 's/^FROM \(alpine:[^ ]*\).*$/\1/p' \ + "$PWD/packages/core/platform/images/migrations/Dockerfile" | head -1) +TESTIMG="cozystack-migration62-test:$(printf '%s' "$ALPINE" | sed 's/[^a-zA-Z0-9]/-/g')" +WORKROOT="${TMPDIR:-/tmp}/cozy-migration-62-$$" + +cozy_cleanup() { + rm -rf "$WORKROOT" + return 0 +} + +run_migration() { + _run_migration_rc=0 + docker run --rm --network none \ + --user "$(id -u):$(id -g)" \ + -v "$MIG_DIR:/migrations:ro" \ + -v "$FIXTURES:/fakebin:ro" \ + -v "$WORK:/work" \ + -e PATH=/fakebin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + -e FAKE_CMDLOG=/work/cmdlog \ + -e FAKE_STATE=/work/state \ + -e NAMESPACE="${NAMESPACE-}" \ + -e FAKE_HR_FAIL="${FAKE_HR_FAIL-}" \ + -e FAKE_CRD_FAIL="${FAKE_CRD_FAIL-}" \ + -e FAKE_DELETE_FAIL="${FAKE_DELETE_FAIL-}" \ + -e FAKE_RECORD_FAIL="${FAKE_RECORD_FAIL-}" \ + -e FAKE_CREATE_FAIL="${FAKE_CREATE_FAIL-}" \ + -e FAKE_WAIT_FAIL="${FAKE_WAIT_FAIL-}" \ + -e GROUP_CRD_DIR=/fakebin/group-crds \ + "$TESTIMG" "/migrations/$1" || _run_migration_rc=$? + return "$_run_migration_rc" +} + +prep() { + docker info >/dev/null 2>&1 || { + echo "docker is required: these tests run migration 62 inside a jq-enabled" >&2 + echo "build of $ALPINE, the migrations image's base." >&2 + return 1 + } + docker build -q -t "$TESTIMG" - >/dev/null < "$WORK/state/objects.json" + : > "$WORK/state/helmrelease" + FAKE_CMDLOG="$WORK/cmdlog" + : > "$FAKE_CMDLOG" + export NAMESPACE=cozy-system + unset FAKE_HR_FAIL FAKE_CRD_FAIL FAKE_DELETE_FAIL FAKE_RECORD_FAIL FAKE_CREATE_FAIL FAKE_WAIT_FAIL || true + return 0 +} + +# edit_crds -- rewrite the CRD state before a run. +edit_crds() { + jq "$1" "$WORK/state/crds.json" > "$WORK/state/crds.json.new" + mv "$WORK/state/crds.json.new" "$WORK/state/crds.json" + return 0 +} + +crd_field() { + jq -r --arg n "$1" ".items[] | select(.metadata.name == \$n) | $2" "$WORK/state/crds.json" +} + +@test "adopts the snapshot CRDs and replaces the empty v1alpha1 group snapshot CRDs" { + prep + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + + for p in volumesnapshotclasses volumesnapshotcontents volumesnapshots; do + crd="$p.snapshot.storage.k8s.io" + [ "$(crd_field "$crd" '.metadata.annotations["meta.helm.sh/release-name"]')" = "snapshot-controller" ] + [ "$(crd_field "$crd" '.metadata.annotations["meta.helm.sh/release-namespace"]')" = "cozy-snapshot-controller" ] + [ "$(crd_field "$crd" '.metadata.annotations["helm.sh/resource-policy"]')" = "keep" ] + [ "$(crd_field "$crd" '.metadata.labels["app.kubernetes.io/managed-by"]')" = "Helm" ] + done + + for p in volumegroupsnapshotclasses volumegroupsnapshotcontents volumegroupsnapshots; do + crd="$p.groupsnapshot.storage.k8s.io" + grep -qxF "DELETE $crd" "$FAKE_CMDLOG" + grep -qxF "CREATE $crd" "$FAKE_CMDLOG" + [ "$(crd_field "$crd" '[.spec.versions[] | select(.served) | .name] | index("v1beta2") != null')" = "true" ] + [ "$(crd_field "$crd" '.metadata.annotations["meta.helm.sh/release-name"]')" = "snapshot-controller" ] + done + # Every delete comes before the first create, so a kept CRD is known before + # anything is created. + [ "$(grep -nE '^(DELETE|CREATE) ' "$FAKE_CMDLOG" | sed -n '3p' | cut -d' ' -f1 | cut -d: -f2)" = "DELETE" ] + if grep -qF "ANNOTATE volumegroupsnapshot" "$FAKE_CMDLOG"; then echo "a v1alpha1 CRD was adopted" >&2; return 1; fi + if grep -qF "RECORD" "$FAKE_CMDLOG"; then echo "unexpected record" >&2; return 1; fi + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a second run finds nothing to change" { + prep + run_migration 62 >"$WORK/out" 2>&1 + : > "$FAKE_CMDLOG" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + if grep -qE "^(ANNOTATE|LABEL|DELETE|CREATE)" "$FAKE_CMDLOG"; then echo "second run changed a CRD" >&2; return 1; fi + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a group snapshot CRD that holds objects is kept and recorded" { + prep + echo '{"volumegroupsnapshots.groupsnapshot.storage.k8s.io": 2}' > "$WORK/state/objects.json" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + if grep -qxF "DELETE volumegroupsnapshots.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG"; then + echo "a CRD holding objects was deleted" >&2; return 1 + fi + grep -qxF "DELETE volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG" + if grep -qF "CREATE" "$FAKE_CMDLOG"; then echo "a v1beta2 CRD was created next to a kept v1alpha1 one" >&2; return 1; fi + grep -qF "cozystack.io/migration-62-needs-attention=volumegroupsnapshots.groupsnapshot.storage.k8s.io=2" "$FAKE_CMDLOG" + # The kept CRD stays out of the release, so the warning carries the whole + # recovery: recreate it through the release, restart the controller, then + # re-render linstor. + grep -qF "flux reconcile helmrelease --namespace cozy-snapshot-controller snapshot-controller --force" "$WORK/out" + grep -qF "kubectl rollout restart --namespace cozy-snapshot-controller deployment/snapshot-controller" "$WORK/out" + grep -qF "flux reconcile helmrelease --namespace cozy-linstor linstor --force" "$WORK/out" + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a failed record of the kept CRDs still stamps the version" { + prep + echo '{"volumegroupsnapshots.groupsnapshot.storage.k8s.io": 2}' > "$WORK/state/objects.json" + export FAKE_RECORD_FAIL="Error from server (InternalError): etcdserver: request timed out" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + grep -qF "failed to record the CRDs needing attention" "$WORK/out" + if grep -qF "RECORD" "$FAKE_CMDLOG"; then echo "the failed record was logged as written" >&2; return 1; fi + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "CRDs the release did not install are left alone" { + prep + edit_crds '.items |= map(.metadata.labels = {})' + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + if grep -qE "^(ANNOTATE|LABEL|DELETE|CREATE)" "$FAKE_CMDLOG"; then echo "a foreign CRD was changed" >&2; return 1; fi + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a group snapshot CRD that already serves v1beta2 is adopted, not deleted" { + prep + edit_crds '.items |= map(if .spec.group == "groupsnapshot.storage.k8s.io" + then .spec.versions = [{name: "v1beta2", served: true, storage: true}] + | .status.storedVersions = ["v1beta2"] + else . end)' + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + if grep -qE "^(DELETE|CREATE)" "$FAKE_CMDLOG"; then echo "a v1beta2 CRD was replaced" >&2; return 1; fi + [ "$(crd_field volumegroupsnapshots.groupsnapshot.storage.k8s.io '.metadata.annotations["meta.helm.sh/release-name"]')" = "snapshot-controller" ] + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a cluster without the snapshot-controller release only stamps the version" { + prep + rm "$WORK/state/helmrelease" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + if grep -qE "^(ANNOTATE|LABEL|DELETE|CREATE)" "$FAKE_CMDLOG"; then echo "unexpected change" >&2; return 1; fi + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a cluster with the release but no group snapshot CRDs gets them created" { + prep + edit_crds '.items |= map(select(.spec.group != "groupsnapshot.storage.k8s.io"))' + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + for p in volumegroupsnapshotclasses volumegroupsnapshotcontents volumegroupsnapshots; do + grep -qxF "CREATE $p.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG" + done + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a failing HelmRelease read aborts instead of treating the release as absent" { + prep + export FAKE_HR_FAIL="Error from server (InternalError): etcdserver: request timed out" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -ne 0 ] + grep -qF "$FAKE_HR_FAIL" "$WORK/out" + if grep -qE "^(ANNOTATE|LABEL|DELETE|CREATE|STAMP)" "$FAKE_CMDLOG"; then echo "changed something after a failed HelmRelease read" >&2; return 1; fi + rm -rf "$WORK" +} + +@test "a failing CRD read aborts instead of treating the CRD as absent" { + prep + export FAKE_CRD_FAIL="Error from server (InternalError): etcdserver: request timed out" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -ne 0 ] + if grep -qF "STAMP" "$FAKE_CMDLOG"; then echo "unexpected STAMP after failed CRD read" >&2; return 1; fi + rm -rf "$WORK" +} + +@test "a failing delete aborts before stamping" { + prep + export FAKE_DELETE_FAIL="Error from server (InternalError): etcdserver: request timed out" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -ne 0 ] + if grep -qF "STAMP" "$FAKE_CMDLOG"; then echo "unexpected STAMP after failed delete" >&2; return 1; fi + rm -rf "$WORK" +} + +@test "a failing create aborts before stamping, and the retry creates the CRDs" { + prep + export FAKE_CREATE_FAIL="Error from server (InternalError): etcdserver: request timed out" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -ne 0 ] + if grep -qF "STAMP" "$FAKE_CMDLOG"; then echo "unexpected STAMP after failed create" >&2; return 1; fi + + unset FAKE_CREATE_FAIL + : > "$FAKE_CMDLOG" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + for p in volumegroupsnapshotclasses volumegroupsnapshotcontents volumegroupsnapshots; do + grep -qxF "CREATE $p.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG" + done + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a retry after a timed-out Established wait waits again before stamping" { + prep + export FAKE_WAIT_FAIL="error: timed out waiting for the condition on customresourcedefinitions/volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -ne 0 ] + if grep -qF "STAMP" "$FAKE_CMDLOG"; then echo "unexpected STAMP after a failed wait" >&2; return 1; fi + + # The created CRDs now serve v1beta2 and carry the release's labels, so the + # retry takes the adoption path; the API is still not established. + : > "$FAKE_CMDLOG" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -ne 0 ] + if grep -qF "STAMP" "$FAKE_CMDLOG"; then echo "a retry stamped before the CRDs were established" >&2; return 1; fi + + unset FAKE_WAIT_FAIL + : > "$FAKE_CMDLOG" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + if grep -qF "CREATE" "$FAKE_CMDLOG"; then echo "the retry created a CRD that already exists" >&2; return 1; fi + for p in volumegroupsnapshotclasses volumegroupsnapshotcontents volumegroupsnapshots; do + grep -qxF "WAIT $p.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG" + done + # Every wait comes before the stamp. + [ "$(grep -aE '^(WAIT|STAMP) ' "$FAKE_CMDLOG" | tail -1)" = "STAMP 63" ] + rm -rf "$WORK" +} + +@test "release labels on the group snapshot CRDs alone still get them recreated" { + prep + edit_crds '.items |= map(if .spec.group == "snapshot.storage.k8s.io" then .metadata.labels = {} else . end)' + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + for p in volumegroupsnapshotclasses volumegroupsnapshotcontents volumegroupsnapshots; do + grep -qxF "DELETE $p.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG" + grep -qxF "CREATE $p.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG" + done + if grep -qF "ANNOTATE volumesnapshot" "$FAKE_CMDLOG"; then echo "a foreign snapshot CRD was adopted" >&2; return 1; fi + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "release labels on the group snapshot CRDs alone survive a failed create" { + prep + edit_crds '.items |= map(if .spec.group == "snapshot.storage.k8s.io" then .metadata.labels = {} else . end)' + export FAKE_CREATE_FAIL="Error from server (InternalError): etcdserver: request timed out" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -ne 0 ] + if grep -qF "STAMP" "$FAKE_CMDLOG"; then echo "unexpected STAMP after failed create" >&2; return 1; fi + + unset FAKE_CREATE_FAIL + : > "$FAKE_CMDLOG" + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + for p in volumegroupsnapshotclasses volumegroupsnapshotcontents volumegroupsnapshots; do + grep -qxF "CREATE $p.groupsnapshot.storage.k8s.io" "$FAKE_CMDLOG" + [ "$(crd_field "$p.groupsnapshot.storage.k8s.io" '[.spec.versions[] | select(.served) | .name] | index("v1beta2") != null')" = "true" ] + done + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} + +@test "a v1beta2 group snapshot CRD that still stores v1alpha1 is recorded, not adopted" { + prep + edit_crds '.items |= map(if .metadata.name == "volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io" + then .spec.versions = [{name: "v1alpha1", served: true, storage: false}, {name: "v1beta2", served: true, storage: true}] + | .status.storedVersions = ["v1alpha1", "v1beta2"] + else . end)' + rc=0 + run_migration 62 >"$WORK/out" 2>&1 || rc=$? + cat "$WORK/out"; cat "$FAKE_CMDLOG" + [ "$rc" -eq 0 ] + if grep -qE "^(ANNOTATE|LABEL|DELETE) volumegroupsnapshotcontents" "$FAKE_CMDLOG"; then + echo "a CRD still storing v1alpha1 was adopted or deleted" >&2; return 1 + fi + if grep -qF "CREATE" "$FAKE_CMDLOG"; then echo "a CRD was created next to the recorded one" >&2; return 1; fi + grep -qF "cozystack.io/migration-62-needs-attention=volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io=stored-v1alpha1" "$FAKE_CMDLOG" + # The kept CRD stays out of the release, so the warning carries the whole + # recovery: recreate it through the release, restart the controller, then + # re-render linstor. + grep -qF "flux reconcile helmrelease --namespace cozy-snapshot-controller snapshot-controller --force" "$WORK/out" + grep -qF "kubectl rollout restart --namespace cozy-snapshot-controller deployment/snapshot-controller" "$WORK/out" + grep -qF "flux reconcile helmrelease --namespace cozy-linstor linstor --force" "$WORK/out" + grep -qxF "STAMP 63" "$FAKE_CMDLOG" + rm -rf "$WORK" +} diff --git a/hack/testdata/migration-62-snapshot-crds/crds.json b/hack/testdata/migration-62-snapshot-crds/crds.json new file mode 100644 index 000000000..b2eed5b88 --- /dev/null +++ b/hack/testdata/migration-62-snapshot-crds/crds.json @@ -0,0 +1,201 @@ +{ + "apiVersion": "v1", + "kind": "List", + "items": [ + { + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumesnapshotclasses.snapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller" + }, + "annotations": { + "api-approved.kubernetes.io": "https://github.com/kubernetes-csi/external-snapshotter/pull/814", + "controller-gen.kubebuilder.io/version": "v0.15.0" + } + }, + "spec": { + "group": "snapshot.storage.k8s.io", + "versions": [ + { + "name": "v1", + "served": true, + "storage": true + }, + { + "name": "v1beta1", + "served": false, + "storage": false + } + ] + }, + "status": { + "storedVersions": [ + "v1" + ] + } + }, + { + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumesnapshotcontents.snapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller" + }, + "annotations": { + "api-approved.kubernetes.io": "https://github.com/kubernetes-csi/external-snapshotter/pull/814", + "controller-gen.kubebuilder.io/version": "v0.15.0" + } + }, + "spec": { + "group": "snapshot.storage.k8s.io", + "versions": [ + { + "name": "v1", + "served": true, + "storage": true + }, + { + "name": "v1beta1", + "served": false, + "storage": false + } + ] + }, + "status": { + "storedVersions": [ + "v1" + ] + } + }, + { + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumesnapshots.snapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller" + }, + "annotations": { + "api-approved.kubernetes.io": "https://github.com/kubernetes-csi/external-snapshotter/pull/814", + "controller-gen.kubebuilder.io/version": "v0.15.0" + } + }, + "spec": { + "group": "snapshot.storage.k8s.io", + "versions": [ + { + "name": "v1", + "served": true, + "storage": true + }, + { + "name": "v1beta1", + "served": false, + "storage": false + } + ] + }, + "status": { + "storedVersions": [ + "v1" + ] + } + }, + { + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller" + }, + "annotations": { + "api-approved.kubernetes.io": "https://github.com/kubernetes-csi/external-snapshotter/pull/814", + "controller-gen.kubebuilder.io/version": "v0.15.0" + } + }, + "spec": { + "group": "groupsnapshot.storage.k8s.io", + "versions": [ + { + "name": "v1alpha1", + "served": true, + "storage": true + } + ] + }, + "status": { + "storedVersions": [ + "v1alpha1" + ] + } + }, + { + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller" + }, + "annotations": { + "api-approved.kubernetes.io": "https://github.com/kubernetes-csi/external-snapshotter/pull/814", + "controller-gen.kubebuilder.io/version": "v0.15.0" + } + }, + "spec": { + "group": "groupsnapshot.storage.k8s.io", + "versions": [ + { + "name": "v1alpha1", + "served": true, + "storage": true + } + ] + }, + "status": { + "storedVersions": [ + "v1alpha1" + ] + } + }, + { + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumegroupsnapshots.groupsnapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller" + }, + "annotations": { + "api-approved.kubernetes.io": "https://github.com/kubernetes-csi/external-snapshotter/pull/814", + "controller-gen.kubebuilder.io/version": "v0.15.0" + } + }, + "spec": { + "group": "groupsnapshot.storage.k8s.io", + "versions": [ + { + "name": "v1alpha1", + "served": true, + "storage": true + } + ] + }, + "status": { + "storedVersions": [ + "v1alpha1" + ] + } + } + ] +} diff --git a/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io.yaml b/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io.yaml new file mode 100644 index 000000000..bd727c10f --- /dev/null +++ b/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io.yaml @@ -0,0 +1,37 @@ +{ + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller", + "app.kubernetes.io/managed-by": "Helm" + }, + "annotations": { + "meta.helm.sh/release-name": "snapshot-controller", + "meta.helm.sh/release-namespace": "cozy-snapshot-controller", + "helm.sh/resource-policy": "keep" + } + }, + "spec": { + "group": "groupsnapshot.storage.k8s.io", + "versions": [ + { + "name": "v1", + "served": true, + "storage": false + }, + { + "name": "v1beta1", + "served": true, + "storage": false + }, + { + "name": "v1beta2", + "served": true, + "storage": true + } + ] + } +} diff --git a/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io.yaml b/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io.yaml new file mode 100644 index 000000000..b7f7652b2 --- /dev/null +++ b/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io.yaml @@ -0,0 +1,37 @@ +{ + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller", + "app.kubernetes.io/managed-by": "Helm" + }, + "annotations": { + "meta.helm.sh/release-name": "snapshot-controller", + "meta.helm.sh/release-namespace": "cozy-snapshot-controller", + "helm.sh/resource-policy": "keep" + } + }, + "spec": { + "group": "groupsnapshot.storage.k8s.io", + "versions": [ + { + "name": "v1", + "served": true, + "storage": false + }, + { + "name": "v1beta1", + "served": true, + "storage": false + }, + { + "name": "v1beta2", + "served": true, + "storage": true + } + ] + } +} diff --git a/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshots.groupsnapshot.storage.k8s.io.yaml b/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshots.groupsnapshot.storage.k8s.io.yaml new file mode 100644 index 000000000..dff3e2b25 --- /dev/null +++ b/hack/testdata/migration-62-snapshot-crds/group-crds/volumegroupsnapshots.groupsnapshot.storage.k8s.io.yaml @@ -0,0 +1,37 @@ +{ + "apiVersion": "apiextensions.k8s.io/v1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": "volumegroupsnapshots.groupsnapshot.storage.k8s.io", + "labels": { + "helm.toolkit.fluxcd.io/name": "snapshot-controller", + "helm.toolkit.fluxcd.io/namespace": "cozy-snapshot-controller", + "app.kubernetes.io/managed-by": "Helm" + }, + "annotations": { + "meta.helm.sh/release-name": "snapshot-controller", + "meta.helm.sh/release-namespace": "cozy-snapshot-controller", + "helm.sh/resource-policy": "keep" + } + }, + "spec": { + "group": "groupsnapshot.storage.k8s.io", + "versions": [ + { + "name": "v1", + "served": true, + "storage": false + }, + { + "name": "v1beta1", + "served": true, + "storage": false + }, + { + "name": "v1beta2", + "served": true, + "storage": true + } + ] + } +} diff --git a/hack/testdata/migration-62-snapshot-crds/kubectl b/hack/testdata/migration-62-snapshot-crds/kubectl new file mode 100755 index 000000000..88c158680 --- /dev/null +++ b/hack/testdata/migration-62-snapshot-crds/kubectl @@ -0,0 +1,125 @@ +#!/bin/sh +# Fake kubectl for hack/migration-62-snapshot-crds.bats. It serves only the +# calls migration 62 and lib/cozystack-version.sh make, and logs each one to +# $FAKE_CMDLOG. +# +# The CRDs live in $FAKE_STATE/crds.json and every annotate, label and delete +# is applied to that file, so a second run of the migration reads what the +# first one wrote. $FAKE_STATE/objects.json maps a CRD name to the number of +# objects it holds. The snapshot-controller HelmRelease exists while +# $FAKE_STATE/helmrelease does. +# +# FAKE_CMDLOG file to append a one-line record of each call to +# FAKE_STATE directory holding crds.json and objects.json +# FAKE_HR_FAIL non-empty => reading the HelmRelease exits 1 with this stderr +# FAKE_CRD_FAIL non-empty => reading a CRD exits 1 with this stderr +# FAKE_DELETE_FAIL non-empty => deleting a CRD exits 1 with this stderr +# FAKE_RECORD_FAIL non-empty => annotating cozystack-version exits 1 with this stderr +# FAKE_CREATE_FAIL non-empty => creating a CRD exits 1 with this stderr +# FAKE_WAIT_FAIL non-empty => waiting for a CRD to be Established exits 1 +# with this stderr, as a CRD the apiserver never establishes +# +# The CRD files the migration creates from are JSON, which kubectl reads as +# well as YAML, so the fake can load them with jq. +set -u + +log() { [ -n "${FAKE_CMDLOG:-}" ] && printf '%s\n' "$*" >> "$FAKE_CMDLOG"; } +log "KUBECTL $*" + +CRDS="$FAKE_STATE/crds.json" + +# set_meta ... +set_meta() { + field="$1"; crd="$2"; shift 2 + for kv in "$@"; do + case "$kv" in + --*) continue ;; + esac + k="${kv%%=*}"; v="${kv#*=}" + jq --arg n "$crd" --arg f "$field" --arg k "$k" --arg v "$v" \ + '.items |= map(if .metadata.name == $n then .metadata[$f][$k] = $v else . end)' \ + "$CRDS" > "$CRDS.new" && mv "$CRDS.new" "$CRDS" + done +} + +case "$*" in + *"apply --filename -"*|*"apply -f -"*) + manifest=$(cat) + case "$manifest" in + *"kind: ConfigMap"*) + v=$(printf '%s\n' "$manifest" | sed -n 's/^ version: "\{0,1\}\([0-9]\{1,\}\)"\{0,1\}$/\1/p' | head -1) + log "STAMP ${v:-unknown}" + exit 0 + ;; + esac + printf 'fake kubectl: unmodelled apply\n' >&2 + exit 1 + ;; + + "get helmreleases.helm.toolkit.fluxcd.io --namespace cozy-snapshot-controller snapshot-controller --ignore-not-found -o name") + if [ -n "${FAKE_HR_FAIL:-}" ]; then printf '%s\n' "$FAKE_HR_FAIL" >&2; exit 1; fi + [ -e "$FAKE_STATE/helmrelease" ] && echo "helmrelease.helm.toolkit.fluxcd.io/snapshot-controller" + exit 0 + ;; + + "get customresourcedefinitions.apiextensions.k8s.io "*) + if [ -n "${FAKE_CRD_FAIL:-}" ]; then printf '%s\n' "$FAKE_CRD_FAIL" >&2; exit 1; fi + jq --arg n "$3" '.items[] | select(.metadata.name == $n)' "$CRDS" + exit 0 + ;; + + "annotate customresourcedefinitions.apiextensions.k8s.io "*) + crd="$3"; shift 3 + log "ANNOTATE $crd $*" + set_meta annotations "$crd" "$@" + exit 0 + ;; + + "label customresourcedefinitions.apiextensions.k8s.io "*) + crd="$3"; shift 3 + log "LABEL $crd $*" + set_meta labels "$crd" "$@" + exit 0 + ;; + + "delete customresourcedefinitions.apiextensions.k8s.io "*) + if [ -n "${FAKE_DELETE_FAIL:-}" ]; then printf '%s\n' "$FAKE_DELETE_FAIL" >&2; exit 1; fi + log "DELETE $3" + jq --arg n "$3" '.items |= map(select(.metadata.name != $n))' "$CRDS" > "$CRDS.new" && mv "$CRDS.new" "$CRDS" + exit 0 + ;; + + "create -f "*) + if [ -n "${FAKE_CREATE_FAIL:-}" ]; then printf '%s\n' "$FAKE_CREATE_FAIL" >&2; exit 1; fi + name=$(jq -r '.metadata.name' "$3") || exit 1 + if jq -e --arg n "$name" '.items[] | select(.metadata.name == $n)' "$CRDS" >/dev/null; then + printf 'Error from server (AlreadyExists): %s already exists\n' "$name" >&2 + exit 1 + fi + log "CREATE $name" + jq --slurpfile crd "$3" '.items += $crd' "$CRDS" > "$CRDS.new" && mv "$CRDS.new" "$CRDS" + exit 0 + ;; + + "wait --for=condition=Established "*) + log "WAIT ${4#customresourcedefinitions.apiextensions.k8s.io/}" + if [ -n "${FAKE_WAIT_FAIL:-}" ]; then printf '%s\n' "$FAKE_WAIT_FAIL" >&2; exit 1; fi + exit 0 + ;; + + "annotate configmap "*) + if [ -n "${FAKE_RECORD_FAIL:-}" ]; then printf '%s\n' "$FAKE_RECORD_FAIL" >&2; exit 1; fi + log "RECORD $*" + exit 0 + ;; + + "get "*".groupsnapshot.storage.k8s.io --all-namespaces -o json") + n=$(jq --arg n "$2" '.[$n] // 0' "$FAKE_STATE/objects.json") + jq -n --argjson n "$n" '{apiVersion: "v1", kind: "List", items: [range($n) | {}]}' + exit 0 + ;; +esac + +log "UNMODELLED $*" +printf 'fake kubectl: unmodelled call: %s\n' "$*" >&2 +exit 1 diff --git a/packages/core/platform/Makefile b/packages/core/platform/Makefile index 94a6c17e5..32b4fc413 100644 --- a/packages/core/platform/Makefile +++ b/packages/core/platform/Makefile @@ -27,6 +27,13 @@ unprotect: image: image-migrations +GROUP_SNAPSHOT_CRDS_EXPR := select(.spec.group == "groupsnapshot.storage.k8s.io") \ + | .metadata.annotations."meta.helm.sh/release-name" = "snapshot-controller" \ + | .metadata.annotations."meta.helm.sh/release-namespace" = "cozy-snapshot-controller" \ + | .metadata.labels."app.kubernetes.io/managed-by" = "Helm" \ + | .metadata.labels."helm.toolkit.fluxcd.io/name" = "snapshot-controller" \ + | .metadata.labels."helm.toolkit.fluxcd.io/namespace" = "cozy-snapshot-controller" + image-migrations: # Vendor the v1alpha2 CRDs into the build context so migration 50 can ensure # they exist before adoption (the etcd-operator-crds HelmRelease only installs @@ -36,12 +43,25 @@ image-migrations: rm -rf images/migrations/etcd-operator-crds mkdir -p images/migrations/etcd-operator-crds cp ../../system/etcd-operator-crds/templates/*.yaml images/migrations/etcd-operator-crds/ + # The v1beta2 group snapshot CRDs, rendered from the snapshot-controller + # chart with that release's ownership metadata, so migration 62 can create + # them before any HelmRelease renders against the cluster. + rm -rf images/migrations/snapshot-controller-crds + mkdir -p images/migrations/snapshot-controller-crds + helm template snapshot-controller ../../system/snapshot-controller \ + --namespace cozy-snapshot-controller \ + --show-only charts/snapshot-controller/templates/crds.yaml \ + | yq --split-exp '"images/migrations/snapshot-controller-crds/" + .metadata.name + ".yaml"' \ + '$(GROUP_SNAPSHOT_CRDS_EXPR)' + # yq exits 0 on empty input, so a failed render would otherwise ship an + # image whose migration 62 deletes the old CRDs and cannot recreate them. + test "$$(ls images/migrations/snapshot-controller-crds | wc -l)" -eq 3 docker buildx build images/migrations \ $(call image-tags,platform-migrations,v$(COZYSTACK_VERSION)) \ $(call cache-args,platform-migrations) \ --metadata-file images/migrations.json \ $(BUILDX_ARGS) - rm -rf images/migrations/etcd-operator-crds + rm -rf images/migrations/etcd-operator-crds images/migrations/snapshot-controller-crds IMAGE="$(REGISTRY)/platform-migrations:$(IMAGE_TAG)@$$(yq -e -o json -r '.["containerimage.digest"]' images/migrations.json)" \ yq --inplace '.migrations.image = strenv(IMAGE)' values.yaml rm -f images/migrations.json diff --git a/packages/core/platform/images/migrations/Dockerfile b/packages/core/platform/images/migrations/Dockerfile index 7a6bcf6b5..5cce9e709 100644 --- a/packages/core/platform/images/migrations/Dockerfile +++ b/packages/core/platform/images/migrations/Dockerfile @@ -43,6 +43,9 @@ COPY migrations /migrations # the etcd-operator-crds HelmRelease (which only reconciles after the migration # pre-upgrade hook completes). COPY etcd-operator-crds /etcd-operator-crds +# v1beta2 group snapshot CRDs, rendered by `make image-migrations`; migration 62 +# creates them before the snapshot-controller HelmRelease upgrades. +COPY snapshot-controller-crds /snapshot-controller-crds COPY run-migrations.sh /usr/bin/run-migrations.sh WORKDIR /migrations diff --git a/packages/core/platform/images/migrations/migrations/62 b/packages/core/platform/images/migrations/migrations/62 new file mode 100755 index 000000000..38faf333e --- /dev/null +++ b/packages/core/platform/images/migrations/migrations/62 @@ -0,0 +1,185 @@ +#!/bin/sh +# Migration 62 --> 63 +# Hand the snapshot CRDs over to the snapshot-controller release as templates, +# and clear the v1alpha1 VolumeGroupSnapshot CRDs out of the way. +# +# The snapshot-controller chart used to ship its six CRDs in crds/, which Helm +# creates on install and never touches again, so the live CRDs carry no Helm +# ownership metadata. The chart now renders them from a template, and renders a +# CRD only when it is absent or already carries this release's ownership +# metadata (patches/skip-foreign-crds.diff in the package). The CRDs the release +# installed are annotated for adoption here, so they stay in its manifest; any +# other CRD stays out of it, and the upgrade neither takes it over nor rewrites +# it. +# +# The three groupsnapshot.storage.k8s.io CRDs cannot be adopted that way. The +# old chart served them as v1alpha1 only, the new one serves v1beta1, v1beta2 +# and v1, and the apiserver rejects an update that drops a version still listed +# in status.storedVersions. The old snapshot-controller ran without the +# CSIVolumeGroupSnapshot gate, so no v1alpha1 object was ever acted on, and an +# empty CRD is deleted here. A CRD that still holds objects is left alone and +# recorded on the cozystack-version ConfigMap: deleting it would delete them. +# It carries no Helm ownership metadata, so the chart leaves it out of the +# release, which upgrades with that group snapshot API still at v1alpha1. +# +# The deleted CRDs are created again right away from the v1beta2 copies baked +# into the image (see image-migrations in the platform Makefile), already +# carrying the release's ownership metadata. Every HelmRelease waits for this +# hook, so the linstor release, which renders its group snapshot gate and +# VolumeGroupSnapshotClass only when the v1beta2 API is served, renders against +# it even when it upgrades before snapshot-controller. When a CRD was kept, none +# is created here, the release creates the missing ones, and linstor renders +# the gate off. Recovery is by hand, since nothing renders either release again +# once the CRD is gone, and RECOVERY below spells it out: delete the objects and +# the CRD, force a snapshot-controller upgrade so the chart creates it at +# v1beta2, restart snapshot-controller, which sets up its group snapshot +# watches only when it starts, then force a linstor upgrade. +# +# Only CRDs labelled by helm-controller as installed by +# cozy-snapshot-controller/snapshot-controller are touched, so a cluster whose +# distribution ships its own snapshot CRDs keeps them as they are, here and in +# the release. +# +# Whether the release is installed is read from its HelmRelease, not from those +# labels: a retry after a failed create finds the group CRDs it deleted gone, +# and their labels with them. Without the HelmRelease nothing would render the +# CRDs again, so nothing is changed. +# +# This runs as a pre-upgrade hook, before the release renders the new chart. The +# old chart does not render the CRDs, so the adoption metadata and the deletion +# hold until then. +# +# Idempotent: a CRD already owned by the release, or a groupsnapshot CRD that +# already serves v1beta2, is left alone, though the version is stamped only +# once every release-owned v1beta2 group snapshot CRD is Established. Fail-closed on any read or write error +# (exit 1 before the stamp), since migrations never re-run. + +set -euo pipefail + +# shellcheck source=lib/cozystack-version.sh +. "$(dirname "$0")/lib/cozystack-version.sh" + +RELEASE_NAME="snapshot-controller" +RELEASE_NS="cozy-snapshot-controller" + +SNAPSHOT_CRDS="volumesnapshotclasses volumesnapshotcontents volumesnapshots" +GROUP_SNAPSHOT_CRDS="volumegroupsnapshotclasses volumegroupsnapshotcontents volumegroupsnapshots" + +GROUP_CRD_DIR="${GROUP_CRD_DIR:-/snapshot-controller-crds}" + +RECOVERY="once its objects are deleted, delete the CRD, run 'flux reconcile helmrelease --namespace $RELEASE_NS $RELEASE_NAME --force' so the chart creates it at v1beta2, 'kubectl rollout restart --namespace $RELEASE_NS deployment/snapshot-controller', then 'flux reconcile helmrelease --namespace cozy-linstor linstor --force' to enable group snapshots" + +LEFTOVERS="" +CREATE="" +ESTABLISH="" + +# Assigned on its own line: inside a test, a failed read would not abort. +hr=$(kubectl get helmreleases.helm.toolkit.fluxcd.io --namespace "$RELEASE_NS" "$RELEASE_NAME" --ignore-not-found -o name) +if [ -z "$hr" ]; then + echo "HelmRelease $RELEASE_NS/$RELEASE_NAME not found; leaving the snapshot CRDs alone" + stamp_cozystack_version 63 + exit 0 +fi + +# installed_by_release +installed_by_release() { + printf '%s' "$1" | jq -e --arg name "$RELEASE_NAME" --arg ns "$RELEASE_NS" ' + .metadata.labels["helm.toolkit.fluxcd.io/name"] == $name + and .metadata.labels["helm.toolkit.fluxcd.io/namespace"] == $ns' >/dev/null +} + +adopt() { + crd="$1" + if [ "$(printf '%s' "$2" | jq -r '.metadata.annotations["meta.helm.sh/release-name"] // ""')" = "$RELEASE_NAME" ]; then + echo "CRD $crd already belongs to $RELEASE_NS/$RELEASE_NAME" + return 0 + fi + echo "Adopting CRD $crd into $RELEASE_NS/$RELEASE_NAME" + kubectl annotate customresourcedefinitions.apiextensions.k8s.io "$crd" \ + meta.helm.sh/release-name="$RELEASE_NAME" \ + meta.helm.sh/release-namespace="$RELEASE_NS" \ + helm.sh/resource-policy=keep \ + --overwrite >/dev/null + kubectl label customresourcedefinitions.apiextensions.k8s.io "$crd" \ + app.kubernetes.io/managed-by=Helm \ + --overwrite >/dev/null +} + +for plural in $SNAPSHOT_CRDS; do + crd="${plural}.snapshot.storage.k8s.io" + # --ignore-not-found turns only NotFound into empty output; any other error + # aborts under set -e rather than reading as an absent CRD. + obj=$(kubectl get customresourcedefinitions.apiextensions.k8s.io "$crd" --ignore-not-found -o json) + if [ -z "$obj" ]; then + echo "CRD $crd not found; nothing to adopt" + continue + fi + if ! installed_by_release "$obj"; then + echo "CRD $crd was not installed by $RELEASE_NS/$RELEASE_NAME; leaving it alone" + continue + fi + adopt "$crd" "$obj" +done + +for plural in $GROUP_SNAPSHOT_CRDS; do + crd="${plural}.groupsnapshot.storage.k8s.io" + obj=$(kubectl get customresourcedefinitions.apiextensions.k8s.io "$crd" --ignore-not-found -o json) + if [ -z "$obj" ]; then + CREATE="$CREATE $crd" + continue + fi + if ! installed_by_release "$obj"; then + echo "CRD $crd was not installed by $RELEASE_NS/$RELEASE_NAME; leaving it alone" + continue + fi + if printf '%s' "$obj" | jq -e '[.spec.versions[].name] | index("v1beta2")' >/dev/null; then + # The chart drops v1alpha1 from spec.versions, which the apiserver refuses + # while v1alpha1 is still a stored version, so such a CRD is left to an + # operator rather than adopted into an upgrade that cannot apply. + if printf '%s' "$obj" | jq -e '.status.storedVersions // [] | index("v1alpha1")' >/dev/null; then + echo "WARN: CRD $crd serves v1beta2 but still stores v1alpha1; it stays out of $RELEASE_NS/$RELEASE_NAME and group snapshots stay off: $RECOVERY" >&2 + LEFTOVERS="${LEFTOVERS}${LEFTOVERS:+,}${crd}=stored-v1alpha1" + continue + fi + adopt "$crd" "$obj" + # A retry after a timed-out Established wait lands here, since the CRD it + # created already serves v1beta2: without waiting again, the version would + # be stamped and linstor could render before the API is served. + ESTABLISH="$ESTABLISH $crd" + continue + fi + count=$(kubectl get "$crd" --all-namespaces -o json | jq '.items | length') + if [ "$count" -gt 0 ]; then + echo "WARN: CRD $crd still holds $count v1alpha1 object(s); it stays out of $RELEASE_NS/$RELEASE_NAME and group snapshots stay off: $RECOVERY" >&2 + LEFTOVERS="${LEFTOVERS}${LEFTOVERS:+,}${crd}=${count}" + continue + fi + echo "Deleting empty v1alpha1 CRD $crd" + kubectl delete customresourcedefinitions.apiextensions.k8s.io "$crd" --wait=true + CREATE="$CREATE $crd" +done + +# A CRD missing next to a kept one is left to the release. A retry after a +# failed create finds the deleted CRDs missing, so it creates them here too. +if [ -z "$LEFTOVERS" ]; then + for crd in $CREATE; do + echo "Creating CRD $crd at v1beta2 for $RELEASE_NS/$RELEASE_NAME" + kubectl create -f "$GROUP_CRD_DIR/$crd.yaml" >/dev/null + ESTABLISH="$ESTABLISH $crd" + done +fi + +for crd in $ESTABLISH; do + kubectl wait --for=condition=Established --timeout=60s \ + "customresourcedefinitions.apiextensions.k8s.io/$crd" >/dev/null +done + +# The record is a diagnostic aid, so failing to write it must not block the +# upgrade. +if [ -n "$LEFTOVERS" ]; then + kubectl annotate configmap --namespace "${NAMESPACE:-cozy-system}" cozystack-version \ + "cozystack.io/migration-62-needs-attention=$LEFTOVERS" --overwrite >/dev/null \ + || echo "WARN: failed to record the CRDs needing attention on cozystack-version" >&2 +fi + +stamp_cozystack_version 63 diff --git a/packages/core/platform/values.yaml b/packages/core/platform/values.yaml index 22dc05e80..fac99e775 100644 --- a/packages/core/platform/values.yaml +++ b/packages/core/platform/values.yaml @@ -14,7 +14,7 @@ migrations: # refuses to advance past a migration file missing from the image (exit 1), so # a stale pin fails loudly rather than silently skipping the etcd adoption. image: ghcr.io/cozystack/cozystack/platform-migrations:v1.6.0@sha256:6777042e3e9c6bad76e7d96fb64baa115061975f39061cb3ede84e21d0e2213f - targetVersion: 62 + targetVersion: 63 # Adopt legacy etcd clusters onto the v1alpha2 operator WITHOUT the mandatory # pre-adoption safety snapshot (migration 50). Leave false unless migration 50 # has actually refused to proceed and you accept the risk: adoption rewires diff --git a/packages/system/snapshot-controller/Makefile b/packages/system/snapshot-controller/Makefile index ca5d39e74..cb01ebf7d 100644 --- a/packages/system/snapshot-controller/Makefile +++ b/packages/system/snapshot-controller/Makefile @@ -7,4 +7,9 @@ update: rm -rf charts helm repo add piraeus-charts https://piraeus.io/helm-charts/ helm repo update piraeus-charts - helm pull piraeus-charts/snapshot-controller --untar --untardir charts \ No newline at end of file + helm pull piraeus-charts/snapshot-controller --untar --untardir charts + # Leave CRDs owned outside this release out of the manifest. + patch --no-backup-if-mismatch -p1 -d charts/snapshot-controller < patches/skip-foreign-crds.diff + +test: + helm unittest . diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/.helmignore b/packages/system/snapshot-controller/charts/snapshot-controller/.helmignore index 8c796acd4..78020a517 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/.helmignore +++ b/packages/system/snapshot-controller/charts/snapshot-controller/.helmignore @@ -16,10 +16,13 @@ *.tmp *.orig *~ -crds/README.md -Makefile # Various IDEs .project .idea/ *.tmproj .vscode/ + +# Custom files +/Makefile +/docker-bake.hcl +/*.dockerfile diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/Chart.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/Chart.yaml index 6ca536298..c30f0f4ea 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/Chart.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/Chart.yaml @@ -1,10 +1,8 @@ apiVersion: v2 -appVersion: v8.0.1 +appVersion: v8.7.0 description: '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. Also deploys the Snapshot Validation Webhook and configures your cluster - to validate every `VolumeSnapshot` and `VolumeSnapshotContent` resource by sending - it to the webhook. ' + it is not. ' home: https://github.com/piraeusdatastore/helm-charts icon: https://raw.githubusercontent.com/piraeusdatastore/piraeus/master/artwork/sandbox-artwork/icon/color.svg keywords: @@ -19,4 +17,4 @@ name: snapshot-controller sources: - https://github.com/kubernetes-csi/external-snapshotter/ type: application -version: 3.0.5 +version: 5.4.0 diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/README.md b/packages/system/snapshot-controller/charts/snapshot-controller/README.md index 9e6efb451..f318b44f4 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/README.md +++ b/packages/system/snapshot-controller/charts/snapshot-controller/README.md @@ -1,9 +1,7 @@ # snapshot-controller -Deploys the [snapshot-controller](https://github.com/kubernetes-csi/external-snapshotter) and the -[snapshot-validation-webhook](https://github.com/kubernetes-csi/external-snapshotter/#validating-webhook) in a cluster. -The controller is required for CSI snapshotting to work and is not specific to any CSI driver. The webhook is configured -to validate every `VolumeSnapshot` and `VolumeSnapshotContent` resource by sending it to the validation webhook. +Deploys the [snapshot-controller](https://github.com/kubernetes-csi/external-snapshotter) 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: @@ -16,14 +14,38 @@ kubectl get crd volumesnapshotcontents.snapshot.storage.k8s.io ## Usage -The *snapshot-controller* should be deployed together with the *snapshot-validation-webhook* which can be done by this -simple Helm commands. See [below](#configuration) for available configuration options. +See [below](#configuration) 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](https://cert-manager.io/docs/configuration/issuers/) certificates for the webhook. + +First create an issuer for selfsigned certificates in the namespace of the snapshot-controller installation: +```YAML +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + name: selfsigned +spec: + selfSigned: {} +``` + +After that we can configure the webhook (values.yaml): +```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 @@ -33,168 +55,109 @@ 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: +### 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: ``` -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 +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" ``` -## Upgrade from older CRDs +In this case, in order to proceed with the upgrade, annotate and label the CRDs like so: -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 validation webhook is part of -enforcing these requirements. When upgrading you [have to ensure non of your resources violate the requirements for `v1`]. +``` +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 +``` -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 snapshot controller and the validation webhook using one of the [`3.x.x` releases]: - - ``` - helm install piraeus-charts/snapshot-controller --set controller.image.tag=v3.0.3 --set webhook.image.tag=v3.0.3 - ``` -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-namespaces - ``` - - If the above commands output any resource, they have to be removed - -4. 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 - ``` - -5. Upgrade to the latest version: - - ``` - helm upgrade piraeus-charts/snapshot-controller --set controller.image.tag=v5.0.0 --set webhook.image.tag=v5.0.0 - ``` +Then, retry the upgrade. ## Configuration ### Snapshot controller + The following options are available: -| Option | Usage | Default | -|------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| -| `controller.enabled` | Toggle to disable the deployment of the snapshot controller. | `true` | -| `controller.fullnameOverride` | Set the base name of deployed resources. Defaults to `snapshot-controller`. | `""` | -| `controller.args` | Arguments to pass to the snapshot controller. Note: Keys will be converted to kebab-case, i.e. `oneArg` -> `--one-arg` | `...` | -| `controller.replicaCount` | Number of replicas to deploy. | `1` | -| `controller.revisionHistoryLimit` | Number of revisions to keep. | `10` | -| `controller.image.repository` | Repository to pull the image from. | `registry.k8s.io/sig-storage/snapshot-controller` | -| `controller.image.pullPolicy` | Pull policy to use. Possible values: `IfNotPresent`, `Always`, `Never` | `IfNotPresent` | -| `controller.image.tag` | Override the tag to pull. If not given, defaults to charts `AppVersion`. | `""` | -| `controller.imagePullSecrets` | Image pull secrets to add to the deployment. | `[]` | -| `controller.podAnnotations` | Annotations to add to every pod in the deployment. | `{}` | -| `controller.podLabels` | Labels to add to every pod in the deployment. | `{}` | -| `controller.podSecurityContext` | Security context to set on the webhook pod. | `{}` | -| `controller.priorityClassName` | Priority Class to set on the deployment pods. | `""` | -| `controller.securityContext` | Configure container security context. Defaults to dropping all capabilties and running as user 1000. | `{capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000}` | -| `controller.resources` | Resources to request and limit on the pod. | `{}` | -| `controller.nodeSelector` | Node selector to add to each webhook pod. | `{}` | -| `controller.tolerations` | Tolerations to add to each webhook pod. | `[]` | -| `controller.topologySpreadConstraints` | Topology spread constraints to set on each pod. | `[]` | -| `controller.affinity` | Affinity to set on each webhook pod. | `{}` | -| `controller.pdb` | PodDisruptionBudget to set on the webhook pod. | `{}` | -| `controller.rbac.create` | Create the necessary roles and bindings for the snapshot controller. | `true` | -| `controller.serviceAccount.create` | Create the service account resource | `true` | -| `controller.serviceAccount.name` | Sets the name of the service account. If left empty, will use the release name as default | `""` | -| `controller.hostNetwork` | Change `hostNetwork` to `true` when you want the pod to share its host's network namespace. | `false` | -| `controller.dnsConfig` | DNS settings for controller pod. | `{}` | -| `controller.dnsPolicy` | DNS Policy for controller pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet`. | `ClusterFirst` | - - -### Snapshot Validation Webhook -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 `webhook.tls.renew` to `true` and run an upgrade. - -* A [cert-manager.io](https://cert-manager.io) issuer able to create a certificate for the webhook service. - - To use this method, create an override file like: - ```yaml - webhook: - tls: - certManagerIssuerRef: - name: internal-issuer - kind: ClusterIssuer - ``` - - To apply the override, use `--values `. - -* 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 webhook.tls.certificateSecret=`. - The secret must be in the same namespace as the deployment and be valid for `..svc`. - -***NOTE:*** When using a custom CNI (such as Weave or Calico) on Amazon EKS, the webhook cannot be reached. - -> Internal error occurred: failed calling webhook "snapshot-validation-webhook.snapshot.storage.k8s.io": failed to call webhook: Post "https://snapshot-validation-webhook.kube-system.svc:443/volumesnapshot?timeout=2s": Address is not allowed - -This happens because the control plane cannot be configured to run on a custom CNI on EKS, so the CNIs -differ between control plane and worker nodes. - -To address this, the webhook can be run in the host network so it can be reached. -```yaml -webhook: - hostNetwork: true - dnsPolicy: ClusterFirstWithHostNet -``` - -There are additional options that allow customization outside of HTTPS concerns. This is the full list of options -available. - -| Option | Usage | Default | -|----------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| -| `webhook.enabled` | Toggle to disable the deployment of the snapshot validation webhook. | `true` | -| `webhook.fullnameOverride` | Set the base name of deployed resources. Defaults to `snapshot-validation-webhook`. | `""` | -| `webhook.args` | Arguments to pass to the snapshot controller. Note: Keys will be converted to kebab-case, i.e. `oneArg` -> `--one-arg` | `...` | -| `webhook.replicaCount` | Number of replicas to deploy. | `1` | -| `webhook.revisionHistoryLimit` | Number of revisions to keep. | `10` | -| `webhook.image.repository` | Repository to pull the image from. | `registry.k8s.io/sig-storage/snapshot-validation-webhook` | -| `webhook.image.pullPolicy` | Pull policy to use. Possible values: `IfNotPresent`, `Always`, `Never` | `IfNotPresent` | -| `webhook.image.tag` | Override the tag to pull. If not given, defaults to charts `AppVersion`. | `""` | -| `webhook.webhook.timeoutSeconds` | Timeout to use when contacting webhook server. | `2` | -| `webhook.webhook.failurePolicy` | Policy to apply when webhook is unavailable. Possible values: `Fail`, `Ignore`. | `Fail` | -| `webhook.tls.certificateSecret` | Name of the static tls secret to use for serving the HTTPS endpoint. | `""` | -| `webhook.tls.autogenerate` | Automatically generate the TLS secret for serving the HTTPS endpoint. | `true` | -| `webhook.tls.renew` | Force renewal of certificate when auto-generating. | `false` | -| `webhook.tls.certManagerIssuerRef` | Issuer to use for provisioning the TLS certificate. If this is used, `tls.certificateSecret` can be left empty. | `{}` | -| `webhook.imagePullSecrets` | Image pull secrets to add to the deployment. | `[]` | -| `webhook.podAnnotations` | Annotations to add to every pod in the deployment. | `{}` | -| `webhook.podLabels` | Labels to add to every pod in the deployment. | `{}` | -| `webhook.networkPolicy.enabled` | Should a network policy be created. | `false` | -| `webhook.networkPolicy.ingress` | Additional ingress rules to be added to the network policy. | `{}` | -| `webhook.podDisruptionBudget.enabled` | Should a pod disruption budget be created. | `false` | -| `webhook.podDisruptionBudget.maxUnavailable` | The maximum number of pods that are allowed to be unavailable. | `""` | -| `webhook.podDisruptionBudget.minAvailable` | The minimum number of pods that are required to be available. | `""` | -| `webhook.priorityClassName` | The name of the priority class to assign to the deployment. | `""` | -| `webhook.topologySpreadConstraints` | A list of topology constraints to assign to the deployment. | `[]` | -| `webhook.podSecurityContext` | Security context to set on the webhook pod. | `{}` | -| `webhook.securityContext` | Configure container security context. Defaults to dropping all capabilties and running as user 1000. | `{capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000}` | -| `webhook.resources` | Resources to request and limit on the pod. | `{}` | -| `webhook.nodeSelector` | Node selector to add to each webhook pod. | `{}` | -| `webhook.tolerations` | Tolerations to add to each webhook pod. | `[]` | -| `webhook.affinity` | Affinity to set on each webhook pod. | `{}` | -| `webhook.serviceAccount.create` | Create the service account resource | `true` | -| `webhook.serviceAccount.name` | Sets the name of the service account. If left empty, will use the release name as default | `""` | -| `webhook.tests.nodeSelector` | Node selector to add to each helm test pod. | `{}` | -| `webhook.tests.tolerations` | Tolerations to add to each helm test pod. | `[]` | -| `webhook.tests.affinity` | Affinity to set on each helm test pod. | `{}` | -| `webhook.hostNetwork` | Change `hostNetwork` to `true` when you want the pod to share its host's network namespace. | `false` | -| `webhook.dnsConfig` | DNS settings for webhook pod. | `{}` | -| `webhook.dnsPolicy` | DNS Policy for webhook pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet` | `ClusterFirst` | - -[`3.x.x` releases]: https://github.com/kubernetes-csi/external-snapshotter/releases -[have to ensure non of your resources violate the requirements for `v1`]: https://github.com/kubernetes-csi/external-snapshotter#validating-webhook +| Option | Usage | Default | +|----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| +| `installCRDs` | Install the CustomResourceDefinitions necessary for Kubernetes Volume Snapshots. | `true` | +| `keepCRDs` | Annotate the CRDs with `helm.sh/resource-policy: keep`, so `helm uninstall` does not delete them and the VolumeSnapshots they hold. | `false` | +| `controller.enabled` | Toggle to disable the deployment of the snapshot controller. | `true` | +| `controller.fullnameOverride` | Set the base name of deployed resources. Defaults to `snapshot-controller`. | `""` | +| `controller.args` | Arguments to pass to the snapshot controller. Note: Keys will be converted to kebab-case, i.e. `oneArg` -> `--one-arg` | `...` | +| `controller.replicaCount` | Number of replicas to deploy. | `1` | +| `controller.revisionHistoryLimit` | Number of revisions to keep. | `10` | +| `controller.image.repository` | Repository to pull the image from. | `registry.k8s.io/sig-storage/snapshot-controller` | +| `controller.image.pullPolicy` | Pull policy to use. Possible values: `IfNotPresent`, `Always`, `Never` | `IfNotPresent` | +| `controller.image.tag` | Override the tag to pull. If not given, defaults to charts `AppVersion`. | `""` | +| `controller.imagePullSecrets` | Image pull secrets to add to the deployment. | `[]` | +| `controller.podAnnotations` | Annotations to add to every pod in the deployment. | `{}` | +| `controller.podLabels` | Labels to add to every pod in the deployment. | `{}` | +| `controller.podSecurityContext` | Security context to set on the webhook pod. | `{}` | +| `controller.priorityClassName` | Priority Class to set on the deployment pods. | `""` | +| `controller.securityContext` | Configure container security context. Defaults to dropping all capabilties and running as user 1000. | `{capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000}` | +| `controller.resources` | Resources to request and limit on the pod. | `{}` | +| `controller.nodeSelector` | Node selector to add to each webhook pod. | `{}` | +| `controller.tolerations` | Tolerations to add to each webhook pod. | `[]` | +| `controller.topologySpreadConstraints` | Topology spread constraints to set on each pod. | `[]` | +| `controller.affinity` | Affinity to set on each webhook pod. | `{}` | +| `controller.pdb` | PodDisruptionBudget to set on the webhook pod. | `{}` | +| `controller.rbac.create` | Create the necessary roles and bindings for the snapshot controller. | `true` | +| `controller.serviceAccount.create` | Create the service account resource | `true` | +| `controller.serviceAccount.name` | Sets the name of the service account. If left empty, will use the release name as default | `""` | +| `controller.hostNetwork` | Change `hostNetwork` to `true` when you want the pod to share its host's network namespace. | `false` | +| `controller.dnsConfig` | DNS settings for controller pod. | `{}` | +| `controller.dnsPolicy` | DNS Policy for controller pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet`. | `ClusterFirst` | +| `webhook.enabled` | Deploy 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.fullnameOverride` | Set the base name of deployed resources. Defaults to `snapshot-controller-conversion-webhook`. | `""` | +| `webhook.args` | Arguments to pass to the snapshot conversion webhook. Note: Keys will be converted to kebab-case, i.e. `oneArg` -> `--one-arg` | `...` | +| `webhook.tls.certificateSecret` | Name of the certificate secret to use for serving TLS. | `""` | +| `webhook.tls.autogenerate` | Automatically generate the TLS secret. | `true` | +| `webhook.tls.renew` | Always generate a new TLS secret when autogenerating the TLS secret. | `false` | +| `webhook.tls.certManagerIssuerRef` | Set `kind` and `name` of the cert-manager Issuer to use instead of using Helm to generate the TLS secret. | `{}` | +| `webhook.tls.caBundle` | PEM-encoded TLS CA Bundle. If set, Helm will create a Secret with the content of caBundle, certificate and key. | `""` | +| `webhook.tls.certificate` | PEM-encoded TLS certificate. If set, Helm will create a Secret with the content of caBundle, certificate and key. | `""` | +| `webhook.tls.key` | PEM-encided TLS key. If set, Helm will create a Secret with the content of caBundle, certificate and key. | `""` | +| `webhook.replicaCount` | Number of replicas to deploy. | `1` | +| `webhook.revisionHistoryLimit` | Number of revisions to keep. | `10` | +| `webhook.image.repository` | Repository to pull the image from. | `ghcr.io/piraeusdatastore/snapshot-conversion-webhook` | +| `webhook.image.pullPolicy` | Pull policy to use. Possible values: `IfNotPresent`, `Always`, `Never` | `IfNotPresent` | +| `webhook.image.tag` | Override the tag to pull. If not given, defaults to charts `AppVersion`. | `""` | +| `webhook.imagePullSecrets` | Image pull secrets to add to the deployment. | `[]` | +| `webhook.podAnnotations` | Annotations to add to every pod in the deployment. | `{}` | +| `webhook.podLabels` | Labels to add to every pod in the deployment. | `{}` | +| `webhook.podSecurityContext` | Security context to set on the webhook pod. | `{}` | +| `webhook.priorityClassName` | Priority Class to set on the deployment pods. | `""` | +| `webhook.securityContext` | Configure container security context. Defaults to dropping all capabilties and running as user 1000. | `{capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000}` | +| `webhook.resources` | Resources to request and limit on the pod. | `{}` | +| `webhook.nodeSelector` | Node selector to add to each webhook pod. | `{}` | +| `webhook.tolerations` | Tolerations to add to each webhook pod. | `[]` | +| `webhook.topologySpreadConstraints` | Topology spread constraints to set on each pod. | `[]` | +| `webhook.affinity` | Affinity to set on each webhook pod. | `{}` | +| `webhook.pdb` | PodDisruptionBudget to set on the webhook pod. | `{}` | +| `webhook.serviceAccount.create` | Create the service account resource | `true` | +| `webhook.serviceAccount.name` | Sets the name of the service account. If left empty, will use the release name as default | `""` | +| `webhook.hostNetwork` | Change `hostNetwork` to `true` when you want the pod to share its host's network namespace. | `false` | +| `webhook.dnsConfig` | DNS settings for controller pod. | `{}` | +| `webhook.dnsPolicy` | DNS Policy for controller pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet`. | `ClusterFirst` | +| `volumeSnapshotClasses` | Volume Snapshot Classes to deploy. | `[]` | +| `volumeGroupSnapshotClasses` | Volume Group Snapshot Classes to deploy. | `[]` | diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/crds.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/crds.yaml new file mode 100644 index 000000000..0e94428c4 --- /dev/null +++ b/packages/system/snapshot-controller/charts/snapshot-controller/crds.yaml @@ -0,0 +1,2803 @@ +# DO NOT EDIT; Automatically created by make crds +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" + controller-gen.kubebuilder.io/version: v0.15.0 +{{- if .KeepCRDs }} + helm.sh/resource-policy: keep +{{- end }} + name: volumesnapshotclasses.snapshot.storage.k8s.io +spec: + group: snapshot.storage.k8s.io + names: + kind: VolumeSnapshotClass + listKind: VolumeSnapshotClassList + plural: volumesnapshotclasses + shortNames: + - vsclass + - vsclasses + singular: volumesnapshotclass + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .driver + name: Driver + type: string + - description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. + jsonPath: .deletionPolicy + name: DeletionPolicy + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: |- + VolumeSnapshotClass specifies parameters that a underlying storage system uses when + creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its + name in a VolumeSnapshot object. + VolumeSnapshotClasses are non-namespaced + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + deletionPolicy: + description: |- + deletionPolicy determines whether a VolumeSnapshotContent created through + the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. + "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. + Required. + enum: + - Delete + - Retain + type: string + driver: + description: |- + driver is the name of the storage driver that handles this VolumeSnapshotClass. + Required. + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + parameters: + additionalProperties: + type: string + description: |- + parameters is a key-value map with storage driver specific parameters for creating snapshots. + These values are opaque to Kubernetes. + type: object + required: + - deletionPolicy + - driver + type: object + served: true + storage: true + subresources: {} + - additionalPrinterColumns: + - jsonPath: .driver + name: Driver + type: string + - description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. + jsonPath: .deletionPolicy + name: DeletionPolicy + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + # This indicates the v1beta1 version of the custom resource is deprecated. + # API requests to this version receive a warning in the server response. + deprecated: true + # This overrides the default warning returned to clients making v1beta1 API requests. + deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotClass is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotClass" + schema: + openAPIV3Schema: + description: VolumeSnapshotClass specifies parameters that a underlying storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses are non-namespaced + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + deletionPolicy: + description: deletionPolicy determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. Required. + enum: + - Delete + - Retain + type: string + driver: + description: driver is the name of the storage driver that handles this VolumeSnapshotClass. Required. + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + parameters: + additionalProperties: + type: string + description: parameters is a key-value map with storage driver specific parameters for creating snapshots. These values are opaque to Kubernetes. + type: object + required: + - deletionPolicy + - driver + type: object + served: false + storage: false + subresources: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" +{{- if .KeepCRDs }} + helm.sh/resource-policy: keep +{{- end }} + name: volumesnapshots.snapshot.storage.k8s.io +spec: + group: snapshot.storage.k8s.io + names: + kind: VolumeSnapshot + listKind: VolumeSnapshotList + plural: volumesnapshots + shortNames: + - vs + singular: volumesnapshot + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Indicates if the snapshot is ready to be used to restore a volume. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: If a new snapshot needs to be created, this contains the name of the source PVC from which this snapshot was (or will be) created. + jsonPath: .spec.source.persistentVolumeClaimName + name: SourcePVC + type: string + - description: If a snapshot already exists, this contains the name of the existing VolumeSnapshotContent object representing the existing snapshot. + jsonPath: .spec.source.volumeSnapshotContentName + name: SourceSnapshotContent + type: string + - description: Represents the minimum size of volume required to rehydrate from this snapshot. + jsonPath: .status.restoreSize + name: RestoreSize + type: string + - description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot. + jsonPath: .spec.volumeSnapshotClassName + name: SnapshotClass + type: string + - description: Name of the VolumeSnapshotContent object to which the VolumeSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeSnapshot and VolumeSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object. + jsonPath: .status.boundVolumeSnapshotContentName + name: SnapshotContent + type: string + - description: Timestamp when the point-in-time snapshot was taken by the underlying storage system. + jsonPath: .status.creationTime + name: CreationTime + type: date + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: |- + VolumeSnapshot is a user's request for either creating a point-in-time + snapshot of a persistent volume, or binding to a pre-existing snapshot. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + spec defines the desired characteristics of a snapshot requested by a user. + More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots + Required. + properties: + source: + description: |- + source specifies where a snapshot will be created from. + This field is immutable after creation. + Required. + properties: + persistentVolumeClaimName: + description: |- + persistentVolumeClaimName specifies the name of the PersistentVolumeClaim + object representing the volume from which a snapshot should be created. + This PVC is assumed to be in the same namespace as the VolumeSnapshot + object. + This field should be set if the snapshot does not exists, and needs to be + created. + This field is immutable. + type: string + x-kubernetes-validations: + - message: persistentVolumeClaimName is immutable + rule: self == oldSelf + volumeSnapshotContentName: + description: |- + volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent + object representing an existing volume snapshot. + This field should be set if the snapshot already exists and only needs a representation in Kubernetes. + This field is immutable. + type: string + x-kubernetes-validations: + - message: volumeSnapshotContentName is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: persistentVolumeClaimName is required once set + rule: '!has(oldSelf.persistentVolumeClaimName) || has(self.persistentVolumeClaimName)' + - message: volumeSnapshotContentName is required once set + rule: '!has(oldSelf.volumeSnapshotContentName) || has(self.volumeSnapshotContentName)' + - message: exactly one of volumeSnapshotContentName and persistentVolumeClaimName must be set + rule: (has(self.volumeSnapshotContentName) && !has(self.persistentVolumeClaimName)) || (!has(self.volumeSnapshotContentName) && has(self.persistentVolumeClaimName)) + volumeSnapshotClassName: + description: |- + VolumeSnapshotClassName is the name of the VolumeSnapshotClass + requested by the VolumeSnapshot. + VolumeSnapshotClassName may be left nil to indicate that the default + SnapshotClass should be used. + A given cluster may have multiple default Volume SnapshotClasses: one + default per CSI Driver. If a VolumeSnapshot does not specify a SnapshotClass, + VolumeSnapshotSource will be checked to figure out what the associated + CSI Driver is, and the default VolumeSnapshotClass associated with that + CSI Driver will be used. If more than one VolumeSnapshotClass exist for + a given CSI Driver and more than one have been marked as default, + CreateSnapshot will fail and generate an event. + Empty string is not allowed for this field. + type: string + x-kubernetes-validations: + - message: volumeSnapshotClassName must not be the empty string when set + rule: size(self) > 0 + required: + - source + type: object + status: + description: |- + status represents the current information of a snapshot. + Consumers must verify binding between VolumeSnapshot and + VolumeSnapshotContent objects is successful (by validating that both + VolumeSnapshot and VolumeSnapshotContent point at each other) before + using this object. + properties: + boundVolumeSnapshotContentName: + description: |- + boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent + object to which this VolumeSnapshot object intends to bind to. + If not specified, it indicates that the VolumeSnapshot object has not been + successfully bound to a VolumeSnapshotContent object yet. + NOTE: To avoid possible security issues, consumers must verify binding between + VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that + both VolumeSnapshot and VolumeSnapshotContent point at each other) before using + this object. + type: string + creationTime: + description: |- + creationTime is the timestamp when the point-in-time snapshot is taken + by the underlying storage system. + In dynamic snapshot creation case, this field will be filled in by the + snapshot controller with the "creation_time" value returned from CSI + "CreateSnapshot" gRPC call. + For a pre-existing snapshot, this field will be filled with the "creation_time" + value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. + If not specified, it may indicate that the creation time of the snapshot is unknown. + format: date-time + type: string + error: + description: |- + error is the last observed error during snapshot creation, if any. + This field could be helpful to upper level controllers(i.e., application controller) + to decide whether they should continue on waiting for the snapshot to be created + based on the type of error reported. + The snapshot controller will keep retrying when an error occurs during the + snapshot creation. Upon success, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + readyToUse indicates if the snapshot is ready to be used to restore a volume. + In dynamic snapshot creation case, this field will be filled in by the + snapshot controller with the "ready_to_use" value returned from CSI + "CreateSnapshot" gRPC call. + For a pre-existing snapshot, this field will be filled with the "ready_to_use" + value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, + otherwise, this field will be set to "True". + If not specified, it means the readiness of a snapshot is unknown. + type: boolean + restoreSize: + type: string + description: |- + restoreSize represents the minimum size of volume required to create a volume + from this snapshot. + In dynamic snapshot creation case, this field will be filled in by the + snapshot controller with the "size_bytes" value returned from CSI + "CreateSnapshot" gRPC call. + For a pre-existing snapshot, this field will be filled with the "size_bytes" + value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. + When restoring a volume from this snapshot, the size of the volume MUST NOT + be smaller than the restoreSize if it is specified, otherwise the restoration will fail. + If not specified, it indicates that the size is unknown. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + volumeGroupSnapshotName: + description: |- + VolumeGroupSnapshotName is the name of the VolumeGroupSnapshot of which this + VolumeSnapshot is a part of. + type: string + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates if the snapshot is ready to be used to restore a volume. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: If a new snapshot needs to be created, this contains the name of the source PVC from which this snapshot was (or will be) created. + jsonPath: .spec.source.persistentVolumeClaimName + name: SourcePVC + type: string + - description: If a snapshot already exists, this contains the name of the existing VolumeSnapshotContent object representing the existing snapshot. + jsonPath: .spec.source.volumeSnapshotContentName + name: SourceSnapshotContent + type: string + - description: Represents the minimum size of volume required to rehydrate from this snapshot. + jsonPath: .status.restoreSize + name: RestoreSize + type: string + - description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot. + jsonPath: .spec.volumeSnapshotClassName + name: SnapshotClass + type: string + - description: Name of the VolumeSnapshotContent object to which the VolumeSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeSnapshot and VolumeSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object. + jsonPath: .status.boundVolumeSnapshotContentName + name: SnapshotContent + type: string + - description: Timestamp when the point-in-time snapshot was taken by the underlying storage system. + jsonPath: .status.creationTime + name: CreationTime + type: date + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + # This indicates the v1beta1 version of the custom resource is deprecated. + # API requests to this version receive a warning in the server response. + deprecated: true + # This overrides the default warning returned to clients making v1beta1 API requests. + deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot" + schema: + openAPIV3Schema: + description: VolumeSnapshot is a user's request for either creating a point-in-time snapshot of a persistent volume, or binding to a pre-existing snapshot. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + spec: + description: 'spec defines the desired characteristics of a snapshot requested by a user. More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots Required.' + properties: + source: + description: source specifies where a snapshot will be created from. This field is immutable after creation. Required. + properties: + persistentVolumeClaimName: + description: persistentVolumeClaimName specifies the name of the PersistentVolumeClaim object representing the volume from which a snapshot should be created. This PVC is assumed to be in the same namespace as the VolumeSnapshot object. This field should be set if the snapshot does not exists, and needs to be created. This field is immutable. + type: string + volumeSnapshotContentName: + description: volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent object representing an existing volume snapshot. This field should be set if the snapshot already exists and only needs a representation in Kubernetes. This field is immutable. + type: string + type: object + volumeSnapshotClassName: + description: 'VolumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. VolumeSnapshotClassName may be left nil to indicate that the default SnapshotClass should be used. A given cluster may have multiple default Volume SnapshotClasses: one default per CSI Driver. If a VolumeSnapshot does not specify a SnapshotClass, VolumeSnapshotSource will be checked to figure out what the associated CSI Driver is, and the default VolumeSnapshotClass associated with that CSI Driver will be used. If more than one VolumeSnapshotClass exist for a given CSI Driver and more than one have been marked as default, CreateSnapshot will fail and generate an event. Empty string is not allowed for this field.' + type: string + required: + - source + type: object + status: + description: status represents the current information of a snapshot. Consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object. + properties: + boundVolumeSnapshotContentName: + description: 'boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent object to which this VolumeSnapshot object intends to bind to. If not specified, it indicates that the VolumeSnapshot object has not been successfully bound to a VolumeSnapshotContent object yet. NOTE: To avoid possible security issues, consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object.' + type: string + creationTime: + description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it may indicate that the creation time of the snapshot is unknown. + format: date-time + type: string + error: + description: error is the last observed error during snapshot creation, if any. This field could be helpful to upper level controllers(i.e., application controller) to decide whether they should continue on waiting for the snapshot to be created based on the type of error reported. The snapshot controller will keep retrying when an error occurs during the snapshot creation. Upon success, this error field will be cleared. + properties: + message: + description: 'message is a string detailing the encountered error during snapshot creation if specified. NOTE: message may be logged, and it should not contain sensitive information.' + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: readyToUse indicates if the snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown. + type: boolean + restoreSize: + type: string + description: restoreSize represents the minimum size of volume required to create a volume from this snapshot. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown. + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + required: + - spec + type: object + served: false + storage: false + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955" +{{- if .KeepCRDs }} + helm.sh/resource-policy: keep +{{- end }} + name: volumesnapshotcontents.snapshot.storage.k8s.io +spec: + group: snapshot.storage.k8s.io + names: + kind: VolumeSnapshotContent + listKind: VolumeSnapshotContentList + plural: volumesnapshotcontents + shortNames: + - vsc + - vscs + singular: volumesnapshotcontent + scope: Cluster + versions: + - additionalPrinterColumns: + - description: Indicates if the snapshot is ready to be used to restore a volume. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: Represents the complete size of the snapshot in bytes + jsonPath: .status.restoreSize + name: RestoreSize + type: integer + - description: Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. + jsonPath: .spec.deletionPolicy + name: DeletionPolicy + type: string + - description: Name of the CSI driver used to create the physical snapshot on the underlying storage system. + jsonPath: .spec.driver + name: Driver + type: string + - description: Name of the VolumeSnapshotClass to which this snapshot belongs. + jsonPath: .spec.volumeSnapshotClassName + name: VolumeSnapshotClass + type: string + - description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. + jsonPath: .spec.volumeSnapshotRef.name + name: VolumeSnapshot + type: string + - description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. + jsonPath: .spec.volumeSnapshotRef.namespace + name: VolumeSnapshotNamespace + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: |- + VolumeSnapshotContent represents the actual "on-disk" snapshot object in the + underlying storage system + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + spec defines properties of a VolumeSnapshotContent created by the underlying storage system. + Required. + properties: + deletionPolicy: + description: |- + deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on + the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. + "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. + For dynamically provisioned snapshots, this field will automatically be filled in by the + CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding + VolumeSnapshotClass. + For pre-existing snapshots, users MUST specify this field when creating the + VolumeSnapshotContent object. + Required. + enum: + - Delete + - Retain + type: string + driver: + description: |- + driver is the name of the CSI driver used to create the physical snapshot on + the underlying storage system. + This MUST be the same as the name returned by the CSI GetPluginName() call for + that driver. + Required. + type: string + source: + description: |- + source specifies whether the snapshot is (or should be) dynamically provisioned + or already exists, and just requires a Kubernetes object representation. + This field is immutable after creation. + Required. + properties: + snapshotHandle: + description: |- + snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on + the underlying storage system for which a Kubernetes object representation + was (or should be) created. + This field is immutable. + type: string + x-kubernetes-validations: + - message: snapshotHandle is immutable + rule: self == oldSelf + volumeHandle: + description: |- + volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot + should be dynamically taken from. + This field is immutable. + type: string + x-kubernetes-validations: + - message: volumeHandle is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: volumeHandle is required once set + rule: '!has(oldSelf.volumeHandle) || has(self.volumeHandle)' + - message: snapshotHandle is required once set + rule: '!has(oldSelf.snapshotHandle) || has(self.snapshotHandle)' + - message: exactly one of volumeHandle and snapshotHandle must be set + rule: (has(self.volumeHandle) && !has(self.snapshotHandle)) || (!has(self.volumeHandle) && has(self.snapshotHandle)) + sourceVolumeMode: + description: |- + SourceVolumeMode is the mode of the volume whose snapshot is taken. + Can be either “Filesystem” or “Block”. + If not specified, it indicates the source volume's mode is unknown. + This field is immutable. + This field is an alpha field. + type: string + x-kubernetes-validations: + - message: sourceVolumeMode is immutable + rule: self == oldSelf + volumeSnapshotClassName: + description: |- + name of the VolumeSnapshotClass from which this snapshot was (or will be) + created. + Note that after provisioning, the VolumeSnapshotClass may be deleted or + recreated with different set of values, and as such, should not be referenced + post-snapshot creation. + type: string + volumeSnapshotRef: + description: |- + volumeSnapshotRef specifies the VolumeSnapshot object to which this + VolumeSnapshotContent object is bound. + VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to + this VolumeSnapshotContent's name for the bidirectional binding to be valid. + For a pre-existing VolumeSnapshotContent object, name and namespace of the + VolumeSnapshot object MUST be provided for binding to happen. + This field is immutable after creation. + Required. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace must be set + rule: has(self.name) && has(self.__namespace__) + required: + - deletionPolicy + - driver + - source + - volumeSnapshotRef + type: object + x-kubernetes-validations: + - message: sourceVolumeMode is required once set + rule: '!has(oldSelf.sourceVolumeMode) || has(self.sourceVolumeMode)' + status: + description: status represents the current information of a snapshot. + properties: + creationTime: + description: |- + creationTime is the timestamp when the point-in-time snapshot is taken + by the underlying storage system. + In dynamic snapshot creation case, this field will be filled in by the + CSI snapshotter sidecar with the "creation_time" value returned from CSI + "CreateSnapshot" gRPC call. + For a pre-existing snapshot, this field will be filled with the "creation_time" + value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. + If not specified, it indicates the creation time is unknown. + The format of this field is a Unix nanoseconds time encoded as an int64. + On Unix, the command `date +%s%N` returns the current time in nanoseconds + since 1970-01-01 00:00:00 UTC. + format: int64 + type: integer + error: + description: |- + error is the last observed error during snapshot creation, if any. + Upon success after retry, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + readyToUse indicates if a snapshot is ready to be used to restore a volume. + In dynamic snapshot creation case, this field will be filled in by the + CSI snapshotter sidecar with the "ready_to_use" value returned from CSI + "CreateSnapshot" gRPC call. + For a pre-existing snapshot, this field will be filled with the "ready_to_use" + value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, + otherwise, this field will be set to "True". + If not specified, it means the readiness of a snapshot is unknown. + type: boolean + restoreSize: + description: |- + restoreSize represents the complete size of the snapshot in bytes. + In dynamic snapshot creation case, this field will be filled in by the + CSI snapshotter sidecar with the "size_bytes" value returned from CSI + "CreateSnapshot" gRPC call. + For a pre-existing snapshot, this field will be filled with the "size_bytes" + value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. + When restoring a volume from this snapshot, the size of the volume MUST NOT + be smaller than the restoreSize if it is specified, otherwise the restoration will fail. + If not specified, it indicates that the size is unknown. + format: int64 + minimum: 0 + type: integer + snapshotHandle: + description: |- + snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. + If not specified, it indicates that dynamic snapshot creation has either failed + or it is still in progress. + type: string + volumeGroupSnapshotHandle: + description: |- + VolumeGroupSnapshotHandle is the CSI "group_snapshot_id" of a group snapshot + on the underlying storage system. + type: string + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates if the snapshot is ready to be used to restore a volume. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: Represents the complete size of the snapshot in bytes + jsonPath: .status.restoreSize + name: RestoreSize + type: integer + - description: Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. + jsonPath: .spec.deletionPolicy + name: DeletionPolicy + type: string + - description: Name of the CSI driver used to create the physical snapshot on the underlying storage system. + jsonPath: .spec.driver + name: Driver + type: string + - description: Name of the VolumeSnapshotClass to which this snapshot belongs. + jsonPath: .spec.volumeSnapshotClassName + name: VolumeSnapshotClass + type: string + - description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. + jsonPath: .spec.volumeSnapshotRef.name + name: VolumeSnapshot + type: string + - description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. + jsonPath: .spec.volumeSnapshotRef.namespace + name: VolumeSnapshotNamespace + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + # This indicates the v1beta1 version of the custom resource is deprecated. + # API requests to this version receive a warning in the server response. + deprecated: true + # This overrides the default warning returned to clients making v1beta1 API requests. + deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotContent is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotContent" + schema: + openAPIV3Schema: + description: VolumeSnapshotContent represents the actual "on-disk" snapshot object in the underlying storage system + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + spec: + description: spec defines properties of a VolumeSnapshotContent created by the underlying storage system. Required. + properties: + deletionPolicy: + description: deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. For dynamically provisioned snapshots, this field will automatically be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding VolumeSnapshotClass. For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object. Required. + enum: + - Delete + - Retain + type: string + driver: + description: driver is the name of the CSI driver used to create the physical snapshot on the underlying storage system. This MUST be the same as the name returned by the CSI GetPluginName() call for that driver. Required. + type: string + source: + description: source specifies whether the snapshot is (or should be) dynamically provisioned or already exists, and just requires a Kubernetes object representation. This field is immutable after creation. Required. + properties: + snapshotHandle: + description: snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on the underlying storage system for which a Kubernetes object representation was (or should be) created. This field is immutable. + type: string + volumeHandle: + description: volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot should be dynamically taken from. This field is immutable. + type: string + type: object + volumeSnapshotClassName: + description: name of the VolumeSnapshotClass from which this snapshot was (or will be) created. Note that after provisioning, the VolumeSnapshotClass may be deleted or recreated with different set of values, and as such, should not be referenced post-snapshot creation. + type: string + volumeSnapshotRef: + description: volumeSnapshotRef specifies the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to this VolumeSnapshotContent's name for the bidirectional binding to be valid. For a pre-existing VolumeSnapshotContent object, name and namespace of the VolumeSnapshot object MUST be provided for binding to happen. This field is immutable after creation. Required. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + required: + - deletionPolicy + - driver + - source + - volumeSnapshotRef + type: object + status: + description: status represents the current information of a snapshot. + properties: + creationTime: + description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it indicates the creation time is unknown. The format of this field is a Unix nanoseconds time encoded as an int64. On Unix, the command `date +%s%N` returns the current time in nanoseconds since 1970-01-01 00:00:00 UTC. + format: int64 + type: integer + error: + description: error is the last observed error during snapshot creation, if any. Upon success after retry, this error field will be cleared. + properties: + message: + description: 'message is a string detailing the encountered error during snapshot creation if specified. NOTE: message may be logged, and it should not contain sensitive information.' + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: readyToUse indicates if a snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown. + type: boolean + restoreSize: + description: restoreSize represents the complete size of the snapshot in bytes. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown. + format: int64 + minimum: 0 + type: integer + snapshotHandle: + description: snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. If not specified, it indicates that dynamic snapshot creation has either failed or it is still in progress. + type: string + type: object + required: + - spec + type: object + served: false + storage: false + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1337" + controller-gen.kubebuilder.io/version: v0.15.0 +{{- if .KeepCRDs }} + helm.sh/resource-policy: keep +{{- end }} + name: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io +spec: + group: groupsnapshot.storage.k8s.io + names: + kind: VolumeGroupSnapshotClass + listKind: VolumeGroupSnapshotClassList + plural: volumegroupsnapshotclasses + shortNames: + - vgsclass + - vgsclasses + singular: volumegroupsnapshotclass + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .driver + name: Driver + type: string + - description: Determines whether a VolumeGroupSnapshotContent created through the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot is deleted. + jsonPath: .deletionPolicy + name: DeletionPolicy + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshotClass specifies parameters that a underlying storage system + uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass + is used by specifying its name in a VolumeGroupSnapshot object. + VolumeGroupSnapshotClasses are non-namespaced. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + deletionPolicy: + description: |- + DeletionPolicy determines whether a VolumeGroupSnapshotContent created + through the VolumeGroupSnapshotClass should be deleted when its bound + VolumeGroupSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are kept. + "Delete" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are deleted. + Required. + enum: + - Delete + - Retain + type: string + x-kubernetes-validations: + - message: deletionPolicy is immutable once set + rule: self == oldSelf + driver: + description: |- + Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass. + Required. + type: string + x-kubernetes-validations: + - message: driver is immutable once set + rule: self == oldSelf + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + parameters: + additionalProperties: + type: string + description: |- + Parameters is a key-value map with storage driver specific parameters for + creating group snapshots. + These values are opaque to Kubernetes and are passed directly to the driver. + type: object + x-kubernetes-validations: + - message: parameters are immutable once set + rule: self == oldSelf + required: + - deletionPolicy + - driver + type: object + served: true + storage: false + subresources: {} + - additionalPrinterColumns: + - jsonPath: .driver + name: Driver + type: string + - description: Determines whether a VolumeGroupSnapshotContent created through the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot is deleted. + jsonPath: .deletionPolicy + name: DeletionPolicy + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + deprecated: true + name: v1beta1 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshotClass specifies parameters that a underlying storage system + uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass + is used by specifying its name in a VolumeGroupSnapshot object. + VolumeGroupSnapshotClasses are non-namespaced. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + deletionPolicy: + description: |- + DeletionPolicy determines whether a VolumeGroupSnapshotContent created + through the VolumeGroupSnapshotClass should be deleted when its bound + VolumeGroupSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are kept. + "Delete" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are deleted. + Required. + enum: + - Delete + - Retain + type: string + driver: + description: |- + Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass. + Required. + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + parameters: + additionalProperties: + type: string + description: |- + Parameters is a key-value map with storage driver specific parameters for + creating group snapshots. + These values are opaque to Kubernetes and are passed directly to the driver. + type: object + required: + - deletionPolicy + - driver + type: object + served: true + storage: false + subresources: {} + - additionalPrinterColumns: + - jsonPath: .driver + name: Driver + type: string + - description: Determines whether a VolumeGroupSnapshotContent created through the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot is deleted. + jsonPath: .deletionPolicy + name: DeletionPolicy + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta2 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshotClass specifies parameters that a underlying storage system + uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass + is used by specifying its name in a VolumeGroupSnapshot object. + VolumeGroupSnapshotClasses are non-namespaced. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + deletionPolicy: + description: |- + DeletionPolicy determines whether a VolumeGroupSnapshotContent created + through the VolumeGroupSnapshotClass should be deleted when its bound + VolumeGroupSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are kept. + "Delete" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are deleted. + Required. + enum: + - Delete + - Retain + type: string + x-kubernetes-validations: + - message: deletionPolicy is immutable once set + rule: self == oldSelf + driver: + description: |- + Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass. + Required. + type: string + x-kubernetes-validations: + - message: driver is immutable once set + rule: self == oldSelf + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + parameters: + additionalProperties: + type: string + description: |- + Parameters is a key-value map with storage driver specific parameters for + creating group snapshots. + These values are opaque to Kubernetes and are passed directly to the driver. + type: object + x-kubernetes-validations: + - message: parameters are immutable once set + rule: self == oldSelf + required: + - deletionPolicy + - driver + type: object + served: true + storage: true + subresources: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1337" + controller-gen.kubebuilder.io/version: v0.15.0 + {{ if .InsertCaFrom }}cert-manager.io/inject-ca-from: '{{ .InsertCaFrom }}'{{ end }} +{{- if .KeepCRDs }} + helm.sh/resource-policy: keep +{{- end }} + name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io +spec: + group: groupsnapshot.storage.k8s.io + names: + kind: VolumeGroupSnapshotContent + listKind: VolumeGroupSnapshotContentList + plural: volumegroupsnapshotcontents + shortNames: + - vgsc + - vgscs + singular: volumegroupsnapshotcontent + scope: Cluster + versions: + - additionalPrinterColumns: + - description: Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: Determines whether this VolumeGroupSnapshotContent and its physical group snapshot on the underlying storage system should be deleted when its bound VolumeGroupSnapshot is deleted. + jsonPath: .spec.deletionPolicy + name: DeletionPolicy + type: string + - description: Name of the CSI driver used to create the physical group snapshot on the underlying storage system. + jsonPath: .spec.driver + name: Driver + type: string + - description: Name of the VolumeGroupSnapshotClass from which this group snapshot was (or will be) created. + jsonPath: .spec.volumeGroupSnapshotClassName + name: VolumeGroupSnapshotClass + type: string + - description: Namespace of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound. + jsonPath: .spec.volumeGroupSnapshotRef.namespace + name: VolumeGroupSnapshotNamespace + type: string + - description: Name of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound. + jsonPath: .spec.volumeGroupSnapshotRef.name + name: VolumeGroupSnapshot + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshotContent represents the actual "on-disk" group snapshot object + in the underlying storage system + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + Spec defines properties of a VolumeGroupSnapshotContent created by the underlying storage system. + Required. + properties: + deletionPolicy: + description: |- + DeletionPolicy determines whether this VolumeGroupSnapshotContent and the + physical group snapshot on the underlying storage system should be deleted + when the bound VolumeGroupSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are kept. + "Delete" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are deleted. + For dynamically provisioned group snapshots, this field will automatically + be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field + defined in the corresponding VolumeGroupSnapshotClass. + For pre-existing snapshots, users MUST specify this field when creating the + VolumeGroupSnapshotContent object. + Required. + enum: + - Delete + - Retain + type: string + driver: + description: |- + Driver is the name of the CSI driver used to create the physical group snapshot on + the underlying storage system. + This MUST be the same as the name returned by the CSI GetPluginName() call for + that driver. + Required. + type: string + x-kubernetes-validations: + - message: driver is immutable once set + rule: self == oldSelf + source: + description: |- + Source specifies whether the snapshot is (or should be) dynamically provisioned + or already exists, and just requires a Kubernetes object representation. + This field is immutable after creation. + Required. + properties: + groupSnapshotHandles: + description: |- + GroupSnapshotHandles specifies the CSI "group_snapshot_id" of a pre-existing + group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots + on the underlying storage system for which a Kubernetes object + representation was (or should be) created. + This field is immutable. + properties: + volumeGroupSnapshotHandle: + description: |- + VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing + group snapshot on the underlying storage system for which a Kubernetes object + representation was (or should be) created. + This field is immutable. + Required. + type: string + volumeSnapshotHandles: + description: |- + VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing + snapshots on the underlying storage system for which Kubernetes objects + representation were (or should be) created. + This field is immutable. + Required. + items: + type: string + type: array + required: + - volumeGroupSnapshotHandle + - volumeSnapshotHandles + type: object + x-kubernetes-validations: + - message: groupSnapshotHandles is immutable + rule: self == oldSelf + volumeHandles: + description: |- + VolumeHandles is a list of volume handles on the backend to be snapshotted + together. It is specified for dynamic provisioning of the VolumeGroupSnapshot. + This field is immutable. + items: + type: string + type: array + x-kubernetes-validations: + - message: volumeHandles is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: volumeHandles is required once set + rule: '!has(oldSelf.volumeHandles) || has(self.volumeHandles)' + - message: groupSnapshotHandles is required once set + rule: '!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)' + - message: exactly one of volumeHandles and groupSnapshotHandles must be set + rule: (has(self.volumeHandles) && !has(self.groupSnapshotHandles)) || (!has(self.volumeHandles) && has(self.groupSnapshotHandles)) + volumeGroupSnapshotClassName: + description: |- + VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from + which this group snapshot was (or will be) created. + Note that after provisioning, the VolumeGroupSnapshotClass may be deleted or + recreated with different set of values, and as such, should not be referenced + post-snapshot creation. + For dynamic provisioning, this field must be set. + This field may be unset for pre-provisioned snapshots. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotClassName is immutable once set + rule: self == oldSelf + volumeGroupSnapshotRef: + description: |- + VolumeGroupSnapshotRef specifies the VolumeGroupSnapshot object to which this + VolumeGroupSnapshotContent object is bound. + VolumeGroupSnapshot.Spec.VolumeGroupSnapshotContentName field must reference to + this VolumeGroupSnapshotContent's name for the bidirectional binding to be valid. + For a pre-existing VolumeGroupSnapshotContent object, name and namespace of the + VolumeGroupSnapshot object MUST be provided for binding to happen. + This field is immutable after creation. + Required. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set + rule: has(self.name) && has(self.__namespace__) + - message: volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace are immutable + rule: self.name == oldSelf.name && self.__namespace__ == oldSelf.__namespace__ + - message: volumeGroupSnapshotRef.uid is immutable once set + rule: '!has(oldSelf.uid) || (has(self.uid) && self.uid == oldSelf.uid)' + required: + - deletionPolicy + - driver + - source + - volumeGroupSnapshotRef + type: object + status: + description: status represents the current information of a group snapshot. + properties: + creationTime: + description: |- + CreationTime is the timestamp when the point-in-time group snapshot is taken + by the underlying storage system. + If not specified, it indicates the creation time is unknown. + If not specified, it means the readiness of a group snapshot is unknown. + This field is the source for the CreationTime field in VolumeGroupSnapshotStatus + format: date-time + type: string + error: + description: |- + Error is the last observed error during group snapshot creation, if any. + Upon success after retry, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + ReadyToUse indicates if all the individual snapshots in the group are ready to be + used to restore a group of volumes. + ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + type: boolean + volumeGroupSnapshotHandle: + description: |- + VolumeGroupSnapshotHandle is a unique id returned by the CSI driver + to identify the VolumeGroupSnapshot on the storage system. + If a storage system does not provide such an id, the + CSI driver can choose to return the VolumeGroupSnapshot name. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotHandle is immutable once set + rule: self == oldSelf + volumeSnapshotInfoList: + description: |- + This field is introduced in v1beta2 + It is replacing VolumeSnapshotHandlePairList + VolumeSnapshotInfoList is a list of snapshot information returned by + by the CSI driver to identify snapshots on the storage system. + items: + description: |- + The VolumeSnapshotInfo struct is added in v1beta2 + VolumeSnapshotInfo contains information for a snapshot + properties: + creationTime: + description: |- + creationTime is the timestamp when the point-in-time snapshot is taken + by the underlying storage system. + format: int64 + type: integer + readyToUse: + description: ReadyToUse indicates if the snapshot is ready to be used to restore a volume. + type: boolean + restoreSize: + description: |- + RestoreSize represents the minimum size of volume required to create a volume + from this snapshot. + format: int64 + type: integer + snapshotHandle: + description: SnapshotHandle is the CSI "snapshot_id" of this snapshot on the underlying storage system. + type: string + volumeHandle: + description: |- + VolumeHandle specifies the CSI "volume_id" of the volume from which this snapshot + was taken from. + type: string + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: Determines whether this VolumeGroupSnapshotContent and its physical group snapshot on the underlying storage system should be deleted when its bound VolumeGroupSnapshot is deleted. + jsonPath: .spec.deletionPolicy + name: DeletionPolicy + type: string + - description: Name of the CSI driver used to create the physical group snapshot on the underlying storage system. + jsonPath: .spec.driver + name: Driver + type: string + - description: Name of the VolumeGroupSnapshotClass from which this group snapshot was (or will be) created. + jsonPath: .spec.volumeGroupSnapshotClassName + name: VolumeGroupSnapshotClass + type: string + - description: Namespace of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound. + jsonPath: .spec.volumeGroupSnapshotRef.namespace + name: VolumeGroupSnapshotNamespace + type: string + - description: Name of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound. + jsonPath: .spec.volumeGroupSnapshotRef.name + name: VolumeGroupSnapshot + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + deprecated: true + name: v1beta1 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshotContent represents the actual "on-disk" group snapshot object + in the underlying storage system + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + Spec defines properties of a VolumeGroupSnapshotContent created by the underlying storage system. + Required. + properties: + deletionPolicy: + description: |- + DeletionPolicy determines whether this VolumeGroupSnapshotContent and the + physical group snapshot on the underlying storage system should be deleted + when the bound VolumeGroupSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are kept. + "Delete" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are deleted. + For dynamically provisioned group snapshots, this field will automatically + be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field + defined in the corresponding VolumeGroupSnapshotClass. + For pre-existing snapshots, users MUST specify this field when creating the + VolumeGroupSnapshotContent object. + Required. + enum: + - Delete + - Retain + type: string + driver: + description: |- + Driver is the name of the CSI driver used to create the physical group snapshot on + the underlying storage system. + This MUST be the same as the name returned by the CSI GetPluginName() call for + that driver. + Required. + type: string + source: + description: |- + Source specifies whether the snapshot is (or should be) dynamically provisioned + or already exists, and just requires a Kubernetes object representation. + This field is immutable after creation. + Required. + properties: + groupSnapshotHandles: + description: |- + GroupSnapshotHandles specifies the CSI "group_snapshot_id" of a pre-existing + group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots + on the underlying storage system for which a Kubernetes object + representation was (or should be) created. + This field is immutable. + properties: + volumeGroupSnapshotHandle: + description: |- + VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing + group snapshot on the underlying storage system for which a Kubernetes object + representation was (or should be) created. + This field is immutable. + Required. + type: string + volumeSnapshotHandles: + description: |- + VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing + snapshots on the underlying storage system for which Kubernetes objects + representation were (or should be) created. + This field is immutable. + Required. + items: + type: string + type: array + required: + - volumeGroupSnapshotHandle + - volumeSnapshotHandles + type: object + x-kubernetes-validations: + - message: groupSnapshotHandles is immutable + rule: self == oldSelf + volumeHandles: + description: |- + VolumeHandles is a list of volume handles on the backend to be snapshotted + together. It is specified for dynamic provisioning of the VolumeGroupSnapshot. + This field is immutable. + items: + type: string + type: array + x-kubernetes-validations: + - message: volumeHandles is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: volumeHandles is required once set + rule: '!has(oldSelf.volumeHandles) || has(self.volumeHandles)' + - message: groupSnapshotHandles is required once set + rule: '!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)' + - message: exactly one of volumeHandles and groupSnapshotHandles must be set + rule: (has(self.volumeHandles) && !has(self.groupSnapshotHandles)) || (!has(self.volumeHandles) && has(self.groupSnapshotHandles)) + volumeGroupSnapshotClassName: + description: |- + VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from + which this group snapshot was (or will be) created. + Note that after provisioning, the VolumeGroupSnapshotClass may be deleted or + recreated with different set of values, and as such, should not be referenced + post-snapshot creation. + For dynamic provisioning, this field must be set. + This field may be unset for pre-provisioned snapshots. + type: string + volumeGroupSnapshotRef: + description: |- + VolumeGroupSnapshotRef specifies the VolumeGroupSnapshot object to which this + VolumeGroupSnapshotContent object is bound. + VolumeGroupSnapshot.Spec.VolumeGroupSnapshotContentName field must reference to + this VolumeGroupSnapshotContent's name for the bidirectional binding to be valid. + For a pre-existing VolumeGroupSnapshotContent object, name and namespace of the + VolumeGroupSnapshot object MUST be provided for binding to happen. + This field is immutable after creation. + Required. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set + rule: has(self.name) && has(self.__namespace__) + required: + - deletionPolicy + - driver + - source + - volumeGroupSnapshotRef + type: object + status: + description: status represents the current information of a group snapshot. + properties: + creationTime: + description: |- + CreationTime is the timestamp when the point-in-time group snapshot is taken + by the underlying storage system. + If not specified, it indicates the creation time is unknown. + If not specified, it means the readiness of a group snapshot is unknown. + The format of this field is a Unix nanoseconds time encoded as an int64. + On Unix, the command date +%s%N returns the current time in nanoseconds + since 1970-01-01 00:00:00 UTC. + This field is the source for the CreationTime field in VolumeGroupSnapshotStatus + format: date-time + type: string + error: + description: |- + Error is the last observed error during group snapshot creation, if any. + Upon success after retry, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + ReadyToUse indicates if all the individual snapshots in the group are ready to be + used to restore a group of volumes. + ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + type: boolean + volumeGroupSnapshotHandle: + description: |- + VolumeGroupSnapshotHandle is a unique id returned by the CSI driver + to identify the VolumeGroupSnapshot on the storage system. + If a storage system does not provide such an id, the + CSI driver can choose to return the VolumeGroupSnapshot name. + type: string + volumeSnapshotHandlePairList: + description: |- + VolumeSnapshotHandlePairList is a list of CSI "volume_id" and "snapshot_id" + pair returned by the CSI driver to identify snapshots and their source volumes + on the storage system. + items: + description: VolumeSnapshotHandlePair defines a pair of a source volume handle and a snapshot handle + properties: + snapshotHandle: + description: |- + SnapshotHandle is a unique id returned by the CSI driver to identify a volume + snapshot on the storage system + Required. + type: string + volumeHandle: + description: |- + VolumeHandle is a unique id returned by the CSI driver to identify a volume + on the storage system + Required. + type: string + required: + - snapshotHandle + - volumeHandle + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: Determines whether this VolumeGroupSnapshotContent and its physical group snapshot on the underlying storage system should be deleted when its bound VolumeGroupSnapshot is deleted. + jsonPath: .spec.deletionPolicy + name: DeletionPolicy + type: string + - description: Name of the CSI driver used to create the physical group snapshot on the underlying storage system. + jsonPath: .spec.driver + name: Driver + type: string + - description: Name of the VolumeGroupSnapshotClass from which this group snapshot was (or will be) created. + jsonPath: .spec.volumeGroupSnapshotClassName + name: VolumeGroupSnapshotClass + type: string + - description: Namespace of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound. + jsonPath: .spec.volumeGroupSnapshotRef.namespace + name: VolumeGroupSnapshotNamespace + type: string + - description: Name of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent object is bound. + jsonPath: .spec.volumeGroupSnapshotRef.name + name: VolumeGroupSnapshot + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta2 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshotContent represents the actual "on-disk" group snapshot object + in the underlying storage system + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + Spec defines properties of a VolumeGroupSnapshotContent created by the underlying storage system. + Required. + properties: + deletionPolicy: + description: |- + DeletionPolicy determines whether this VolumeGroupSnapshotContent and the + physical group snapshot on the underlying storage system should be deleted + when the bound VolumeGroupSnapshot is deleted. + Supported values are "Retain" and "Delete". + "Retain" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are kept. + "Delete" means that the VolumeGroupSnapshotContent and its physical group + snapshot on underlying storage system are deleted. + For dynamically provisioned group snapshots, this field will automatically + be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field + defined in the corresponding VolumeGroupSnapshotClass. + For pre-existing snapshots, users MUST specify this field when creating the + VolumeGroupSnapshotContent object. + Required. + enum: + - Delete + - Retain + type: string + driver: + description: |- + Driver is the name of the CSI driver used to create the physical group snapshot on + the underlying storage system. + This MUST be the same as the name returned by the CSI GetPluginName() call for + that driver. + Required. + type: string + x-kubernetes-validations: + - message: driver is immutable once set + rule: self == oldSelf + source: + description: |- + Source specifies whether the snapshot is (or should be) dynamically provisioned + or already exists, and just requires a Kubernetes object representation. + This field is immutable after creation. + Required. + properties: + groupSnapshotHandles: + description: |- + GroupSnapshotHandles specifies the CSI "group_snapshot_id" of a pre-existing + group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots + on the underlying storage system for which a Kubernetes object + representation was (or should be) created. + This field is immutable. + properties: + volumeGroupSnapshotHandle: + description: |- + VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing + group snapshot on the underlying storage system for which a Kubernetes object + representation was (or should be) created. + This field is immutable. + Required. + type: string + volumeSnapshotHandles: + description: |- + VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing + snapshots on the underlying storage system for which Kubernetes objects + representation were (or should be) created. + This field is immutable. + Required. + items: + type: string + type: array + required: + - volumeGroupSnapshotHandle + - volumeSnapshotHandles + type: object + x-kubernetes-validations: + - message: groupSnapshotHandles is immutable + rule: self == oldSelf + volumeHandles: + description: |- + VolumeHandles is a list of volume handles on the backend to be snapshotted + together. It is specified for dynamic provisioning of the VolumeGroupSnapshot. + This field is immutable. + items: + type: string + type: array + x-kubernetes-validations: + - message: volumeHandles is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: volumeHandles is required once set + rule: '!has(oldSelf.volumeHandles) || has(self.volumeHandles)' + - message: groupSnapshotHandles is required once set + rule: '!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)' + - message: exactly one of volumeHandles and groupSnapshotHandles must be set + rule: (has(self.volumeHandles) && !has(self.groupSnapshotHandles)) || (!has(self.volumeHandles) && has(self.groupSnapshotHandles)) + volumeGroupSnapshotClassName: + description: |- + VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from + which this group snapshot was (or will be) created. + Note that after provisioning, the VolumeGroupSnapshotClass may be deleted or + recreated with different set of values, and as such, should not be referenced + post-snapshot creation. + For dynamic provisioning, this field must be set. + This field may be unset for pre-provisioned snapshots. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotClassName is immutable once set + rule: self == oldSelf + volumeGroupSnapshotRef: + description: |- + VolumeGroupSnapshotRef specifies the VolumeGroupSnapshot object to which this + VolumeGroupSnapshotContent object is bound. + VolumeGroupSnapshot.Spec.VolumeGroupSnapshotContentName field must reference to + this VolumeGroupSnapshotContent's name for the bidirectional binding to be valid. + For a pre-existing VolumeGroupSnapshotContent object, name and namespace of the + VolumeGroupSnapshot object MUST be provided for binding to happen. + This field is immutable after creation. + Required. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + TODO: this design is not final and this field is subject to change in the future. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set + rule: has(self.name) && has(self.__namespace__) + - message: volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace are immutable + rule: self.name == oldSelf.name && self.__namespace__ == oldSelf.__namespace__ + - message: volumeGroupSnapshotRef.uid is immutable once set + rule: '!has(oldSelf.uid) || (has(self.uid) && self.uid == oldSelf.uid)' + required: + - deletionPolicy + - driver + - source + - volumeGroupSnapshotRef + type: object + status: + description: status represents the current information of a group snapshot. + properties: + creationTime: + description: |- + CreationTime is the timestamp when the point-in-time group snapshot is taken + by the underlying storage system. + If not specified, it indicates the creation time is unknown. + If not specified, it means the readiness of a group snapshot is unknown. + This field is the source for the CreationTime field in VolumeGroupSnapshotStatus + format: date-time + type: string + error: + description: |- + Error is the last observed error during group snapshot creation, if any. + Upon success after retry, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + ReadyToUse indicates if all the individual snapshots in the group are ready to be + used to restore a group of volumes. + ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + type: boolean + volumeGroupSnapshotHandle: + description: |- + VolumeGroupSnapshotHandle is a unique id returned by the CSI driver + to identify the VolumeGroupSnapshot on the storage system. + If a storage system does not provide such an id, the + CSI driver can choose to return the VolumeGroupSnapshot name. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotHandle is immutable once set + rule: self == oldSelf + volumeSnapshotInfoList: + description: |- + This field is introduced in v1beta2 + It is replacing VolumeSnapshotHandlePairList + VolumeSnapshotInfoList is a list of snapshot information returned by + by the CSI driver to identify snapshots on the storage system. + items: + description: |- + The VolumeSnapshotInfo struct is added in v1beta2 + VolumeSnapshotInfo contains information for a snapshot + properties: + creationTime: + description: |- + creationTime is the timestamp when the point-in-time snapshot is taken + by the underlying storage system. + format: int64 + type: integer + readyToUse: + description: ReadyToUse indicates if the snapshot is ready to be used to restore a volume. + type: boolean + restoreSize: + description: |- + RestoreSize represents the minimum size of volume required to create a volume + from this snapshot. + format: int64 + type: integer + snapshotHandle: + description: SnapshotHandle is the CSI "snapshot_id" of this snapshot on the underlying storage system. + type: string + volumeHandle: + description: |- + VolumeHandle specifies the CSI "volume_id" of the volume from which this snapshot + was taken from. + type: string + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +{{- if .WebhookEnabled }} + conversion: + strategy: Webhook + webhook: + conversionReviewVersions: + - v1 + clientConfig: {{ toJson .ClientConfig }} +{{- end }} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1337" + controller-gen.kubebuilder.io/version: v0.15.0 +{{- if .KeepCRDs }} + helm.sh/resource-policy: keep +{{- end }} + name: volumegroupsnapshots.groupsnapshot.storage.k8s.io +spec: + group: groupsnapshot.storage.k8s.io + names: + kind: VolumeGroupSnapshot + listKind: VolumeGroupSnapshotList + plural: volumegroupsnapshots + shortNames: + - vgs + singular: volumegroupsnapshot + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: The name of the VolumeGroupSnapshotClass requested by the VolumeGroupSnapshot. + jsonPath: .spec.volumeGroupSnapshotClassName + name: VolumeGroupSnapshotClass + type: string + - description: Name of the VolumeGroupSnapshotContent object to which the VolumeGroupSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeGroupSnapshot and VolumeGroupSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object. + jsonPath: .status.boundVolumeGroupSnapshotContentName + name: VolumeGroupSnapshotContent + type: string + - description: Timestamp when the point-in-time group snapshot was taken by the underlying storage system. + jsonPath: .status.creationTime + name: CreationTime + type: date + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshot is a user's request for creating either a point-in-time + group snapshot or binding to a pre-existing group snapshot. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + Spec defines the desired characteristics of a group snapshot requested by a user. + Required. + properties: + source: + description: |- + Source specifies where a group snapshot will be created from. + This field is immutable after creation. + Required. + properties: + selector: + description: |- + Selector is a label query over persistent volume claims that are to be + grouped together for snapshotting. + This labelSelector will be used to match the label added to a PVC. + If the label is added or removed to a volume after a group snapshot + is created, the existing group snapshots won't be modified. + Once a VolumeGroupSnapshotContent is created and the sidecar starts to process + it, the volume list will not change with retries. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: selector is immutable + rule: self == oldSelf + volumeGroupSnapshotContentName: + description: |- + VolumeGroupSnapshotContentName specifies the name of a pre-existing VolumeGroupSnapshotContent + object representing an existing volume group snapshot. + This field should be set if the volume group snapshot already exists and + only needs a representation in Kubernetes. + This field is immutable. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotContentName is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: selector is required once set + rule: '!has(oldSelf.selector) || has(self.selector)' + - message: volumeGroupSnapshotContentName is required once set + rule: '!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)' + - message: exactly one of selector and volumeGroupSnapshotContentName must be set + rule: (has(self.selector) && !has(self.volumeGroupSnapshotContentName)) || (!has(self.selector) && has(self.volumeGroupSnapshotContentName)) + volumeGroupSnapshotClassName: + description: |- + VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass + requested by the VolumeGroupSnapshot. + VolumeGroupSnapshotClassName may be left nil to indicate that the default + class will be used. + Empty string is not allowed for this field. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotClassName must not be the empty string when set + rule: size(self) > 0 + required: + - source + type: object + status: + description: |- + Status represents the current information of a group snapshot. + Consumers must verify binding between VolumeGroupSnapshot and + VolumeGroupSnapshotContent objects is successful (by validating that both + VolumeGroupSnapshot and VolumeGroupSnapshotContent point to each other) before + using this object. + properties: + boundVolumeGroupSnapshotContentName: + description: |- + BoundVolumeGroupSnapshotContentName is the name of the VolumeGroupSnapshotContent + object to which this VolumeGroupSnapshot object intends to bind to. + If not specified, it indicates that the VolumeGroupSnapshot object has not + been successfully bound to a VolumeGroupSnapshotContent object yet. + NOTE: To avoid possible security issues, consumers must verify binding between + VolumeGroupSnapshot and VolumeGroupSnapshotContent objects is successful + (by validating that both VolumeGroupSnapshot and VolumeGroupSnapshotContent + point at each other) before using this object. + type: string + x-kubernetes-validations: + - message: boundVolumeGroupSnapshotContentName is immutable once set + rule: self == oldSelf + creationTime: + description: |- + CreationTime is the timestamp when the point-in-time group snapshot is taken + by the underlying storage system. + If not specified, it may indicate that the creation time of the group snapshot + is unknown. + This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus + format: date-time + type: string + error: + description: |- + Error is the last observed error during group snapshot creation, if any. + This field could be helpful to upper level controllers (i.e., application + controller) to decide whether they should continue on waiting for the group + snapshot to be created based on the type of error reported. + The snapshot controller will keep retrying when an error occurs during the + group snapshot creation. Upon success, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + ReadyToUse indicates if all the individual snapshots in the group are ready + to be used to restore a group of volumes. + ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + If not specified, it means the readiness of a group snapshot is unknown. + type: boolean + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: The name of the VolumeGroupSnapshotClass requested by the VolumeGroupSnapshot. + jsonPath: .spec.volumeGroupSnapshotClassName + name: VolumeGroupSnapshotClass + type: string + - description: Name of the VolumeGroupSnapshotContent object to which the VolumeGroupSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeGroupSnapshot and VolumeGroupSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object. + jsonPath: .status.boundVolumeGroupSnapshotContentName + name: VolumeGroupSnapshotContent + type: string + - description: Timestamp when the point-in-time group snapshot was taken by the underlying storage system. + jsonPath: .status.creationTime + name: CreationTime + type: date + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + deprecated: true + name: v1beta1 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshot is a user's request for creating either a point-in-time + group snapshot or binding to a pre-existing group snapshot. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + Spec defines the desired characteristics of a group snapshot requested by a user. + Required. + properties: + source: + description: |- + Source specifies where a group snapshot will be created from. + This field is immutable after creation. + Required. + properties: + selector: + description: |- + Selector is a label query over persistent volume claims that are to be + grouped together for snapshotting. + This labelSelector will be used to match the label added to a PVC. + If the label is added or removed to a volume after a group snapshot + is created, the existing group snapshots won't be modified. + Once a VolumeGroupSnapshotContent is created and the sidecar starts to process + it, the volume list will not change with retries. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: selector is immutable + rule: self == oldSelf + volumeGroupSnapshotContentName: + description: |- + VolumeGroupSnapshotContentName specifies the name of a pre-existing VolumeGroupSnapshotContent + object representing an existing volume group snapshot. + This field should be set if the volume group snapshot already exists and + only needs a representation in Kubernetes. + This field is immutable. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotContentName is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: selector is required once set + rule: '!has(oldSelf.selector) || has(self.selector)' + - message: volumeGroupSnapshotContentName is required once set + rule: '!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)' + - message: exactly one of selector and volumeGroupSnapshotContentName must be set + rule: (has(self.selector) && !has(self.volumeGroupSnapshotContentName)) || (!has(self.selector) && has(self.volumeGroupSnapshotContentName)) + volumeGroupSnapshotClassName: + description: |- + VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass + requested by the VolumeGroupSnapshot. + VolumeGroupSnapshotClassName may be left nil to indicate that the default + class will be used. + Empty string is not allowed for this field. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotClassName must not be the empty string when set + rule: size(self) > 0 + required: + - source + type: object + status: + description: |- + Status represents the current information of a group snapshot. + Consumers must verify binding between VolumeGroupSnapshot and + VolumeGroupSnapshotContent objects is successful (by validating that both + VolumeGroupSnapshot and VolumeGroupSnapshotContent point to each other) before + using this object. + properties: + boundVolumeGroupSnapshotContentName: + description: |- + BoundVolumeGroupSnapshotContentName is the name of the VolumeGroupSnapshotContent + object to which this VolumeGroupSnapshot object intends to bind to. + If not specified, it indicates that the VolumeGroupSnapshot object has not + been successfully bound to a VolumeGroupSnapshotContent object yet. + NOTE: To avoid possible security issues, consumers must verify binding between + VolumeGroupSnapshot and VolumeGroupSnapshotContent objects is successful + (by validating that both VolumeGroupSnapshot and VolumeGroupSnapshotContent + point at each other) before using this object. + type: string + creationTime: + description: |- + CreationTime is the timestamp when the point-in-time group snapshot is taken + by the underlying storage system. + If not specified, it may indicate that the creation time of the group snapshot + is unknown. + The format of this field is a Unix nanoseconds time encoded as an int64. + On Unix, the command date +%s%N returns the current time in nanoseconds + since 1970-01-01 00:00:00 UTC. + This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus + format: date-time + type: string + error: + description: |- + Error is the last observed error during group snapshot creation, if any. + This field could be helpful to upper level controllers (i.e., application + controller) to decide whether they should continue on waiting for the group + snapshot to be created based on the type of error reported. + The snapshot controller will keep retrying when an error occurs during the + group snapshot creation. Upon success, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + ReadyToUse indicates if all the individual snapshots in the group are ready + to be used to restore a group of volumes. + ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + If not specified, it means the readiness of a group snapshot is unknown. + type: boolean + type: object + required: + - spec + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Indicates if all the individual snapshots in the group are ready to be used to restore a group of volumes. + jsonPath: .status.readyToUse + name: ReadyToUse + type: boolean + - description: The name of the VolumeGroupSnapshotClass requested by the VolumeGroupSnapshot. + jsonPath: .spec.volumeGroupSnapshotClassName + name: VolumeGroupSnapshotClass + type: string + - description: Name of the VolumeGroupSnapshotContent object to which the VolumeGroupSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeGroupSnapshot and VolumeGroupSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object. + jsonPath: .status.boundVolumeGroupSnapshotContentName + name: VolumeGroupSnapshotContent + type: string + - description: Timestamp when the point-in-time group snapshot was taken by the underlying storage system. + jsonPath: .status.creationTime + name: CreationTime + type: date + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta2 + schema: + openAPIV3Schema: + description: |- + VolumeGroupSnapshot is a user's request for creating either a point-in-time + group snapshot or binding to a pre-existing group snapshot. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: |- + Spec defines the desired characteristics of a group snapshot requested by a user. + Required. + properties: + source: + description: |- + Source specifies where a group snapshot will be created from. + This field is immutable after creation. + Required. + properties: + selector: + description: |- + Selector is a label query over persistent volume claims that are to be + grouped together for snapshotting. + This labelSelector will be used to match the label added to a PVC. + If the label is added or removed to a volume after a group snapshot + is created, the existing group snapshots won't be modified. + Once a VolumeGroupSnapshotContent is created and the sidecar starts to process + it, the volume list will not change with retries. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + x-kubernetes-validations: + - message: selector is immutable + rule: self == oldSelf + volumeGroupSnapshotContentName: + description: |- + VolumeGroupSnapshotContentName specifies the name of a pre-existing VolumeGroupSnapshotContent + object representing an existing volume group snapshot. + This field should be set if the volume group snapshot already exists and + only needs a representation in Kubernetes. + This field is immutable. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotContentName is immutable + rule: self == oldSelf + type: object + x-kubernetes-validations: + - message: selector is required once set + rule: '!has(oldSelf.selector) || has(self.selector)' + - message: volumeGroupSnapshotContentName is required once set + rule: '!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)' + - message: exactly one of selector and volumeGroupSnapshotContentName must be set + rule: (has(self.selector) && !has(self.volumeGroupSnapshotContentName)) || (!has(self.selector) && has(self.volumeGroupSnapshotContentName)) + volumeGroupSnapshotClassName: + description: |- + VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass + requested by the VolumeGroupSnapshot. + VolumeGroupSnapshotClassName may be left nil to indicate that the default + class will be used. + Empty string is not allowed for this field. + type: string + x-kubernetes-validations: + - message: volumeGroupSnapshotClassName must not be the empty string when set + rule: size(self) > 0 + required: + - source + type: object + status: + description: |- + Status represents the current information of a group snapshot. + Consumers must verify binding between VolumeGroupSnapshot and + VolumeGroupSnapshotContent objects is successful (by validating that both + VolumeGroupSnapshot and VolumeGroupSnapshotContent point to each other) before + using this object. + properties: + boundVolumeGroupSnapshotContentName: + description: |- + BoundVolumeGroupSnapshotContentName is the name of the VolumeGroupSnapshotContent + object to which this VolumeGroupSnapshot object intends to bind to. + If not specified, it indicates that the VolumeGroupSnapshot object has not + been successfully bound to a VolumeGroupSnapshotContent object yet. + NOTE: To avoid possible security issues, consumers must verify binding between + VolumeGroupSnapshot and VolumeGroupSnapshotContent objects is successful + (by validating that both VolumeGroupSnapshot and VolumeGroupSnapshotContent + point at each other) before using this object. + type: string + x-kubernetes-validations: + - message: boundVolumeGroupSnapshotContentName is immutable once set + rule: self == oldSelf + creationTime: + description: |- + CreationTime is the timestamp when the point-in-time group snapshot is taken + by the underlying storage system. + If not specified, it may indicate that the creation time of the group snapshot + is unknown. + This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus + format: date-time + type: string + error: + description: |- + Error is the last observed error during group snapshot creation, if any. + This field could be helpful to upper level controllers (i.e., application + controller) to decide whether they should continue on waiting for the group + snapshot to be created based on the type of error reported. + The snapshot controller will keep retrying when an error occurs during the + group snapshot creation. Upon success, this error field will be cleared. + properties: + message: + description: |- + message is a string detailing the encountered error during snapshot + creation if specified. + NOTE: message may be logged, and it should not contain sensitive + information. + type: string + time: + description: time is the timestamp when the error was encountered. + format: date-time + type: string + type: object + readyToUse: + description: |- + ReadyToUse indicates if all the individual snapshots in the group are ready + to be used to restore a group of volumes. + ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. + If not specified, it means the readiness of a group snapshot is unknown. + type: boolean + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml deleted file mode 100644 index aff3a5719..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml +++ /dev/null @@ -1,94 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" - controller-gen.kubebuilder.io/version: v0.15.0 - name: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io -spec: - group: groupsnapshot.storage.k8s.io - names: - kind: VolumeGroupSnapshotClass - listKind: VolumeGroupSnapshotClassList - plural: volumegroupsnapshotclasses - shortNames: - - vgsclass - - vgsclasses - singular: volumegroupsnapshotclass - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .driver - name: Driver - type: string - - description: Determines whether a VolumeGroupSnapshotContent created through - the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot - is deleted. - jsonPath: .deletionPolicy - name: DeletionPolicy - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha1 - schema: - openAPIV3Schema: - description: |- - VolumeGroupSnapshotClass specifies parameters that a underlying storage system - uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass - is used by specifying its name in a VolumeGroupSnapshot object. - VolumeGroupSnapshotClasses are non-namespaced. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - deletionPolicy: - description: |- - DeletionPolicy determines whether a VolumeGroupSnapshotContent created - through the VolumeGroupSnapshotClass should be deleted when its bound - VolumeGroupSnapshot is deleted. - Supported values are "Retain" and "Delete". - "Retain" means that the VolumeGroupSnapshotContent and its physical group - snapshot on underlying storage system are kept. - "Delete" means that the VolumeGroupSnapshotContent and its physical group - snapshot on underlying storage system are deleted. - Required. - enum: - - Delete - - Retain - type: string - driver: - description: |- - Driver is the name of the storage driver expected to handle this VolumeGroupSnapshotClass. - Required. - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - parameters: - additionalProperties: - type: string - description: |- - Parameters is a key-value map with storage driver specific parameters for - creating group snapshots. - These values are opaque to Kubernetes and are passed directly to the driver. - type: object - required: - - deletionPolicy - - driver - type: object - served: true - storage: true - subresources: {} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml deleted file mode 100644 index 28584e56b..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml +++ /dev/null @@ -1,335 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1068" - controller-gen.kubebuilder.io/version: v0.15.0 - name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io -spec: - group: groupsnapshot.storage.k8s.io - names: - kind: VolumeGroupSnapshotContent - listKind: VolumeGroupSnapshotContentList - plural: volumegroupsnapshotcontents - shortNames: - - vgsc - - vgscs - singular: volumegroupsnapshotcontent - scope: Cluster - versions: - - additionalPrinterColumns: - - description: Indicates if all the individual snapshots in the group are ready - to be used to restore a group of volumes. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: Determines whether this VolumeGroupSnapshotContent and its physical - group snapshot on the underlying storage system should be deleted when its - bound VolumeGroupSnapshot is deleted. - jsonPath: .spec.deletionPolicy - name: DeletionPolicy - type: string - - description: Name of the CSI driver used to create the physical group snapshot - on the underlying storage system. - jsonPath: .spec.driver - name: Driver - type: string - - description: Name of the VolumeGroupSnapshotClass from which this group snapshot - was (or will be) created. - jsonPath: .spec.volumeGroupSnapshotClassName - name: VolumeGroupSnapshotClass - type: string - - description: Namespace of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent - object is bound. - jsonPath: .spec.volumeGroupSnapshotRef.namespace - name: VolumeGroupSnapshotNamespace - type: string - - description: Name of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent - object is bound. - jsonPath: .spec.volumeGroupSnapshotRef.name - name: VolumeGroupSnapshot - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha1 - schema: - openAPIV3Schema: - description: |- - VolumeGroupSnapshotContent represents the actual "on-disk" group snapshot object - in the underlying storage system - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Spec defines properties of a VolumeGroupSnapshotContent created by the underlying storage system. - Required. - properties: - deletionPolicy: - description: |- - DeletionPolicy determines whether this VolumeGroupSnapshotContent and the - physical group snapshot on the underlying storage system should be deleted - when the bound VolumeGroupSnapshot is deleted. - Supported values are "Retain" and "Delete". - "Retain" means that the VolumeGroupSnapshotContent and its physical group - snapshot on underlying storage system are kept. - "Delete" means that the VolumeGroupSnapshotContent and its physical group - snapshot on underlying storage system are deleted. - For dynamically provisioned group snapshots, this field will automatically - be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field - defined in the corresponding VolumeGroupSnapshotClass. - For pre-existing snapshots, users MUST specify this field when creating the - VolumeGroupSnapshotContent object. - Required. - enum: - - Delete - - Retain - type: string - driver: - description: |- - Driver is the name of the CSI driver used to create the physical group snapshot on - the underlying storage system. - This MUST be the same as the name returned by the CSI GetPluginName() call for - that driver. - Required. - type: string - source: - description: |- - Source specifies whether the snapshot is (or should be) dynamically provisioned - or already exists, and just requires a Kubernetes object representation. - This field is immutable after creation. - Required. - properties: - groupSnapshotHandles: - description: |- - GroupSnapshotHandles specifies the CSI "group_snapshot_id" of a pre-existing - group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots - on the underlying storage system for which a Kubernetes object - representation was (or should be) created. - This field is immutable. - properties: - volumeGroupSnapshotHandle: - description: |- - VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing - group snapshot on the underlying storage system for which a Kubernetes object - representation was (or should be) created. - This field is immutable. - Required. - type: string - volumeSnapshotHandles: - description: |- - VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing - snapshots on the underlying storage system for which Kubernetes objects - representation were (or should be) created. - This field is immutable. - Required. - items: - type: string - type: array - required: - - volumeGroupSnapshotHandle - - volumeSnapshotHandles - type: object - x-kubernetes-validations: - - message: groupSnapshotHandles is immutable - rule: self == oldSelf - volumeHandles: - description: |- - VolumeHandles is a list of volume handles on the backend to be snapshotted - together. It is specified for dynamic provisioning of the VolumeGroupSnapshot. - This field is immutable. - items: - type: string - type: array - x-kubernetes-validations: - - message: volumeHandles is immutable - rule: self == oldSelf - type: object - x-kubernetes-validations: - - message: volumeHandles is required once set - rule: '!has(oldSelf.volumeHandles) || has(self.volumeHandles)' - - message: groupSnapshotHandles is required once set - rule: '!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)' - - message: exactly one of volumeHandles and groupSnapshotHandles must - be set - rule: (has(self.volumeHandles) && !has(self.groupSnapshotHandles)) - || (!has(self.volumeHandles) && has(self.groupSnapshotHandles)) - volumeGroupSnapshotClassName: - description: |- - VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass from - which this group snapshot was (or will be) created. - Note that after provisioning, the VolumeGroupSnapshotClass may be deleted or - recreated with different set of values, and as such, should not be referenced - post-snapshot creation. - For dynamic provisioning, this field must be set. - This field may be unset for pre-provisioned snapshots. - type: string - volumeGroupSnapshotRef: - description: |- - VolumeGroupSnapshotRef specifies the VolumeGroupSnapshot object to which this - VolumeGroupSnapshotContent object is bound. - VolumeGroupSnapshot.Spec.VolumeGroupSnapshotContentName field must reference to - this VolumeGroupSnapshotContent's name for the bidirectional binding to be valid. - For a pre-existing VolumeGroupSnapshotContent object, name and namespace of the - VolumeGroupSnapshot object MUST be provided for binding to happen. - This field is immutable after creation. - Required. - properties: - apiVersion: - description: API version of the referent. - type: string - fieldPath: - description: |- - If referring to a piece of an object instead of an entire object, this string - should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container within a pod, this would take on a value like: - "spec.containers{name}" (where "name" refers to the name of the container that triggered - the event) or if no container name is specified "spec.containers[2]" (container with - index 2 in this pod). This syntax is chosen only to have some well-defined way of - referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. - type: string - kind: - description: |- - Kind of the referent. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - namespace: - description: |- - Namespace of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ - type: string - resourceVersion: - description: |- - Specific resourceVersion to which this reference is made, if any. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency - type: string - uid: - description: |- - UID of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids - type: string - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace - must be set - rule: has(self.name) && has(self.__namespace__) - - message: volumeGroupSnapshotRef is immutable - rule: self == oldSelf - required: - - deletionPolicy - - driver - - source - - volumeGroupSnapshotRef - type: object - status: - description: status represents the current information of a group snapshot. - properties: - creationTime: - description: |- - CreationTime is the timestamp when the point-in-time group snapshot is taken - by the underlying storage system. - If not specified, it indicates the creation time is unknown. - If not specified, it means the readiness of a group snapshot is unknown. - The format of this field is a Unix nanoseconds time encoded as an int64. - On Unix, the command date +%s%N returns the current time in nanoseconds - since 1970-01-01 00:00:00 UTC. - format: int64 - type: integer - error: - description: |- - Error is the last observed error during group snapshot creation, if any. - Upon success after retry, this error field will be cleared. - properties: - message: - description: |- - message is a string detailing the encountered error during snapshot - creation if specified. - NOTE: message may be logged, and it should not contain sensitive - information. - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - pvVolumeSnapshotContentList: - description: |- - PVVolumeSnapshotContentList is the list of pairs of PV and - VolumeSnapshotContent for this group snapshot - The maximum number of allowed snapshots in the group is 100. - items: - description: |- - PVVolumeSnapshotContentPair represent a pair of PV names and - VolumeSnapshotContent names - properties: - persistentVolumeRef: - description: PersistentVolumeRef is a reference to the persistent - volume resource - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic - volumeSnapshotContentRef: - description: VolumeSnapshotContentRef is a reference to the - volume snapshot content resource - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic - type: object - type: array - readyToUse: - description: |- - ReadyToUse indicates if all the individual snapshots in the group are ready to be - used to restore a group of volumes. - ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. - type: boolean - volumeGroupSnapshotHandle: - description: |- - VolumeGroupSnapshotHandle is a unique id returned by the CSI driver - to identify the VolumeGroupSnapshot on the storage system. - If a storage system does not provide such an id, the - CSI driver can choose to return the VolumeGroupSnapshot name. - type: string - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml deleted file mode 100644 index 3d9a771de..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/crds/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml +++ /dev/null @@ -1,273 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1068" - controller-gen.kubebuilder.io/version: v0.15.0 - name: volumegroupsnapshots.groupsnapshot.storage.k8s.io -spec: - group: groupsnapshot.storage.k8s.io - names: - kind: VolumeGroupSnapshot - listKind: VolumeGroupSnapshotList - plural: volumegroupsnapshots - shortNames: - - vgs - singular: volumegroupsnapshot - scope: Namespaced - versions: - - additionalPrinterColumns: - - description: Indicates if all the individual snapshots in the group are ready - to be used to restore a group of volumes. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: The name of the VolumeGroupSnapshotClass requested by the VolumeGroupSnapshot. - jsonPath: .spec.volumeGroupSnapshotClassName - name: VolumeGroupSnapshotClass - type: string - - description: Name of the VolumeGroupSnapshotContent object to which the VolumeGroupSnapshot - object intends to bind to. Please note that verification of binding actually - requires checking both VolumeGroupSnapshot and VolumeGroupSnapshotContent - to ensure both are pointing at each other. Binding MUST be verified prior - to usage of this object. - jsonPath: .status.boundVolumeGroupSnapshotContentName - name: VolumeGroupSnapshotContent - type: string - - description: Timestamp when the point-in-time group snapshot was taken by the - underlying storage system. - jsonPath: .status.creationTime - name: CreationTime - type: date - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1alpha1 - schema: - openAPIV3Schema: - description: |- - VolumeGroupSnapshot is a user's request for creating either a point-in-time - group snapshot or binding to a pre-existing group snapshot. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - Spec defines the desired characteristics of a group snapshot requested by a user. - Required. - properties: - source: - description: |- - Source specifies where a group snapshot will be created from. - This field is immutable after creation. - Required. - properties: - selector: - description: |- - Selector is a label query over persistent volume claims that are to be - grouped together for snapshotting. - This labelSelector will be used to match the label added to a PVC. - If the label is added or removed to a volume after a group snapshot - is created, the existing group snapshots won't be modified. - Once a VolumeGroupSnapshotContent is created and the sidecar starts to process - it, the volume list will not change with retries. - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: selector is immutable - rule: self == oldSelf - volumeGroupSnapshotContentName: - description: |- - VolumeGroupSnapshotContentName specifies the name of a pre-existing VolumeGroupSnapshotContent - object representing an existing volume group snapshot. - This field should be set if the volume group snapshot already exists and - only needs a representation in Kubernetes. - This field is immutable. - type: string - x-kubernetes-validations: - - message: volumeGroupSnapshotContentName is immutable - rule: self == oldSelf - type: object - x-kubernetes-validations: - - message: selector is required once set - rule: '!has(oldSelf.selector) || has(self.selector)' - - message: volumeGroupSnapshotContentName is required once set - rule: '!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)' - - message: exactly one of selector and volumeGroupSnapshotContentName - must be set - rule: (has(self.selector) && !has(self.volumeGroupSnapshotContentName)) - || (!has(self.selector) && has(self.volumeGroupSnapshotContentName)) - volumeGroupSnapshotClassName: - description: |- - VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass - requested by the VolumeGroupSnapshot. - VolumeGroupSnapshotClassName may be left nil to indicate that the default - class will be used. - Empty string is not allowed for this field. - type: string - x-kubernetes-validations: - - message: volumeGroupSnapshotClassName must not be the empty string - when set - rule: size(self) > 0 - required: - - source - type: object - status: - description: |- - Status represents the current information of a group snapshot. - Consumers must verify binding between VolumeGroupSnapshot and - VolumeGroupSnapshotContent objects is successful (by validating that both - VolumeGroupSnapshot and VolumeGroupSnapshotContent point to each other) before - using this object. - properties: - boundVolumeGroupSnapshotContentName: - description: |- - BoundVolumeGroupSnapshotContentName is the name of the VolumeGroupSnapshotContent - object to which this VolumeGroupSnapshot object intends to bind to. - If not specified, it indicates that the VolumeGroupSnapshot object has not - been successfully bound to a VolumeGroupSnapshotContent object yet. - NOTE: To avoid possible security issues, consumers must verify binding between - VolumeGroupSnapshot and VolumeGroupSnapshotContent objects is successful - (by validating that both VolumeGroupSnapshot and VolumeGroupSnapshotContent - point at each other) before using this object. - type: string - creationTime: - description: |- - CreationTime is the timestamp when the point-in-time group snapshot is taken - by the underlying storage system. - If not specified, it may indicate that the creation time of the group snapshot - is unknown. - The format of this field is a Unix nanoseconds time encoded as an int64. - On Unix, the command date +%s%N returns the current time in nanoseconds - since 1970-01-01 00:00:00 UTC. - format: date-time - type: string - error: - description: |- - Error is the last observed error during group snapshot creation, if any. - This field could be helpful to upper level controllers (i.e., application - controller) to decide whether they should continue on waiting for the group - snapshot to be created based on the type of error reported. - The snapshot controller will keep retrying when an error occurs during the - group snapshot creation. Upon success, this error field will be cleared. - properties: - message: - description: |- - message is a string detailing the encountered error during snapshot - creation if specified. - NOTE: message may be logged, and it should not contain sensitive - information. - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - pvcVolumeSnapshotRefList: - description: |- - VolumeSnapshotRefList is the list of PVC and VolumeSnapshot pairs that - is part of this group snapshot. - The maximum number of allowed snapshots in the group is 100. - items: - description: PVCVolumeSnapshotPair defines a pair of a PVC reference - and a Volume Snapshot Reference - properties: - persistentVolumeClaimRef: - description: PersistentVolumeClaimRef is a reference to the - PVC this pair is referring to - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic - volumeSnapshotRef: - description: VolumeSnapshotRef is a reference to the VolumeSnapshot - this pair is referring to - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic - type: object - type: array - readyToUse: - description: |- - ReadyToUse indicates if all the individual snapshots in the group are ready - to be used to restore a group of volumes. - ReadyToUse becomes true when ReadyToUse of all individual snapshots become true. - If not specified, it means the readiness of a group snapshot is unknown. - type: boolean - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshotclasses.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshotclasses.yaml deleted file mode 100644 index 8164952a4..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshotclasses.yaml +++ /dev/null @@ -1,143 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" - controller-gen.kubebuilder.io/version: v0.15.0 - name: volumesnapshotclasses.snapshot.storage.k8s.io -spec: - group: snapshot.storage.k8s.io - names: - kind: VolumeSnapshotClass - listKind: VolumeSnapshotClassList - plural: volumesnapshotclasses - shortNames: - - vsclass - - vsclasses - singular: volumesnapshotclass - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .driver - name: Driver - type: string - - description: Determines whether a VolumeSnapshotContent created through the - VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. - jsonPath: .deletionPolicy - name: DeletionPolicy - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: |- - VolumeSnapshotClass specifies parameters that a underlying storage system uses when - creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its - name in a VolumeSnapshot object. - VolumeSnapshotClasses are non-namespaced - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - deletionPolicy: - description: |- - deletionPolicy determines whether a VolumeSnapshotContent created through - the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. - Supported values are "Retain" and "Delete". - "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. - "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. - Required. - enum: - - Delete - - Retain - type: string - driver: - description: |- - driver is the name of the storage driver that handles this VolumeSnapshotClass. - Required. - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - parameters: - additionalProperties: - type: string - description: |- - parameters is a key-value map with storage driver specific parameters for creating snapshots. - These values are opaque to Kubernetes. - type: object - required: - - deletionPolicy - - driver - type: object - served: true - storage: true - subresources: {} - - additionalPrinterColumns: - - jsonPath: .driver - name: Driver - type: string - - description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. - jsonPath: .deletionPolicy - name: DeletionPolicy - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - # This indicates the v1beta1 version of the custom resource is deprecated. - # API requests to this version receive a warning in the server response. - deprecated: true - # This overrides the default warning returned to clients making v1beta1 API requests. - deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotClass is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotClass" - schema: - openAPIV3Schema: - description: VolumeSnapshotClass specifies parameters that a underlying storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses are non-namespaced - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - deletionPolicy: - description: deletionPolicy determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. Required. - enum: - - Delete - - Retain - type: string - driver: - description: driver is the name of the storage driver that handles this VolumeSnapshotClass. Required. - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - parameters: - additionalProperties: - type: string - description: parameters is a key-value map with storage driver specific parameters for creating snapshots. These values are opaque to Kubernetes. - type: object - required: - - deletionPolicy - - driver - type: object - served: false - storage: false - subresources: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshotcontents.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshotcontents.yaml deleted file mode 100644 index cd0c879fc..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshotcontents.yaml +++ /dev/null @@ -1,457 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.15.0 - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955" - name: volumesnapshotcontents.snapshot.storage.k8s.io -spec: - group: snapshot.storage.k8s.io - names: - kind: VolumeSnapshotContent - listKind: VolumeSnapshotContentList - plural: volumesnapshotcontents - shortNames: - - vsc - - vscs - singular: volumesnapshotcontent - scope: Cluster - versions: - - additionalPrinterColumns: - - description: Indicates if the snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: Represents the complete size of the snapshot in bytes - jsonPath: .status.restoreSize - name: RestoreSize - type: integer - - description: Determines whether this VolumeSnapshotContent and its physical - snapshot on the underlying storage system should be deleted when its bound - VolumeSnapshot is deleted. - jsonPath: .spec.deletionPolicy - name: DeletionPolicy - type: string - - description: Name of the CSI driver used to create the physical snapshot on - the underlying storage system. - jsonPath: .spec.driver - name: Driver - type: string - - description: Name of the VolumeSnapshotClass to which this snapshot belongs. - jsonPath: .spec.volumeSnapshotClassName - name: VolumeSnapshotClass - type: string - - description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent - object is bound. - jsonPath: .spec.volumeSnapshotRef.name - name: VolumeSnapshot - type: string - - description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent - object is bound. - jsonPath: .spec.volumeSnapshotRef.namespace - name: VolumeSnapshotNamespace - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: |- - VolumeSnapshotContent represents the actual "on-disk" snapshot object in the - underlying storage system - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - spec defines properties of a VolumeSnapshotContent created by the underlying storage system. - Required. - properties: - deletionPolicy: - description: |- - deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on - the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. - Supported values are "Retain" and "Delete". - "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. - "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. - For dynamically provisioned snapshots, this field will automatically be filled in by the - CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding - VolumeSnapshotClass. - For pre-existing snapshots, users MUST specify this field when creating the - VolumeSnapshotContent object. - Required. - enum: - - Delete - - Retain - type: string - driver: - description: |- - driver is the name of the CSI driver used to create the physical snapshot on - the underlying storage system. - This MUST be the same as the name returned by the CSI GetPluginName() call for - that driver. - Required. - type: string - source: - description: |- - source specifies whether the snapshot is (or should be) dynamically provisioned - or already exists, and just requires a Kubernetes object representation. - This field is immutable after creation. - Required. - properties: - snapshotHandle: - description: |- - snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on - the underlying storage system for which a Kubernetes object representation - was (or should be) created. - This field is immutable. - type: string - x-kubernetes-validations: - - message: snapshotHandle is immutable - rule: self == oldSelf - volumeHandle: - description: |- - volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot - should be dynamically taken from. - This field is immutable. - type: string - x-kubernetes-validations: - - message: volumeHandle is immutable - rule: self == oldSelf - type: object - x-kubernetes-validations: - - message: volumeHandle is required once set - rule: '!has(oldSelf.volumeHandle) || has(self.volumeHandle)' - - message: snapshotHandle is required once set - rule: '!has(oldSelf.snapshotHandle) || has(self.snapshotHandle)' - - message: exactly one of volumeHandle and snapshotHandle must be - set - rule: (has(self.volumeHandle) && !has(self.snapshotHandle)) || (!has(self.volumeHandle) - && has(self.snapshotHandle)) - sourceVolumeMode: - description: |- - SourceVolumeMode is the mode of the volume whose snapshot is taken. - Can be either “Filesystem” or “Block”. - If not specified, it indicates the source volume's mode is unknown. - This field is immutable. - This field is an alpha field. - type: string - x-kubernetes-validations: - - message: sourceVolumeMode is immutable - rule: self == oldSelf - volumeSnapshotClassName: - description: |- - name of the VolumeSnapshotClass from which this snapshot was (or will be) - created. - Note that after provisioning, the VolumeSnapshotClass may be deleted or - recreated with different set of values, and as such, should not be referenced - post-snapshot creation. - type: string - volumeSnapshotRef: - description: |- - volumeSnapshotRef specifies the VolumeSnapshot object to which this - VolumeSnapshotContent object is bound. - VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to - this VolumeSnapshotContent's name for the bidirectional binding to be valid. - For a pre-existing VolumeSnapshotContent object, name and namespace of the - VolumeSnapshot object MUST be provided for binding to happen. - This field is immutable after creation. - Required. - properties: - apiVersion: - description: API version of the referent. - type: string - fieldPath: - description: |- - If referring to a piece of an object instead of an entire object, this string - should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. - For example, if the object reference is to a container within a pod, this would take on a value like: - "spec.containers{name}" (where "name" refers to the name of the container that triggered - the event) or if no container name is specified "spec.containers[2]" (container with - index 2 in this pod). This syntax is chosen only to have some well-defined way of - referencing a part of an object. - TODO: this design is not final and this field is subject to change in the future. - type: string - kind: - description: |- - Kind of the referent. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - type: string - namespace: - description: |- - Namespace of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ - type: string - resourceVersion: - description: |- - Specific resourceVersion to which this reference is made, if any. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency - type: string - uid: - description: |- - UID of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids - type: string - type: object - x-kubernetes-map-type: atomic - x-kubernetes-validations: - - message: both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace - must be set - rule: has(self.name) && has(self.__namespace__) - required: - - deletionPolicy - - driver - - source - - volumeSnapshotRef - type: object - x-kubernetes-validations: - - message: sourceVolumeMode is required once set - rule: '!has(oldSelf.sourceVolumeMode) || has(self.sourceVolumeMode)' - status: - description: status represents the current information of a snapshot. - properties: - creationTime: - description: |- - creationTime is the timestamp when the point-in-time snapshot is taken - by the underlying storage system. - In dynamic snapshot creation case, this field will be filled in by the - CSI snapshotter sidecar with the "creation_time" value returned from CSI - "CreateSnapshot" gRPC call. - For a pre-existing snapshot, this field will be filled with the "creation_time" - value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - If not specified, it indicates the creation time is unknown. - The format of this field is a Unix nanoseconds time encoded as an int64. - On Unix, the command `date +%s%N` returns the current time in nanoseconds - since 1970-01-01 00:00:00 UTC. - format: int64 - type: integer - error: - description: |- - error is the last observed error during snapshot creation, if any. - Upon success after retry, this error field will be cleared. - properties: - message: - description: |- - message is a string detailing the encountered error during snapshot - creation if specified. - NOTE: message may be logged, and it should not contain sensitive - information. - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - readyToUse: - description: |- - readyToUse indicates if a snapshot is ready to be used to restore a volume. - In dynamic snapshot creation case, this field will be filled in by the - CSI snapshotter sidecar with the "ready_to_use" value returned from CSI - "CreateSnapshot" gRPC call. - For a pre-existing snapshot, this field will be filled with the "ready_to_use" - value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, - otherwise, this field will be set to "True". - If not specified, it means the readiness of a snapshot is unknown. - type: boolean - restoreSize: - description: |- - restoreSize represents the complete size of the snapshot in bytes. - In dynamic snapshot creation case, this field will be filled in by the - CSI snapshotter sidecar with the "size_bytes" value returned from CSI - "CreateSnapshot" gRPC call. - For a pre-existing snapshot, this field will be filled with the "size_bytes" - value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - When restoring a volume from this snapshot, the size of the volume MUST NOT - be smaller than the restoreSize if it is specified, otherwise the restoration will fail. - If not specified, it indicates that the size is unknown. - format: int64 - minimum: 0 - type: integer - snapshotHandle: - description: |- - snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. - If not specified, it indicates that dynamic snapshot creation has either failed - or it is still in progress. - type: string - volumeGroupSnapshotHandle: - description: |- - VolumeGroupSnapshotHandle is the CSI "group_snapshot_id" of a group snapshot - on the underlying storage system. - type: string - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} - - additionalPrinterColumns: - - description: Indicates if the snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: Represents the complete size of the snapshot in bytes - jsonPath: .status.restoreSize - name: RestoreSize - type: integer - - description: Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. - jsonPath: .spec.deletionPolicy - name: DeletionPolicy - type: string - - description: Name of the CSI driver used to create the physical snapshot on the underlying storage system. - jsonPath: .spec.driver - name: Driver - type: string - - description: Name of the VolumeSnapshotClass to which this snapshot belongs. - jsonPath: .spec.volumeSnapshotClassName - name: VolumeSnapshotClass - type: string - - description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. - jsonPath: .spec.volumeSnapshotRef.name - name: VolumeSnapshot - type: string - - description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. - jsonPath: .spec.volumeSnapshotRef.namespace - name: VolumeSnapshotNamespace - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - # This indicates the v1beta1 version of the custom resource is deprecated. - # API requests to this version receive a warning in the server response. - deprecated: true - # This overrides the default warning returned to clients making v1beta1 API requests. - deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotContent is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotContent" - schema: - openAPIV3Schema: - description: VolumeSnapshotContent represents the actual "on-disk" snapshot object in the underlying storage system - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - spec: - description: spec defines properties of a VolumeSnapshotContent created by the underlying storage system. Required. - properties: - deletionPolicy: - description: deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. For dynamically provisioned snapshots, this field will automatically be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding VolumeSnapshotClass. For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object. Required. - enum: - - Delete - - Retain - type: string - driver: - description: driver is the name of the CSI driver used to create the physical snapshot on the underlying storage system. This MUST be the same as the name returned by the CSI GetPluginName() call for that driver. Required. - type: string - source: - description: source specifies whether the snapshot is (or should be) dynamically provisioned or already exists, and just requires a Kubernetes object representation. This field is immutable after creation. Required. - properties: - snapshotHandle: - description: snapshotHandle specifies the CSI "snapshot_id" of a pre-existing snapshot on the underlying storage system for which a Kubernetes object representation was (or should be) created. This field is immutable. - type: string - volumeHandle: - description: volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot should be dynamically taken from. This field is immutable. - type: string - type: object - volumeSnapshotClassName: - description: name of the VolumeSnapshotClass from which this snapshot was (or will be) created. Note that after provisioning, the VolumeSnapshotClass may be deleted or recreated with different set of values, and as such, should not be referenced post-snapshot creation. - type: string - volumeSnapshotRef: - description: volumeSnapshotRef specifies the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to this VolumeSnapshotContent's name for the bidirectional binding to be valid. For a pre-existing VolumeSnapshotContent object, name and namespace of the VolumeSnapshot object MUST be provided for binding to happen. This field is immutable after creation. Required. - properties: - apiVersion: - description: API version of the referent. - type: string - fieldPath: - description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' - type: string - kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' - type: string - namespace: - description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' - type: string - resourceVersion: - description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' - type: string - uid: - description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' - type: string - type: object - required: - - deletionPolicy - - driver - - source - - volumeSnapshotRef - type: object - status: - description: status represents the current information of a snapshot. - properties: - creationTime: - description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it indicates the creation time is unknown. The format of this field is a Unix nanoseconds time encoded as an int64. On Unix, the command `date +%s%N` returns the current time in nanoseconds since 1970-01-01 00:00:00 UTC. - format: int64 - type: integer - error: - description: error is the last observed error during snapshot creation, if any. Upon success after retry, this error field will be cleared. - properties: - message: - description: 'message is a string detailing the encountered error during snapshot creation if specified. NOTE: message may be logged, and it should not contain sensitive information.' - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - readyToUse: - description: readyToUse indicates if a snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown. - type: boolean - restoreSize: - description: restoreSize represents the complete size of the snapshot in bytes. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown. - format: int64 - minimum: 0 - type: integer - snapshotHandle: - description: snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. If not specified, it indicates that dynamic snapshot creation has either failed or it is still in progress. - type: string - type: object - required: - - spec - type: object - served: false - storage: false - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshots.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshots.yaml deleted file mode 100644 index 6b96d7082..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/crds/snapshot.storage.k8s.io_volumesnapshots.yaml +++ /dev/null @@ -1,351 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.15.0 - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" - name: volumesnapshots.snapshot.storage.k8s.io -spec: - group: snapshot.storage.k8s.io - names: - kind: VolumeSnapshot - listKind: VolumeSnapshotList - plural: volumesnapshots - shortNames: - - vs - singular: volumesnapshot - scope: Namespaced - versions: - - additionalPrinterColumns: - - description: Indicates if the snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: If a new snapshot needs to be created, this contains the name of - the source PVC from which this snapshot was (or will be) created. - jsonPath: .spec.source.persistentVolumeClaimName - name: SourcePVC - type: string - - description: If a snapshot already exists, this contains the name of the existing - VolumeSnapshotContent object representing the existing snapshot. - jsonPath: .spec.source.volumeSnapshotContentName - name: SourceSnapshotContent - type: string - - description: Represents the minimum size of volume required to rehydrate from - this snapshot. - jsonPath: .status.restoreSize - name: RestoreSize - type: string - - description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot. - jsonPath: .spec.volumeSnapshotClassName - name: SnapshotClass - type: string - - description: Name of the VolumeSnapshotContent object to which the VolumeSnapshot - object intends to bind to. Please note that verification of binding actually - requires checking both VolumeSnapshot and VolumeSnapshotContent to ensure - both are pointing at each other. Binding MUST be verified prior to usage of - this object. - jsonPath: .status.boundVolumeSnapshotContentName - name: SnapshotContent - type: string - - description: Timestamp when the point-in-time snapshot was taken by the underlying - storage system. - jsonPath: .status.creationTime - name: CreationTime - type: date - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: |- - VolumeSnapshot is a user's request for either creating a point-in-time - snapshot of a persistent volume, or binding to a pre-existing snapshot. - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: |- - spec defines the desired characteristics of a snapshot requested by a user. - More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots - Required. - properties: - source: - description: |- - source specifies where a snapshot will be created from. - This field is immutable after creation. - Required. - properties: - persistentVolumeClaimName: - description: |- - persistentVolumeClaimName specifies the name of the PersistentVolumeClaim - object representing the volume from which a snapshot should be created. - This PVC is assumed to be in the same namespace as the VolumeSnapshot - object. - This field should be set if the snapshot does not exists, and needs to be - created. - This field is immutable. - type: string - x-kubernetes-validations: - - message: persistentVolumeClaimName is immutable - rule: self == oldSelf - volumeSnapshotContentName: - description: |- - volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent - object representing an existing volume snapshot. - This field should be set if the snapshot already exists and only needs a representation in Kubernetes. - This field is immutable. - type: string - x-kubernetes-validations: - - message: volumeSnapshotContentName is immutable - rule: self == oldSelf - type: object - x-kubernetes-validations: - - message: persistentVolumeClaimName is required once set - rule: '!has(oldSelf.persistentVolumeClaimName) || has(self.persistentVolumeClaimName)' - - message: volumeSnapshotContentName is required once set - rule: '!has(oldSelf.volumeSnapshotContentName) || has(self.volumeSnapshotContentName)' - - message: exactly one of volumeSnapshotContentName and persistentVolumeClaimName - must be set - rule: (has(self.volumeSnapshotContentName) && !has(self.persistentVolumeClaimName)) - || (!has(self.volumeSnapshotContentName) && has(self.persistentVolumeClaimName)) - volumeSnapshotClassName: - description: |- - VolumeSnapshotClassName is the name of the VolumeSnapshotClass - requested by the VolumeSnapshot. - VolumeSnapshotClassName may be left nil to indicate that the default - SnapshotClass should be used. - A given cluster may have multiple default Volume SnapshotClasses: one - default per CSI Driver. If a VolumeSnapshot does not specify a SnapshotClass, - VolumeSnapshotSource will be checked to figure out what the associated - CSI Driver is, and the default VolumeSnapshotClass associated with that - CSI Driver will be used. If more than one VolumeSnapshotClass exist for - a given CSI Driver and more than one have been marked as default, - CreateSnapshot will fail and generate an event. - Empty string is not allowed for this field. - type: string - x-kubernetes-validations: - - message: volumeSnapshotClassName must not be the empty string when - set - rule: size(self) > 0 - required: - - source - type: object - status: - description: |- - status represents the current information of a snapshot. - Consumers must verify binding between VolumeSnapshot and - VolumeSnapshotContent objects is successful (by validating that both - VolumeSnapshot and VolumeSnapshotContent point at each other) before - using this object. - properties: - boundVolumeSnapshotContentName: - description: |- - boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent - object to which this VolumeSnapshot object intends to bind to. - If not specified, it indicates that the VolumeSnapshot object has not been - successfully bound to a VolumeSnapshotContent object yet. - NOTE: To avoid possible security issues, consumers must verify binding between - VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that - both VolumeSnapshot and VolumeSnapshotContent point at each other) before using - this object. - type: string - creationTime: - description: |- - creationTime is the timestamp when the point-in-time snapshot is taken - by the underlying storage system. - In dynamic snapshot creation case, this field will be filled in by the - snapshot controller with the "creation_time" value returned from CSI - "CreateSnapshot" gRPC call. - For a pre-existing snapshot, this field will be filled with the "creation_time" - value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - If not specified, it may indicate that the creation time of the snapshot is unknown. - format: date-time - type: string - error: - description: |- - error is the last observed error during snapshot creation, if any. - This field could be helpful to upper level controllers(i.e., application controller) - to decide whether they should continue on waiting for the snapshot to be created - based on the type of error reported. - The snapshot controller will keep retrying when an error occurs during the - snapshot creation. Upon success, this error field will be cleared. - properties: - message: - description: |- - message is a string detailing the encountered error during snapshot - creation if specified. - NOTE: message may be logged, and it should not contain sensitive - information. - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - readyToUse: - description: |- - readyToUse indicates if the snapshot is ready to be used to restore a volume. - In dynamic snapshot creation case, this field will be filled in by the - snapshot controller with the "ready_to_use" value returned from CSI - "CreateSnapshot" gRPC call. - For a pre-existing snapshot, this field will be filled with the "ready_to_use" - value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, - otherwise, this field will be set to "True". - If not specified, it means the readiness of a snapshot is unknown. - type: boolean - restoreSize: - type: string - description: |- - restoreSize represents the minimum size of volume required to create a volume - from this snapshot. - In dynamic snapshot creation case, this field will be filled in by the - snapshot controller with the "size_bytes" value returned from CSI - "CreateSnapshot" gRPC call. - For a pre-existing snapshot, this field will be filled with the "size_bytes" - value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. - When restoring a volume from this snapshot, the size of the volume MUST NOT - be smaller than the restoreSize if it is specified, otherwise the restoration will fail. - If not specified, it indicates that the size is unknown. - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - volumeGroupSnapshotName: - description: |- - VolumeGroupSnapshotName is the name of the VolumeGroupSnapshot of which this - VolumeSnapshot is a part of. - type: string - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} - - additionalPrinterColumns: - - description: Indicates if the snapshot is ready to be used to restore a volume. - jsonPath: .status.readyToUse - name: ReadyToUse - type: boolean - - description: If a new snapshot needs to be created, this contains the name of the source PVC from which this snapshot was (or will be) created. - jsonPath: .spec.source.persistentVolumeClaimName - name: SourcePVC - type: string - - description: If a snapshot already exists, this contains the name of the existing VolumeSnapshotContent object representing the existing snapshot. - jsonPath: .spec.source.volumeSnapshotContentName - name: SourceSnapshotContent - type: string - - description: Represents the minimum size of volume required to rehydrate from this snapshot. - jsonPath: .status.restoreSize - name: RestoreSize - type: string - - description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot. - jsonPath: .spec.volumeSnapshotClassName - name: SnapshotClass - type: string - - description: Name of the VolumeSnapshotContent object to which the VolumeSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeSnapshot and VolumeSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object. - jsonPath: .status.boundVolumeSnapshotContentName - name: SnapshotContent - type: string - - description: Timestamp when the point-in-time snapshot was taken by the underlying storage system. - jsonPath: .status.creationTime - name: CreationTime - type: date - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1beta1 - # This indicates the v1beta1 version of the custom resource is deprecated. - # API requests to this version receive a warning in the server response. - deprecated: true - # This overrides the default warning returned to clients making v1beta1 API requests. - deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot" - schema: - openAPIV3Schema: - description: VolumeSnapshot is a user's request for either creating a point-in-time snapshot of a persistent volume, or binding to a pre-existing snapshot. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - spec: - description: 'spec defines the desired characteristics of a snapshot requested by a user. More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots Required.' - properties: - source: - description: source specifies where a snapshot will be created from. This field is immutable after creation. Required. - properties: - persistentVolumeClaimName: - description: persistentVolumeClaimName specifies the name of the PersistentVolumeClaim object representing the volume from which a snapshot should be created. This PVC is assumed to be in the same namespace as the VolumeSnapshot object. This field should be set if the snapshot does not exists, and needs to be created. This field is immutable. - type: string - volumeSnapshotContentName: - description: volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent object representing an existing volume snapshot. This field should be set if the snapshot already exists and only needs a representation in Kubernetes. This field is immutable. - type: string - type: object - volumeSnapshotClassName: - description: 'VolumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. VolumeSnapshotClassName may be left nil to indicate that the default SnapshotClass should be used. A given cluster may have multiple default Volume SnapshotClasses: one default per CSI Driver. If a VolumeSnapshot does not specify a SnapshotClass, VolumeSnapshotSource will be checked to figure out what the associated CSI Driver is, and the default VolumeSnapshotClass associated with that CSI Driver will be used. If more than one VolumeSnapshotClass exist for a given CSI Driver and more than one have been marked as default, CreateSnapshot will fail and generate an event. Empty string is not allowed for this field.' - type: string - required: - - source - type: object - status: - description: status represents the current information of a snapshot. Consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object. - properties: - boundVolumeSnapshotContentName: - description: 'boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent object to which this VolumeSnapshot object intends to bind to. If not specified, it indicates that the VolumeSnapshot object has not been successfully bound to a VolumeSnapshotContent object yet. NOTE: To avoid possible security issues, consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object.' - type: string - creationTime: - description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it may indicate that the creation time of the snapshot is unknown. - format: date-time - type: string - error: - description: error is the last observed error during snapshot creation, if any. This field could be helpful to upper level controllers(i.e., application controller) to decide whether they should continue on waiting for the snapshot to be created based on the type of error reported. The snapshot controller will keep retrying when an error occurs during the snapshot creation. Upon success, this error field will be cleared. - properties: - message: - description: 'message is a string detailing the encountered error during snapshot creation if specified. NOTE: message may be logged, and it should not contain sensitive information.' - type: string - time: - description: time is the timestamp when the error was encountered. - format: date-time - type: string - type: object - readyToUse: - description: readyToUse indicates if the snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown. - type: boolean - restoreSize: - type: string - description: restoreSize represents the minimum size of volume required to create a volume from this snapshot. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown. - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - required: - - spec - type: object - served: false - storage: false - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/NOTES.txt b/packages/system/snapshot-controller/charts/snapshot-controller/templates/NOTES.txt index 5880eb7e2..591a46634 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/NOTES.txt +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/NOTES.txt @@ -1,30 +1,10 @@ {{- if .Values.controller.enabled }} Volume Snapshot Controller installed. {{- end }} -{{- if .Values.webhook.enabled }} -Validation for VolumeSnapshots installed. + +{{- range concat .Values.volumeSnapshotClasses }} +Volume Snapshot Class "{{ .name }}" installed. {{- end }} - -{{- if and (not (.Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1")) (not (.Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta") ) }} -Please install the snapshot CRDs, otherwise the controller will not run. - -kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml -kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml -kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml -{{- else if .Release.IsUpgrade }} -It looks like you are upgrading from a previous release. Helm currently does not support upgrading CRDs, so to ensure -you have the latest CRDs applied, you can run the following commands: - -kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml -kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml -kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml +{{- range concat .Values.volumeGroupSnapshotClasses }} +Volume Group Snapshot Class "{{ .name }}" installed. {{- end }} - -If you already have volume snapshots deployed using a CRDs before v1, you should -verify that the existing snapshots are upgradable to v1 CRDs. The snapshot controller (>= v3.0.0) -will label any invalid snapshots it can find. Use the following commands to find any invalid snapshot - -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 return any items, you need to remove them before upgrading to the newer v1 CRDs. diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/_helpers.tpl b/packages/system/snapshot-controller/charts/snapshot-controller/templates/_helpers.tpl index 5b2fcd1fa..f8b3776c9 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/_helpers.tpl +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/_helpers.tpl @@ -60,11 +60,17 @@ Create the name of the service account to use {{- end -}} {{- end -}} +{{/* +############################### +# Snapshot Conversion Webhook # +############################### +*/}} + {{/* Expand the name of the chart. */}} -{{- define "snapshot-validation-webhook.name" -}} -{{- "snapshot-validation-webhook" | trunc 63 | trimSuffix "-" }} +{{- define "conversion-webhook.name" -}} +{{- "conversion-webhook" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* @@ -72,14 +78,14 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} -{{- define "snapshot-validation-webhook.fullname" -}} +{{- define "conversion-webhook.fullname" -}} {{- if .Values.webhook.fullnameOverride -}} {{- .Values.webhook.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} -{{- if contains .Chart.Name .Release.Name }} -{{- "snapshot-validation-webhook" }} +{{- if contains "conversion-webhook" .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} {{- else }} -{{- printf "%s-%s" .Release.Name "snapshot-validation-webhook" | trunc 63 | trimSuffix "-" }} +{{- printf "%s-%s" .Release.Name "conversion-webhook" | trunc 63 | trimSuffix "-" }} {{- end }} {{- end }} {{- end }} @@ -87,16 +93,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "snapshot-validation-webhook.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- define "conversion-webhook.chart" -}} +{{- printf "%s-%s" "conversion-webhook" .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "snapshot-validation-webhook.labels" -}} -helm.sh/chart: {{ include "snapshot-validation-webhook.chart" . }} -{{ include "snapshot-validation-webhook.selectorLabels" . }} +{{- define "conversion-webhook.labels" -}} +helm.sh/chart: {{ include "conversion-webhook.chart" . }} +{{ include "conversion-webhook.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -106,17 +112,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "snapshot-validation-webhook.selectorLabels" -}} -app.kubernetes.io/name: {{ include "snapshot-validation-webhook.name" . }} +{{- define "conversion-webhook.selectorLabels" -}} +app.kubernetes.io/name: {{ include "conversion-webhook.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "snapshot-validation-webhook.serviceAccountName" -}} +{{- define "conversion-webhook.serviceAccountName" -}} {{- if .Values.webhook.serviceAccount.create -}} - {{ default (include "snapshot-validation-webhook.fullname" .) .Values.webhook.serviceAccount.name }} + {{ default (include "conversion-webhook.fullname" .) .Values.webhook.serviceAccount.name }} {{- else -}} {{ default "default" .Values.webhook.serviceAccount.name }} {{- end -}} @@ -125,10 +131,10 @@ Create the name of the service account to use {{/* Certificate secret name */}} -{{- define "snapshot-validation-webhook.certifcateName" -}} +{{- define "conversion-webhook.certifcateName" -}} {{- if .Values.webhook.tls.certificateSecret }} {{- .Values.webhook.tls.certificateSecret }} {{- else }} -{{- include "snapshot-validation-webhook.fullname" . }}-tls +{{- include "conversion-webhook.fullname" . }} {{- end }} {{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/crds.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/crds.yaml new file mode 100644 index 000000000..85ce3a72e --- /dev/null +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/crds.yaml @@ -0,0 +1,83 @@ +# Check if the TLS secret already exists and initialize variables for later use at the top level +{{- $secret := lookup "v1" "Secret" .Release.Namespace (include "conversion-webhook.certifcateName" .) }} +{{ $ca := "" }} +{{ $key := "" }} +{{ $crt := "" }} +{{- if .Values.webhook.enabled }} +{{- if .Values.webhook.tls.certManagerIssuerRef }} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ include "conversion-webhook.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "conversion-webhook.labels" . | nindent 4 }} +spec: + secretName: {{ include "conversion-webhook.certifcateName" . }} + dnsNames: + - {{ include "conversion-webhook.fullname" . }}.{{ .Release.Namespace }}.svc + issuerRef: + {{- toYaml .Values.webhook.tls.certManagerIssuerRef | nindent 4 }} + privateKey: + rotationPolicy: Always +--- +{{- else if .Values.webhook.tls.autogenerate }} + {{- if or .Values.webhook.tls.caBundle .Values.webhook.tls.certificate .Values.webhook.tls.key }} + {{- $ca = b64enc .Values.webhook.tls.caBundle }} + {{- $key = b64enc .Values.webhook.tls.key }} + {{- $crt = b64enc .Values.webhook.tls.certificate }} + {{- else if and $secret (not .Values.webhook.tls.renew) }} + {{- $ca = get $secret.data "ca.crt" }} + {{- $key = get $secret.data "tls.key" }} + {{- $crt = get $secret.data "tls.crt" }} + {{- else }} + {{- $serviceName := (printf "%s.%s.svc" (include "conversion-webhook.fullname" .) .Release.Namespace)}} + {{- $cert := genSelfSignedCert $serviceName nil (list $serviceName) 3650 }} + {{- $ca = b64enc $cert.Cert }} + {{- $key = b64enc $cert.Key }} + {{- $crt = b64enc $cert.Cert }} + {{- end }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "conversion-webhook.certifcateName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "conversion-webhook.labels" . | nindent 4 }} +type: kubernetes.io/tls +data: + ca.crt: {{ $ca }} + tls.key: {{ $key }} + tls.crt: {{ $crt }} +{{- end }} +{{- end }} +--- +{{- if .Values.installCRDs }} +{{- $insertCaFrom := "" }} +{{- if and .Values.webhook.enabled .Values.webhook.tls.certManagerIssuerRef }} +{{- $insertCaFrom = printf "%s/%s" .Release.Namespace (include "conversion-webhook.certifcateName" .) }} +{{- end }} +{{- $clientConfig := dict "service" (dict "namespace" .Release.Namespace "name" (include "conversion-webhook.fullname" .) "path" "/convert") }} +{{- if $ca }} +{{- $clientConfig = set $clientConfig "caBundle" $ca }} +{{- end }} +{{- $crds := tpl (.Files.Get "crds.yaml") (dict "ClientConfig" $clientConfig "InsertCaFrom" $insertCaFrom "WebhookEnabled" .Values.webhook.enabled "KeepCRDs" .Values.keepCRDs) }} +{{- /* cozystack: a CRD is rendered only when it is absent or already belongs + to this release. A CRD the distribution ships, or that another release + owns, stays out of the manifest, so the upgrade neither takes it over nor + rewrites it. */}} +{{- range $crd := regexSplit "(?m)^---[ \\t]*\\r?$" $crds -1 }} +{{- $obj := fromYaml $crd }} +{{- if hasKey $obj "Error" }} +{{- fail (printf "snapshot-controller: cannot parse a CRD from crds.yaml: %s" $obj.Error) }} +{{- end }} +{{- if $obj.metadata }} +{{- $live := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" $obj.metadata.name }} +{{- if or (not $live) (and (eq (dig "metadata" "annotations" "meta.helm.sh/release-name" "" $live) $.Release.Name) (eq (dig "metadata" "annotations" "meta.helm.sh/release-namespace" "" $live) $.Release.Namespace)) }} +--- +{{ trim $crd }} +{{- end }} +{{- end }} +{{- end }} +{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_controller.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_controller.yaml index 4fa022a70..dc1f61f02 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_controller.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_controller.yaml @@ -3,6 +3,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "snapshot-controller.fullname" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "snapshot-controller.labels" . | nindent 4 }} spec: diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_validation_webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_webhook.yaml similarity index 66% rename from packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_validation_webhook.yaml rename to packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_webhook.yaml index ad24b32b8..dcaf1828b 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_validation_webhook.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/deployment_webhook.yaml @@ -2,15 +2,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} + name: {{ include "conversion-webhook.fullname" . }} + namespace: {{ .Release.Namespace }} labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} + {{- include "conversion-webhook.labels" . | nindent 4 }} spec: replicas: {{ .Values.webhook.replicaCount }} revisionHistoryLimit: {{ .Values.webhook.revisionHistoryLimit }} selector: matchLabels: - {{- include "snapshot-validation-webhook.selectorLabels" . | nindent 6 }} + {{- include "conversion-webhook.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.webhook.podAnnotations }} @@ -18,7 +19,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "snapshot-validation-webhook.selectorLabels" . | nindent 8 }} + {{- include "conversion-webhook.selectorLabels" . | nindent 8 }} {{- with .Values.webhook.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -27,14 +28,11 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "snapshot-validation-webhook.serviceAccountName" . }} + serviceAccountName: {{ include "conversion-webhook.serviceAccountName" . }} securityContext: {{- toYaml .Values.webhook.podSecurityContext | nindent 8 }} - {{- with .Values.webhook.priorityClassName }} - priorityClassName: {{ . }} - {{- end }} containers: - - name: {{ include "snapshot-validation-webhook.name" . }} + - name: "conversion-webhook" securityContext: {{- toYaml .Values.webhook.securityContext | nindent 12 }} image: "{{ .Values.webhook.image.repository }}:{{ .Values.webhook.image.tag | default .Chart.AppVersion }}" @@ -45,27 +43,19 @@ spec: {{- end }} ports: - name: https - containerPort: {{ .Values.webhook.args.port | default 8443 }} + containerPort: {{ .Values.webhook.args.port }} protocol: TCP - volumeMounts: - - mountPath: /etc/snapshot-validation - name: tls-config livenessProbe: httpGet: - path: /readyz port: https - scheme: HTTPS - readinessProbe: - httpGet: path: /readyz - port: https scheme: HTTPS resources: {{- toYaml .Values.webhook.resources | nindent 12 }} - volumes: - - name: tls-config - secret: - secretName: {{ include "snapshot-validation-webhook.certifcateName" . }} + volumeMounts: + - name: tls + mountPath: /etc/webhook + readOnly: true {{- with .Values.webhook.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -74,18 +64,25 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.webhook.topologySpreadConstraints }} - topologySpreadConstraints: - {{- toYaml .Values.webhook.topologySpreadConstraints | nindent 8 }} - {{- end }} {{- with .Values.webhook.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.webhook.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.webhook.priorityClassName }} + priorityClassName: {{ .Values.webhook.priorityClassName }} + {{- end }} hostNetwork: {{ .Values.webhook.hostNetwork }} {{- with .Values.webhook.dnsConfig }} dnsConfig: {{- toYaml . | nindent 8 }} {{- end }} dnsPolicy: {{ .Values.webhook.dnsPolicy }} + volumes: + - name: tls + secret: + secretName: {{ include "conversion-webhook.certifcateName" . }} {{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/networkpolicy.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/networkpolicy.yaml deleted file mode 100644 index 49c8049f4..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/networkpolicy.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if and .Values.webhook.enabled .Values.webhook.networkPolicy.enabled -}} -kind: NetworkPolicy -apiVersion: networking.k8s.io/v1 -metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} - labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} -spec: - podSelector: - matchLabels: - {{- include "snapshot-validation-webhook.selectorLabels" . | nindent 6 }} - ingress: - - from: - - podSelector: - matchLabels: - {{- include "snapshot-validation-webhook.selectorLabels" . | nindent 12 }} - {{- with .Values.webhook.networkPolicy.ingress }} - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end -}} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_controller.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_controller.yaml index 88fa179fe..f5f82e11a 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_controller.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_controller.yaml @@ -3,6 +3,7 @@ apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: {{ include "snapshot-controller.fullname" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "snapshot-controller.labels" . | nindent 4 }} spec: diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_validation_webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_validation_webhook.yaml deleted file mode 100644 index af4a0cce5..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_validation_webhook.yaml +++ /dev/null @@ -1,13 +0,0 @@ -{{- if and .Values.webhook.enabled .Values.webhook.pdb -}} -apiVersion: policy/v1 -kind: PodDisruptionBudget -metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} - labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} -spec: - selector: - matchLabels: - {{- include "snapshot-validation-webhook.selectorLabels" . | nindent 6 }} -{{ toYaml .Values.webhook.pdb | indent 2 }} -{{- end -}} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_webhook.yaml new file mode 100644 index 000000000..2c1fe2c28 --- /dev/null +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/poddisruptionbudget_webhook.yaml @@ -0,0 +1,14 @@ +{{- if and .Values.webhook.enabled .Values.webhook.pdb }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "conversion-webhook.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "conversion-webhook.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "conversion-webhook.selectorLabels" . | nindent 6 }} +{{ toYaml .Values.webhook.pdb | indent 2 }} +{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_controller.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_controller.yaml index 4581dc18f..39ccb1cc5 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_controller.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_controller.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Service metadata: name: {{ include "snapshot-controller.fullname" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "snapshot-controller.labels" . | nindent 4 }} spec: diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_validation_webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_validation_webhook.yaml deleted file mode 100644 index bf73511a7..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_validation_webhook.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.webhook.enabled }} -apiVersion: v1 -kind: Service -metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} - labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} -spec: - type: ClusterIP - ports: - - port: 443 - targetPort: https - protocol: TCP - name: https - selector: - {{- include "snapshot-validation-webhook.selectorLabels" . | nindent 4 }} -{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_webhook.yaml new file mode 100644 index 000000000..3122e3e22 --- /dev/null +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/service_webhook.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.webhook.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "conversion-webhook.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "conversion-webhook.labels" . | nindent 4 }} +spec: + ports: + - port: 443 + targetPort: {{ .Values.webhook.args.port }} + name: https + selector: + {{- include "conversion-webhook.selectorLabels" . | nindent 4 }} +{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_controller.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_controller.yaml index 07b2bf3ce..86ad6b0e9 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_controller.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_controller.yaml @@ -4,6 +4,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "snapshot-controller.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "snapshot-controller.labels" . | nindent 4 }} {{- end }} @@ -34,7 +35,7 @@ rules: verbs: ["patch"] - apiGroups: ["snapshot.storage.k8s.io"] resources: ["volumesnapshots"] - verbs: ["get", "list", "watch", "update", "patch", "delete"] + verbs: ["create", "get", "list", "watch", "update", "patch", "delete"] - apiGroups: ["snapshot.storage.k8s.io"] resources: ["volumesnapshots/status"] verbs: ["update", "patch"] @@ -76,6 +77,7 @@ kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ include "snapshot-controller.fullname" . }} + namespace: {{ .Release.Namespace }} rules: - apiGroups: ["coordination.k8s.io"] resources: ["leases"] @@ -85,6 +87,7 @@ kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ include "snapshot-controller.fullname" . }} + namespace: {{ .Release.Namespace }} subjects: - kind: ServiceAccount name: {{ include "snapshot-controller.serviceAccountName" . }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_validation_webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_validation_webhook.yaml deleted file mode 100644 index f1bbebe0a..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_validation_webhook.yaml +++ /dev/null @@ -1,38 +0,0 @@ -{{- if .Values.webhook.enabled }} -{{- if .Values.webhook.serviceAccount.create }} ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "snapshot-validation-webhook.serviceAccountName" . }} - labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} -{{- end }} -{{- if .Values.webhook.rbac.create }} ---- -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} -rules: - - apiGroups: ["snapshot.storage.k8s.io"] - resources: ["volumesnapshotclasses"] - verbs: ["get", "list", "watch"] - - apiGroups: ["groupsnapshot.storage.k8s.io"] - resources: ["volumegroupsnapshotclasses"] - verbs: ["get", "list", "watch"] ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} -subjects: - - kind: ServiceAccount - name: {{ include "snapshot-validation-webhook.serviceAccountName" . }} - namespace: {{ .Release.Namespace }} -roleRef: - kind: ClusterRole - name: {{ include "snapshot-validation-webhook.fullname" . }} - apiGroup: rbac.authorization.k8s.io -{{- end }} -{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_webhook.yaml new file mode 100644 index 000000000..b3c0b28d9 --- /dev/null +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/serviceaccount_webhook.yaml @@ -0,0 +1,11 @@ +{{- if .Values.webhook.enabled }} +{{- if .Values.webhook.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "conversion-webhook.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "conversion-webhook.labels" . | nindent 4 }} +{{- end }} +{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/servicemonitor.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/servicemonitor.yaml index 54a7f2933..248ba26bc 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/servicemonitor.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/servicemonitor.yaml @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "snapshot-controller.fullname" . }} + namespace: {{ .Release.Namespace }} labels: {{- include "snapshot-controller.labels" . | nindent 4 }} spec: diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/volumegroupsnapshotclass.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/volumegroupsnapshotclass.yaml new file mode 100644 index 000000000..6912838d7 --- /dev/null +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/volumegroupsnapshotclass.yaml @@ -0,0 +1,23 @@ +{{- if .Values.controller.volumeGroupSnapshotClasses }} +{{ fail "Use volumeGroupSnapshotClasses instead of controller.volumeGroupSnapshotClasses" }} +{{- end}} +{{- range concat .Values.volumeGroupSnapshotClasses }} +--- +kind: VolumeGroupSnapshotClass +apiVersion: groupsnapshot.storage.k8s.io/v1beta1 +metadata: + name: {{ .name }} +{{- with .annotations }} + annotations: {{- . | toYaml | trim | nindent 4 }} +{{- end }} + labels: + {{- include "snapshot-controller.labels" $ | nindent 4 }} +{{- with .labels }} + {{- . | toYaml | trim | nindent 4 }} +{{- end }} +driver: {{ .driver }} +deletionPolicy: {{ .deletionPolicy }} +{{- with .parameters }} +parameters: {{- . | toYaml | trim | nindent 2 }} +{{- end }} +{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/volumesnapshotclass.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/volumesnapshotclass.yaml index a88f7e8ee..e661e191c 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/volumesnapshotclass.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/templates/volumesnapshotclass.yaml @@ -1,5 +1,7 @@ -{{- if .Values.controller.enabled }} -{{- range .Values.controller.volumeSnapshotClasses }} +{{- if .Values.controller.volumeSnapshotClasses }} +{{ fail "Use volumeSnapshotClasses instead of controller.volumeSnapshotClasses" }} +{{- end}} +{{- range concat .Values.volumeSnapshotClasses }} --- kind: VolumeSnapshotClass apiVersion: snapshot.storage.k8s.io/v1 @@ -19,4 +21,3 @@ deletionPolicy: {{ .deletionPolicy }} parameters: {{- . | toYaml | trim | nindent 2 }} {{- end }} {{- end }} -{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/templates/webhook.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/templates/webhook.yaml deleted file mode 100644 index d18b14800..000000000 --- a/packages/system/snapshot-controller/charts/snapshot-controller/templates/webhook.yaml +++ /dev/null @@ -1,112 +0,0 @@ -{{- if .Values.webhook.enabled }} -# Check if the TLS secret already exists and initialize variables for later use at the top level -{{- $secret := lookup "v1" "Secret" .Release.Namespace (include "snapshot-validation-webhook.certifcateName" .) }} -{{ $ca := "" }} -{{ $key := "" }} -{{ $crt := "" }} ---- -{{- if .Values.webhook.tls.certManagerIssuerRef }} -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} - labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} -spec: - secretName: {{ include "snapshot-validation-webhook.certifcateName" . }} - dnsNames: - - {{ include "snapshot-validation-webhook.fullname" . }}.{{ .Release.Namespace }}.svc - issuerRef: - {{- toYaml .Values.webhook.tls.certManagerIssuerRef | nindent 4 }} - privateKey: - rotationPolicy: Always ---- -{{- else if .Values.webhook.tls.autogenerate }} - {{- if and $secret (not .Values.webhook.tls.renew) }} - {{- $ca = get $secret.data "ca.crt" }} - {{- $key = get $secret.data "tls.key" }} - {{- $crt = get $secret.data "tls.crt" }} - {{- else }} - {{- $serviceName := (printf "%s.%s.svc" (include "snapshot-validation-webhook.fullname" .) .Release.Namespace)}} - {{- $cert := genSelfSignedCert $serviceName nil (list $serviceName) 3650 }} - {{- $ca = b64enc $cert.Cert }} - {{- $key = b64enc $cert.Key }} - {{- $crt = b64enc $cert.Cert }} - {{- end }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "snapshot-validation-webhook.certifcateName" . }} - labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} -type: kubernetes.io/tls -data: - ca.crt: {{ $ca }} - tls.key: {{ $key }} - tls.crt: {{ $crt }} ---- -{{- end }} -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: {{ include "snapshot-validation-webhook.fullname" . }} - labels: - {{- include "snapshot-validation-webhook.labels" . | nindent 4 }} - {{- if .Values.webhook.tls.certManagerIssuerRef }} - annotations: - cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ include "snapshot-validation-webhook.fullname" . }} - {{- end }} -webhooks: - - name: {{ include "snapshot-validation-webhook.name" . }}.snapshot.storage.k8s.io - rules: - - apiGroups: - - snapshot.storage.k8s.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - volumesnapshotclasses - scope: "*" - clientConfig: - service: - namespace: {{ .Release.Namespace }} - name: {{ include "snapshot-validation-webhook.fullname" . }} - path: "/volumesnapshot" - {{- if not .Values.webhook.tls.certManagerIssuerRef }} - caBundle: {{ $ca }} - {{- end }} - admissionReviewVersions: - - v1 - - v1beta1 - sideEffects: None - failurePolicy: {{ .Values.webhook.webhook.failurePolicy }} - timeoutSeconds: {{ .Values.webhook.webhook.timeoutSeconds }} - - name: {{ include "snapshot-validation-webhook.name" . }}.groupsnapshot.storage.k8s.io - rules: - - apiGroups: - - groupsnapshot.storage.k8s.io - apiVersions: - - v1alpha1 - operations: - - CREATE - - UPDATE - resources: - - volumegroupsnapshotclasses - scope: "*" - clientConfig: - service: - namespace: {{ .Release.Namespace }} - name: {{ include "snapshot-validation-webhook.fullname" . }} - path: "/volumegroupsnapshot" - {{- if not .Values.webhook.tls.certManagerIssuerRef }} - caBundle: {{ $ca }} - {{- end }} - admissionReviewVersions: - - v1 - - v1beta1 - sideEffects: None - failurePolicy: {{ .Values.webhook.webhook.failurePolicy }} - timeoutSeconds: {{ .Values.webhook.webhook.timeoutSeconds }} -{{- end }} diff --git a/packages/system/snapshot-controller/charts/snapshot-controller/values.yaml b/packages/system/snapshot-controller/charts/snapshot-controller/values.yaml index 38acb2b5d..eff4613bf 100644 --- a/packages/system/snapshot-controller/charts/snapshot-controller/values.yaml +++ b/packages/system/snapshot-controller/charts/snapshot-controller/values.yaml @@ -1,3 +1,10 @@ +installCRDs: true + +# Annotate the CRDs with `helm.sh/resource-policy: keep`, so that `helm uninstall` leaves them +# in place instead of deleting them along with every VolumeSnapshot in the cluster. Only takes +# effect when installCRDs is true. +keepCRDs: false + controller: enabled: true @@ -5,10 +12,13 @@ controller: revisionHistoryLimit: 10 + fullnameOverride: "" + args: leaderElection: true leaderElectionNamespace: "$(NAMESPACE)" httpEndpoint: ":8080" + featureGates: CSIVolumeGroupSnapshot=true image: repository: registry.k8s.io/sig-storage/snapshot-controller @@ -60,15 +70,6 @@ controller: # Specifies whether a ServiceMonitor should be created create: false - volumeSnapshotClasses: [] -# - name: linstor-csi-delete -# annotations: -# snapshot.storage.kubernetes.io/is-default-class: "true" -# labels: -# velero.io/csi-volumesnapshot-class: "true" -# driver: linstor.csi.linbit.com -# deletionPolicy: Delete - priorityClassName: "" # Specifies wether a Priority Class should be attached to deployment pods @@ -82,68 +83,54 @@ controller: dnsPolicy: ClusterFirst webhook: - enabled: true + # The conversion webhook is only needed for clusters that still hold VolumeGroupSnapshot + # objects in the v1beta1/v1beta2 API versions. When disabled, the conversion strategy is + # not injected into the volumegroupsnapshotcontents CRD (it defaults to `None`, matching + # upstream). Enable this only if you rely on the older group snapshot API versions. + enabled: false replicaCount: 1 revisionHistoryLimit: 10 - args: - tlsPrivateKeyFile: /etc/snapshot-validation/tls.key - tlsCertFile: /etc/snapshot-validation/tls.crt - port: 8443 - # enableVolumeGroupSnapshotWebhook: true - - image: - repository: registry.k8s.io/sig-storage/snapshot-validation-webhook - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - - webhook: - timeoutSeconds: 2 - failurePolicy: Fail + fullnameOverride: "" tls: certificateSecret: "" autogenerate: true + # Renew the certificate on every request renew: false + # Issuer to pass to the Certificate certManagerIssuerRef: {} + # PEM-Encoded content of ca.crt, tls.crt and tls.key. If set, Helm will not autogenerate the request. + caBundle: "" + certificate: "" + key: "" + + args: + port: 8443 + tlsCertFile: /etc/webhook/tls.crt + tlsPrivateKeyFile: /etc/webhook/tls.key + + image: + repository: registry.k8s.io/sig-storage/snapshot-conversion-webhook + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" imagePullSecrets: [] + podAnnotations: {} + podLabels: {} - networkPolicy: - enabled: false - ingress: {} - # - from: - # - ipBlock: - # cidr: 0.0.0.0/0 - - ## Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ - ## - pdb: {} - - priorityClassName: - - ## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ - ## - topologySpreadConstraints: [] - # - maxSkew: 1 - # topologyKey: topology.kubernetes.io/zone - # whenUnsatisfiable: ScheduleAnyway - # labelSelector: - # matchLabels: - # app.kubernetes.io/instance: snapshot-validation-webhook - podSecurityContext: {} # fsGroup: 2000 securityContext: capabilities: drop: - - ALL + - ALL readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 @@ -156,25 +143,44 @@ webhook: affinity: {} + ## Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ + ## + pdb: {} + + topologySpreadConstraints: [] + serviceAccount: + # Specifies whether a ServiceAccount should be created create: true name: "" - rbac: - create: true + priorityClassName: "" + # Specifies wether a Priority Class should be attached to deployment pods # Change `hostNetwork` to `true` when you want the pod to share its host's network namespace. hostNetwork: false - # DNS settings for the webhook pod. https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config + # DNS settings for the controller pod. https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config dnsConfig: {} - # DNS Policy for webhook pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet` + # DNS Policy for controller pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet` # For further reference: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy. dnsPolicy: ClusterFirst - tests: - nodeSelector: { } - tolerations: [ ] +volumeSnapshotClasses: [] + # - name: linstor-csi-delete + # annotations: + # snapshot.storage.kubernetes.io/is-default-class: "true" + # labels: + # velero.io/csi-volumesnapshot-class: "true" + # driver: linstor.csi.linbit.com + # deletionPolicy: Delete - affinity: { } +volumeGroupSnapshotClasses: [] +# - name: linstor-csi-delete +# annotations: +# groupsnapshot.storage.kubernetes.io/is-default-class: "true" +# labels: +# velero.io/csi-volumegroupsnapshot-class: "true" +# driver: linstor.csi.linbit.com +# deletionPolicy: Delete diff --git a/packages/system/snapshot-controller/patches/skip-foreign-crds.diff b/packages/system/snapshot-controller/patches/skip-foreign-crds.diff new file mode 100644 index 000000000..89f4ac51f --- /dev/null +++ b/packages/system/snapshot-controller/patches/skip-foreign-crds.diff @@ -0,0 +1,26 @@ +--- a/templates/crds.yaml ++++ b/templates/crds.yaml +@@ -62,5 +62,22 @@ + {{- if $ca }} + {{- $clientConfig = set $clientConfig "caBundle" $ca }} + {{- end }} +-{{ tpl (.Files.Get "crds.yaml") (dict "ClientConfig" $clientConfig "InsertCaFrom" $insertCaFrom "WebhookEnabled" .Values.webhook.enabled "KeepCRDs" .Values.keepCRDs) }} ++{{- $crds := tpl (.Files.Get "crds.yaml") (dict "ClientConfig" $clientConfig "InsertCaFrom" $insertCaFrom "WebhookEnabled" .Values.webhook.enabled "KeepCRDs" .Values.keepCRDs) }} ++{{- /* cozystack: a CRD is rendered only when it is absent or already belongs ++ to this release. A CRD the distribution ships, or that another release ++ owns, stays out of the manifest, so the upgrade neither takes it over nor ++ rewrites it. */}} ++{{- range $crd := regexSplit "(?m)^---[ \\t]*\\r?$" $crds -1 }} ++{{- $obj := fromYaml $crd }} ++{{- if hasKey $obj "Error" }} ++{{- fail (printf "snapshot-controller: cannot parse a CRD from crds.yaml: %s" $obj.Error) }} + {{- end }} ++{{- if $obj.metadata }} ++{{- $live := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" $obj.metadata.name }} ++{{- if or (not $live) (and (eq (dig "metadata" "annotations" "meta.helm.sh/release-name" "" $live) $.Release.Name) (eq (dig "metadata" "annotations" "meta.helm.sh/release-namespace" "" $live) $.Release.Namespace)) }} ++--- ++{{ trim $crd }} ++{{- end }} ++{{- end }} ++{{- end }} ++{{- end }} diff --git a/packages/system/snapshot-controller/tests/crd_ownership_test.yaml b/packages/system/snapshot-controller/tests/crd_ownership_test.yaml new file mode 100644 index 000000000..81f2f1f96 --- /dev/null +++ b/packages/system/snapshot-controller/tests/crd_ownership_test.yaml @@ -0,0 +1,61 @@ +suite: snapshot CRDs owned outside the release + +# A distribution can ship its own snapshot CRDs. The chart renders a CRD only +# when it is absent or already carries this release's Helm ownership, so an +# upgrade never takes over or rewrites one owned elsewhere. Migration 62 adopts +# the CRDs the release installed before, which keeps them in the manifest. + +templates: + - charts/snapshot-controller/templates/crds.yaml + +release: + name: snapshot-controller + namespace: cozy-snapshot-controller + +kubernetesProvider: + scheme: + "apiextensions.k8s.io/v1/CustomResourceDefinition": + gvr: + group: apiextensions.k8s.io + version: v1 + resource: customresourcedefinitions + namespaced: false + objects: + - apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + metadata: + name: volumesnapshots.snapshot.storage.k8s.io + - apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + metadata: + name: volumesnapshotcontents.snapshot.storage.k8s.io + annotations: + meta.helm.sh/release-name: other + meta.helm.sh/release-namespace: cozy-snapshot-controller + - apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + metadata: + name: volumesnapshotclasses.snapshot.storage.k8s.io + annotations: + meta.helm.sh/release-name: snapshot-controller + meta.helm.sh/release-namespace: cozy-snapshot-controller + +tests: + - it: renders only the absent CRDs and the ones this release owns + asserts: + - hasDocuments: + count: 4 + - notEqual: + path: metadata.name + value: volumesnapshots.snapshot.storage.k8s.io + - notEqual: + path: metadata.name + value: volumesnapshotcontents.snapshot.storage.k8s.io + + - it: keeps rendering a CRD this release owns + documentSelector: + path: metadata.name + value: volumesnapshotclasses.snapshot.storage.k8s.io + asserts: + - isKind: + of: CustomResourceDefinition diff --git a/packages/system/snapshot-controller/tests/crds_test.yaml b/packages/system/snapshot-controller/tests/crds_test.yaml new file mode 100644 index 000000000..598d02bbe --- /dev/null +++ b/packages/system/snapshot-controller/tests/crds_test.yaml @@ -0,0 +1,85 @@ +suite: snapshot CRDs and the VolumeGroupSnapshot gate + +# The vendored chart renders the snapshot CRDs from a template, so they belong +# to this release: keepCRDs stops an uninstall from taking every VolumeSnapshot +# with them. Velero 1.18 and piraeus-operator both look for +# groupsnapshot.storage.k8s.io/v1beta2, and the controller only acts on group +# snapshots with the CSIVolumeGroupSnapshot gate on. + +templates: + - charts/snapshot-controller/templates/crds.yaml + - charts/snapshot-controller/templates/deployment_controller.yaml + +tests: + - it: every CRD is kept on uninstall + template: charts/snapshot-controller/templates/crds.yaml + asserts: + - hasDocuments: + count: 6 + - equal: + path: metadata.annotations["helm.sh/resource-policy"] + value: keep + + - it: volumegroupsnapshots serves v1beta2 and no longer v1alpha1 + template: charts/snapshot-controller/templates/crds.yaml + documentSelector: + path: metadata.name + value: volumegroupsnapshots.groupsnapshot.storage.k8s.io + asserts: + - contains: + path: spec.versions + content: + name: v1beta2 + served: true + storage: true + any: true + - notContains: + path: spec.versions + content: + name: v1alpha1 + any: true + + - it: volumegroupsnapshotcontents serves v1beta2 and no longer v1alpha1 + template: charts/snapshot-controller/templates/crds.yaml + documentSelector: + path: metadata.name + value: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io + asserts: + - contains: + path: spec.versions + content: + name: v1beta2 + served: true + storage: true + any: true + - notContains: + path: spec.versions + content: + name: v1alpha1 + any: true + + - it: volumegroupsnapshotclasses serves v1beta2 and no longer v1alpha1 + template: charts/snapshot-controller/templates/crds.yaml + documentSelector: + path: metadata.name + value: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io + asserts: + - contains: + path: spec.versions + content: + name: v1beta2 + served: true + storage: true + any: true + - notContains: + path: spec.versions + content: + name: v1alpha1 + any: true + + - it: the controller runs with the CSIVolumeGroupSnapshot gate + template: charts/snapshot-controller/templates/deployment_controller.yaml + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: --feature-gates=CSIVolumeGroupSnapshot=true diff --git a/packages/system/snapshot-controller/values.yaml b/packages/system/snapshot-controller/values.yaml index 667d7a9e3..4ebde653b 100644 --- a/packages/system/snapshot-controller/values.yaml +++ b/packages/system/snapshot-controller/values.yaml @@ -1,4 +1,7 @@ snapshot-controller: + # The chart renders the CRDs from a template, so uninstalling the release + # would otherwise delete them along with every VolumeSnapshot. + keepCRDs: true controller: replicaCount: 2 revisionHistoryLimit: 10