From df9e714eeb277e3876384fbea67e6079ec240a25 Mon Sep 17 00:00:00 2001 From: Vicente Cheng Date: Wed, 9 Oct 2024 16:58:48 +0800 Subject: [PATCH 1/2] charts: add LVM VolumeSnapshotClass as default Signed-off-by: Vicente Cheng --- charts/harvester-csi-driver-lvm/templates/common.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charts/harvester-csi-driver-lvm/templates/common.yaml b/charts/harvester-csi-driver-lvm/templates/common.yaml index a6eb745f..512d1f58 100644 --- a/charts/harvester-csi-driver-lvm/templates/common.yaml +++ b/charts/harvester-csi-driver-lvm/templates/common.yaml @@ -10,3 +10,10 @@ spec: - Persistent podInfoOnMount: true attachRequired: false +--- +apiVersion: snapshot.storage.k8s.io/v1 +deletionPolicy: Delete +driver: {{ .Values.lvm.driverName }} +kind: VolumeSnapshotClass +metadata: + name: lvm-snapshot \ No newline at end of file From 936cc84aa4bf3465fadf39a1c096a44b3f15a43b Mon Sep 17 00:00:00 2001 From: Vicente Cheng Date: Wed, 9 Oct 2024 23:43:14 +0800 Subject: [PATCH 2/2] ci: add volumesnapshotclass crd - to make lint happy for lvm volumesnapshotclass.yaml - bump kind-action to v1.10.0 Signed-off-by: Vicente Cheng --- .github/workflows/ci.yaml | 6 +- tests/snapshotter_volumesnapshotclass.yaml | 143 +++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 tests/snapshotter_volumesnapshotclass.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7d448f9a..7fde8f1b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -53,7 +53,7 @@ jobs: fi - name: Create kind cluster - uses: helm/kind-action@v1.2.0 + uses: helm/kind-action@v1.10.0 if: steps.list-changed.outputs.changed == 'true' - name: Create harvester-system namespace @@ -64,6 +64,10 @@ jobs: run: "kubectl create -f tests/roletemplate_crd.yaml" if: steps.list-changed.outputs.changed == 'true' + - name: Create Snapshotter volumesnapshotclass crd + run: "kubectl create -f tests/snapshotter_volumesnapshotclass.yaml" + if: steps.list-changed.outputs.changed == 'true' + - name: Run chart-testing (install) run: ct install --config tests/ct.yaml diff --git a/tests/snapshotter_volumesnapshotclass.yaml b/tests/snapshotter_volumesnapshotclass.yaml new file mode 100644 index 000000000..6c2a29e1 --- /dev/null +++ b/tests/snapshotter_volumesnapshotclass.yaml @@ -0,0 +1,143 @@ +--- +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: [] \ No newline at end of file