From 90e52bb6338a36472f8834688c424d6f4dcbaaf1 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Wed, 25 Nov 2026 12:23:06 +0300 Subject: [PATCH] test(snapshot-controller): assert the group snapshot versions consumers read The CRD test pinned the vendored chart's layout: exactly six CRD documents, v1beta2 as the storage version of each group snapshot CRD and no v1alpha1. None of that is something the platform relies on, and an upstream release that moves storage to v1 or adds a CRD would turn the test red on a correct make update. What the platform needs is that each group snapshot CRD serves v1, which snapshot-controller, csi-snapshotter and the linstor gate read, and v1beta2, which Velero 1.18 and the vm-instance hook read. The test now asserts those two served versions, that the three volume snapshot CRDs CDI and the CSI drivers read are rendered, and that every rendered CRD is kept on uninstall, without counting documents. Removing either served version, dropping a volume snapshot CRD, setting keepCRDs to false, or rendering no CRDs fails it. Fixes: 892d9c9b343b ("feat(platform): upgrade snapshot-controller to v8.7.0") Assisted-by: LLM Signed-off-by: Aleksei Sviridkin --- .../snapshot-controller/tests/crds_test.yaml | 58 ++++++++++++------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/packages/system/snapshot-controller/tests/crds_test.yaml b/packages/system/snapshot-controller/tests/crds_test.yaml index 598d02bbe..202f0901c 100644 --- a/packages/system/snapshot-controller/tests/crds_test.yaml +++ b/packages/system/snapshot-controller/tests/crds_test.yaml @@ -2,9 +2,10 @@ 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. +# with them. The group snapshot API is read at v1 by snapshot-controller, +# csi-snapshotter and the linstor gate, and at v1beta2 by Velero 1.18 and the +# vm-instance hook. The controller only acts on group snapshots with the +# CSIVolumeGroupSnapshot gate on. templates: - charts/snapshot-controller/templates/crds.yaml @@ -14,13 +15,30 @@ 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 + - it: the volume snapshot CRDs CDI and the CSI drivers read are rendered + template: charts/snapshot-controller/templates/crds.yaml + asserts: + - containsDocument: + apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + name: volumesnapshots.snapshot.storage.k8s.io + any: true + - containsDocument: + apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + name: volumesnapshotcontents.snapshot.storage.k8s.io + any: true + - containsDocument: + apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + name: volumesnapshotclasses.snapshot.storage.k8s.io + any: true + + - it: volumegroupsnapshots serves v1 and v1beta2 template: charts/snapshot-controller/templates/crds.yaml documentSelector: path: metadata.name @@ -29,17 +47,17 @@ tests: - contains: path: spec.versions content: - name: v1beta2 + name: v1 served: true - storage: true any: true - - notContains: + - contains: path: spec.versions content: - name: v1alpha1 + name: v1beta2 + served: true any: true - - it: volumegroupsnapshotcontents serves v1beta2 and no longer v1alpha1 + - it: volumegroupsnapshotcontents serves v1 and v1beta2 template: charts/snapshot-controller/templates/crds.yaml documentSelector: path: metadata.name @@ -48,17 +66,17 @@ tests: - contains: path: spec.versions content: - name: v1beta2 + name: v1 served: true - storage: true any: true - - notContains: + - contains: path: spec.versions content: - name: v1alpha1 + name: v1beta2 + served: true any: true - - it: volumegroupsnapshotclasses serves v1beta2 and no longer v1alpha1 + - it: volumegroupsnapshotclasses serves v1 and v1beta2 template: charts/snapshot-controller/templates/crds.yaml documentSelector: path: metadata.name @@ -67,14 +85,14 @@ tests: - contains: path: spec.versions content: - name: v1beta2 + name: v1 served: true - storage: true any: true - - notContains: + - contains: path: spec.versions content: - name: v1alpha1 + name: v1beta2 + served: true any: true - it: the controller runs with the CSIVolumeGroupSnapshot gate