Files
library-charts/library/common-test/tests/persistence/pv_data_test.yaml
Kjeld Schouten 02be440b56 feat(common): BREAKING CHANGE add support for PVC static provisioning and dataSource (#554)
**Description**
This PR aims to add support for static provisioning of PVC-PV volume
pairs.

THis ensures we're in-line with what iX-Common backend for SCALE
supports and expands on that by allowing users on non-SCALE systems to
create custom PVC-PV bindings

It also adds initial support for dataSource, for either backup/snapshot
or PVC cloning purposses.
In addition it ensure that a randomised hash is used when dataSource is
set, so we can force a recrease when it's changed.

This also merged `.Values.volumeClaimTemplates` with
`.Values.persistence` by setting `.type` to `vct` on any persistence
reference.
This means users with statefull sets, need to move **all** their
`.Values.volumeClaimTemplates` references into `.Values.persistence`
like this:

old:
```
volumeClaimTemplates:
  data:
    enabled: true
    mountPath: "/var/lib/ldap/"
```

New:
```
persistence:
  data:
    enabled: true
    type: "vct"
    mountPath: "/var/lib/ldap/"
```

On top of this, this PR breaks ALL VCT's by improving the naming scheme.
It's important to NOT install this update on statefull sets lightly, as
this might destroy your data.

Fixes: #558 
Fixes: #562

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [x] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
Technically breaking, as this changes the CNPG storage structure in
values.yaml.
The new structure for CNPG storage is the same as .Values.Persistence
(type is always PVC)

Also Breaking because of VolumeClaimTemplates being merged with
Persistence

**✔️ Checklist:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [x] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [x] 📄 I have made corresponding changes to the documentation
- [x] ⚠️ My changes generate no new warnings
- [x] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [x] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [x] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [x] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros kois <s.kois@outlook.com>
2023-11-12 17:18:35 +01:00

336 lines
10 KiB
YAML

suite: pv data test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should create nfs pv with csi
set:
version: 4.1
persistence:
my-volume1:
enabled: true
type: pvc
static:
mode: nfs
share: /my-path
server: my-server
my-volume2:
enabled: true
type: pvc
static:
mode: nfs
share: /my-path2
server: my-server2
size: 2Gi
mountOptions:
- key: hard
- key: nfsvers
value: "{{ .Values.version }}"
my-volume3:
enabled: true
type: pvc
static:
mode: nfs
share: /my-path3
server: my-server3
size: 3Gi
mountOptions:
- key: hard
- key: nfsvers
value: "{{ .Values.version }}"
asserts:
- documentIndex: &pvDoc 0
isKind:
of: PersistentVolume
- documentIndex: *pvDoc
equal:
path: spec
value:
capacity:
storage: 100Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: test-release-name-common-test-my-volume1-1599277109
accessModes:
- ReadWriteOnce
csi:
driver: nfs.csi.k8s.io
volumeHandle: my-server/my-path#test-release-name-common-test-my-volume1-1599277109
volumeAttributes:
server: my-server
share: /my-path
- documentIndex: &pvcDoc 1
isKind:
of: PersistentVolumeClaim
- documentIndex: *pvcDoc
equal:
path: spec
value:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: test-release-name-common-test-my-volume1-1599277109
volumeName: test-release-name-common-test-my-volume1-1599277109
- documentIndex: &otherPvDoc 2
isKind:
of: PersistentVolume
- documentIndex: *otherPvDoc
equal:
path: spec
value:
capacity:
storage: 2Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: test-release-name-common-test-my-volume2-1702692922
accessModes:
- ReadWriteOnce
mountOptions:
- hard
- nfsvers=4.1
csi:
driver: nfs.csi.k8s.io
volumeHandle: my-server2/my-path2#test-release-name-common-test-my-volume2-1702692922
volumeAttributes:
server: my-server2
share: /my-path2
- documentIndex: &otherPvcDoc 3
isKind:
of: PersistentVolumeClaim
- documentIndex: *otherPvcDoc
equal:
path: spec
value:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: test-release-name-common-test-my-volume2-1702692922
volumeName: test-release-name-common-test-my-volume2-1702692922
- documentIndex: &thirdPvDoc 4
isKind:
of: PersistentVolume
- documentIndex: *thirdPvDoc
equal:
path: spec
value:
capacity:
storage: 3Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: test-release-name-common-test-my-volume3-1705052221
accessModes:
- ReadWriteOnce
mountOptions:
- hard
- nfsvers=4.1
csi:
driver: nfs.csi.k8s.io
volumeHandle: my-server3/my-path3#test-release-name-common-test-my-volume3-1705052221
volumeAttributes:
server: my-server3
share: /my-path3
- documentIndex: &thirdPvcDoc 5
isKind:
of: PersistentVolumeClaim
- documentIndex: *thirdPvcDoc
equal:
path: spec
value:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
storageClassName: test-release-name-common-test-my-volume3-1705052221
volumeName: test-release-name-common-test-my-volume3-1705052221
- it: should create smb pv with csi
set:
version: "3.0"
persistence:
my-volume1:
enabled: true
type: pvc
static:
mode: smb
share: my-share
server: my-server
username: my-user
password: my-password
my-volume2:
enabled: true
type: pvc
static:
mode: smb
share: my-share2
server: my-server2
username: my-user2
password: my-password2
size: 2Gi
mountOptions:
- key: hard
- key: uid
value: 99999999999
- key: vers
value: "{{ .Values.version }}"
my-volume3:
enabled: true
type: pvc
static:
mode: smb
share: my-share3
server: my-server3
username: my-user3
password: my-password3
size: 3Gi
mountOptions:
- key: hard
- key: uid
value: 99999999999
- key: vers
value: "{{ .Values.version }}"
asserts:
- documentIndex: &secretDoc 0
isKind:
of: Secret
- documentIndex: *secretDoc
equal:
path: stringData
value:
username: my-user
password: my-password
- documentIndex: &pvDoc 1
isKind:
of: PersistentVolume
- documentIndex: *pvDoc
equal:
path: spec
value:
capacity:
storage: 100Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: test-release-name-common-test-my-volume1-1627785324
accessModes:
- ReadWriteOnce
csi:
driver: smb.csi.k8s.io
volumeHandle: my-server/my-share#test-release-name-common-test-my-volume1-1627785324
volumeAttributes:
source: //my-server/my-share
nodeStageSecretRef:
name: test-release-name-common-test-my-volume1-1627785324
namespace: test-release-namespace
- documentIndex: &pvcDoc 2
isKind:
of: PersistentVolumeClaim
- documentIndex: *pvcDoc
equal:
path: spec
value:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: test-release-name-common-test-my-volume1-1627785324
volumeName: test-release-name-common-test-my-volume1-1627785324
- documentIndex: &otherSecretDoc 3
isKind:
of: Secret
- documentIndex: *otherSecretDoc
equal:
path: stringData
value:
username: my-user2
password: my-password2
- documentIndex: &otherPvDoc 4
isKind:
of: PersistentVolume
- documentIndex: *otherPvDoc
equal:
path: spec
value:
capacity:
storage: 2Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: test-release-name-common-test-my-volume2-1734805617
accessModes:
- ReadWriteOnce
mountOptions:
- hard
- uid=99999999999
- vers=3.0
csi:
driver: smb.csi.k8s.io
volumeHandle: my-server2/my-share2#test-release-name-common-test-my-volume2-1734805617
volumeAttributes:
source: //my-server2/my-share2
nodeStageSecretRef:
name: test-release-name-common-test-my-volume2-1734805617
namespace: test-release-namespace
- documentIndex: &otherPvcDoc 5
isKind:
of: PersistentVolumeClaim
- documentIndex: *otherPvcDoc
equal:
path: spec
value:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: test-release-name-common-test-my-volume2-1734805617
volumeName: test-release-name-common-test-my-volume2-1734805617
- documentIndex: &thirdSecretDoc 6
isKind:
of: Secret
- documentIndex: *thirdSecretDoc
equal:
path: stringData
value:
username: my-user3
password: my-password3
- documentIndex: &thirdPvDoc 7
isKind:
of: PersistentVolume
- documentIndex: *thirdPvDoc
equal:
path: spec
value:
capacity:
storage: 3Gi
persistentVolumeReclaimPolicy: Delete
storageClassName: test-release-name-common-test-my-volume3-1737164916
accessModes:
- ReadWriteOnce
mountOptions:
- hard
- uid=99999999999
- vers=3.0
csi:
driver: smb.csi.k8s.io
volumeHandle: my-server3/my-share3#test-release-name-common-test-my-volume3-1737164916
volumeAttributes:
source: //my-server3/my-share3
nodeStageSecretRef:
name: test-release-name-common-test-my-volume3-1737164916
namespace: test-release-namespace
- documentIndex: &thirdPvcDoc 8
isKind:
of: PersistentVolumeClaim
- documentIndex: *thirdPvcDoc
equal:
path: spec
value:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
storageClassName: test-release-name-common-test-my-volume3-1737164916
volumeName: test-release-name-common-test-my-volume3-1737164916