|
| 1 | +--- |
| 2 | +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json |
| 3 | +apiVersion: chainsaw.kyverno.io/v1alpha1 |
| 4 | +kind: Test |
| 5 | +metadata: |
| 6 | + name: test-azure-key-retain |
| 7 | + labels: |
| 8 | + protocol: "Azure" |
| 9 | + authenticationType: "Key" |
| 10 | + deletionPolicy: "Retain" |
| 11 | +spec: |
| 12 | + template: true |
| 13 | + steps: |
| 14 | + - name: Check if COSI Controller exist |
| 15 | + try: |
| 16 | + - assert: |
| 17 | + file: ../../../tests/controller.yaml |
| 18 | + - name: Create test BucketClass and BucketAccessClass |
| 19 | + try: |
| 20 | + - apply: |
| 21 | + file: ./resources/BucketClass.yaml |
| 22 | + - apply: |
| 23 | + file: ./resources/BucketAccessClass.yaml |
| 24 | + - name: Create BucketClaim |
| 25 | + try: |
| 26 | + - apply: |
| 27 | + file: ./resources/BucketClaim.yaml |
| 28 | + - name: Check if BucketClaim is ready |
| 29 | + try: |
| 30 | + - assert: |
| 31 | + resource: |
| 32 | + apiVersion: objectstorage.k8s.io/v1alpha1 |
| 33 | + kind: BucketClaim |
| 34 | + metadata: |
| 35 | + name: test-azure-key-retain |
| 36 | + status: |
| 37 | + bucketReady: true |
| 38 | + - name: Create BucketAccess |
| 39 | + try: |
| 40 | + - apply: |
| 41 | + file: ./resources/BucketAccess.yaml |
| 42 | + - name: Check if BucketAccess is granted |
| 43 | + try: |
| 44 | + - assert: |
| 45 | + resource: |
| 46 | + apiVersion: objectstorage.k8s.io/v1alpha1 |
| 47 | + kind: BucketAccess |
| 48 | + metadata: |
| 49 | + name: test-azure-key-retain |
| 50 | + status: |
| 51 | + accessGranted: true |
| 52 | + - name: Check if Secret exists |
| 53 | + try: |
| 54 | + - assert: |
| 55 | + resource: |
| 56 | + apiVersion: v1 |
| 57 | + kind: Secret |
| 58 | + metadata: |
| 59 | + name: test-azure-key-retain |
| 60 | + - name: Run ObjectStorage validation tool |
| 61 | + # TODO: This should be either a standalone test tool developed by us, to run test suite: |
| 62 | + # - validate Secret format; |
| 63 | + # - validate connectivity to the Object Storage server; |
| 64 | + # Right now it is using busybox to check if the secret has correct format. |
| 65 | + try: |
| 66 | + - apply: |
| 67 | + file: ../../../tests/validator.yaml |
| 68 | + - create: |
| 69 | + resource: |
| 70 | + apiVersion: batch/v1 |
| 71 | + kind: Job |
| 72 | + metadata: |
| 73 | + name: test-azure-key-retain |
| 74 | + spec: |
| 75 | + ttlSecondsAfterFinished: 100 |
| 76 | + template: |
| 77 | + spec: |
| 78 | + restartPolicy: Never |
| 79 | + containers: |
| 80 | + - name: secret-test |
| 81 | + image: docker.io/library/python:3.12 |
| 82 | + command: [ "sh", "/validation/validation.sh" ] |
| 83 | + volumeMounts: |
| 84 | + - mountPath: /validator |
| 85 | + name: validator |
| 86 | + - mountPath: /conf |
| 87 | + name: secret-vol |
| 88 | + volumes: |
| 89 | + - name: validator |
| 90 | + configMap: |
| 91 | + name: validator |
| 92 | + - name: secret-vol |
| 93 | + secret: |
| 94 | + secretName: test-azure-key-retain |
| 95 | + items: |
| 96 | + - key: BucketInfo |
| 97 | + path: BucketInfo.json |
| 98 | + - name: Check if ObjectStorage validation tool completed succesfully |
| 99 | + try: |
| 100 | + - assert: |
| 101 | + resource: |
| 102 | + apiVersion: batch/v1 |
| 103 | + kind: Job |
| 104 | + metadata: |
| 105 | + name: test-azure-key-retain |
| 106 | + status: |
| 107 | + succeeded: 1 |
0 commit comments