blob: 1cadf22859aa59aad1b8a665d044cd14950792df [file] [log] [blame] [edit]
# Copyright (c) 2023 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Verify
hosts: controllers
become: true
tasks:
- name: Create a persistent volume
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-pvc
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: general
- name: Create a pod
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Pod
metadata:
name: test-pvc-pod
namespace: default
spec:
volumes:
- name: test-pvc
persistentVolumeClaim:
claimName: test-pvc
containers:
- name: test-pvc-pod-container
image: harbor.atmosphere.dev/docker.io/library/nginx:1.25
volumeMounts:
- name: test-pvc
mountPath: /usr/share/nginx/html
wait: true
wait_timeout: 120
wait_condition:
type: Ready
status: "True"
- name: Delete the pod
kubernetes.core.k8s:
state: absent
definition:
apiVersion: v1
kind: Pod
metadata:
name: test-pvc-pod
namespace: default
- name: Delete the persistent volume
kubernetes.core.k8s:
state: absent
definition:
apiVersion: v1
kind: PersistentVolume
metadata:
name: test-pv
wait: true
wait_timeout: 120
wait_condition:
type: Available
status: "True"