|
| 1 | +# The tenant addon HelmRelease that ships this chart remediates a failed |
| 2 | +# install by uninstalling the release, and an uninstall deletes whatever the |
| 3 | +# chart rendered. Deleting a CRD makes the API server garbage-collect every |
| 4 | +# custom resource of that kind, so an unannotated CRD here costs the cluster |
| 5 | +# every VolumeSnapshot it holds — the objects that carry the only reference to |
| 6 | +# a snapshot on the storage backend. |
| 7 | +# |
| 8 | +# The first case scopes to no template at all, so it holds every document the |
| 9 | +# chart renders, including a CRD that arrives in a file `make update` starts |
| 10 | +# fetching later. The named cases below pin which CRD each file carries, so an |
| 11 | +# assertion cannot pass against a document it was not meant to inspect. |
| 12 | +suite: volumesnapshot CRDs survive a release uninstall |
| 13 | +tests: |
| 14 | + - it: annotates every CustomResourceDefinition the chart renders |
| 15 | + asserts: |
| 16 | + - equal: |
| 17 | + path: kind |
| 18 | + value: CustomResourceDefinition |
| 19 | + - equal: |
| 20 | + path: metadata.annotations["helm.sh/resource-policy"] |
| 21 | + value: keep |
| 22 | + |
| 23 | + - it: keeps the VolumeSnapshotClass CRD |
| 24 | + template: templates/volumesnapshotclasses.yaml |
| 25 | + asserts: |
| 26 | + - hasDocuments: |
| 27 | + count: 1 |
| 28 | + - equal: |
| 29 | + path: metadata.name |
| 30 | + value: volumesnapshotclasses.snapshot.storage.k8s.io |
| 31 | + - equal: |
| 32 | + path: metadata.annotations["helm.sh/resource-policy"] |
| 33 | + value: keep |
| 34 | + |
| 35 | + - it: keeps the VolumeSnapshotContent CRD |
| 36 | + template: templates/volumesnapshotcontents.yaml |
| 37 | + asserts: |
| 38 | + - hasDocuments: |
| 39 | + count: 1 |
| 40 | + - equal: |
| 41 | + path: metadata.name |
| 42 | + value: volumesnapshotcontents.snapshot.storage.k8s.io |
| 43 | + - equal: |
| 44 | + path: metadata.annotations["helm.sh/resource-policy"] |
| 45 | + value: keep |
| 46 | + |
| 47 | + - it: keeps the VolumeSnapshot CRD |
| 48 | + template: templates/volumesnapshots.yaml |
| 49 | + asserts: |
| 50 | + - hasDocuments: |
| 51 | + count: 1 |
| 52 | + - equal: |
| 53 | + path: metadata.name |
| 54 | + value: volumesnapshots.snapshot.storage.k8s.io |
| 55 | + - equal: |
| 56 | + path: metadata.annotations["helm.sh/resource-policy"] |
| 57 | + value: keep |
0 commit comments