Mohammed Naser | 545bc43 | 2023-04-16 23:02:23 +0000 | [diff] [blame] | 1 | # Copyright (c) 2023 VEXXHOST, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | - name: Verify |
| 16 | hosts: controllers |
| 17 | become: true |
| 18 | tasks: |
| 19 | - name: Create a persistent volume |
| 20 | kubernetes.core.k8s: |
| 21 | state: present |
| 22 | definition: |
| 23 | apiVersion: v1 |
| 24 | kind: PersistentVolumeClaim |
| 25 | metadata: |
| 26 | name: test-pvc |
| 27 | namespace: default |
| 28 | spec: |
| 29 | accessModes: |
| 30 | - ReadWriteOnce |
| 31 | resources: |
| 32 | requests: |
| 33 | storage: 5Gi |
| 34 | storageClassName: general |
| 35 | |
| 36 | - name: Create a pod |
| 37 | kubernetes.core.k8s: |
| 38 | state: present |
| 39 | definition: |
| 40 | apiVersion: v1 |
| 41 | kind: Pod |
| 42 | metadata: |
| 43 | name: test-pvc-pod |
| 44 | namespace: default |
| 45 | spec: |
| 46 | volumes: |
| 47 | - name: test-pvc |
| 48 | persistentVolumeClaim: |
| 49 | claimName: test-pvc |
| 50 | containers: |
| 51 | - name: test-pvc-pod-container |
Yaguang Tang | 0953b61 | 2024-12-13 04:14:34 +0800 | [diff] [blame] | 52 | image: harbor.atmosphere.dev/docker.io/library/nginx:1.25 |
Mohammed Naser | 545bc43 | 2023-04-16 23:02:23 +0000 | [diff] [blame] | 53 | volumeMounts: |
| 54 | - name: test-pvc |
| 55 | mountPath: /usr/share/nginx/html |
| 56 | wait: true |
| 57 | wait_timeout: 120 |
| 58 | wait_condition: |
| 59 | type: Ready |
| 60 | status: "True" |
| 61 | |
| 62 | - name: Delete the pod |
| 63 | kubernetes.core.k8s: |
| 64 | state: absent |
| 65 | definition: |
| 66 | apiVersion: v1 |
| 67 | kind: Pod |
| 68 | metadata: |
| 69 | name: test-pvc-pod |
| 70 | namespace: default |
| 71 | |
| 72 | - name: Delete the persistent volume |
| 73 | kubernetes.core.k8s: |
| 74 | state: absent |
| 75 | definition: |
| 76 | apiVersion: v1 |
| 77 | kind: PersistentVolume |
| 78 | metadata: |
| 79 | name: test-pv |
| 80 | wait: true |
| 81 | wait_timeout: 120 |
| 82 | wait_condition: |
| 83 | type: Available |
| 84 | status: "True" |