|
| 1 | +apiVersion: chainsaw.kyverno.io/v1alpha1 |
| 2 | +kind: Test |
| 3 | +metadata: |
| 4 | + name: qos |
| 5 | +spec: |
| 6 | + steps: |
| 7 | + - name: Deploy 1-node cluster without pod QoS |
| 8 | + description: Deploy a 1-node cluster and wait for readiness |
| 9 | + bindings: |
| 10 | + - name: replicas |
| 11 | + value: 1 |
| 12 | + try: |
| 13 | + - apply: |
| 14 | + file: ../../common/galera.yaml |
| 15 | + - assert: |
| 16 | + # check if all nodes are started and one pod is reacheable via the service endpoint |
| 17 | + file: ../../common/galera-assert.yaml |
| 18 | + - script: &check |
| 19 | + # check if galera can be accessed and cluster is correct |
| 20 | + content: | |
| 21 | + ../../scripts/mysql-cli.sh -sNEe "show status like 'wsrep_cluster_size';" | tail -1 | tr -d '\n' |
| 22 | + check: |
| 23 | + (to_number($stdout)): ($replicas) |
| 24 | + |
| 25 | + - name: Update QoS to Burstable |
| 26 | + description: Ensure that requested resource is configured in the pod |
| 27 | + try: |
| 28 | + - patch: |
| 29 | + resource: |
| 30 | + apiVersion: mariadb.openstack.org/v1beta1 |
| 31 | + kind: Galera |
| 32 | + metadata: |
| 33 | + name: openstack |
| 34 | + spec: |
| 35 | + resources: &res_burstable |
| 36 | + requests: |
| 37 | + memory: "128M" |
| 38 | + cpu: "700m" |
| 39 | + - assert: |
| 40 | + resource: |
| 41 | + apiVersion: v1 |
| 42 | + kind: Pod |
| 43 | + metadata: |
| 44 | + name: openstack-galera-0 |
| 45 | + spec: |
| 46 | + initContainers: |
| 47 | + - resources: *res_burstable |
| 48 | + containers: |
| 49 | + - name: galera |
| 50 | + resources: *res_burstable |
| 51 | + status: |
| 52 | + qosClass: Burstable |
| 53 | + containerStatuses: |
| 54 | + - name: galera |
| 55 | + ready: true |
| 56 | + |
| 57 | + - name: Update QoS to Guaranteed |
| 58 | + description: Ensure that requested and limit resources are configured in the pod |
| 59 | + try: |
| 60 | + - patch: |
| 61 | + resource: |
| 62 | + apiVersion: mariadb.openstack.org/v1beta1 |
| 63 | + kind: Galera |
| 64 | + metadata: |
| 65 | + name: openstack |
| 66 | + spec: |
| 67 | + resources: &res_guaranteed |
| 68 | + limits: |
| 69 | + memory: "256M" |
| 70 | + cpu: "700m" |
| 71 | + requests: |
| 72 | + memory: "256M" |
| 73 | + cpu: "700m" |
| 74 | + - assert: |
| 75 | + resource: |
| 76 | + apiVersion: v1 |
| 77 | + kind: Pod |
| 78 | + metadata: |
| 79 | + name: openstack-galera-0 |
| 80 | + spec: |
| 81 | + initContainers: |
| 82 | + - resources: *res_guaranteed |
| 83 | + containers: |
| 84 | + - name: galera |
| 85 | + resources: *res_guaranteed |
| 86 | + status: |
| 87 | + qosClass: Guaranteed |
| 88 | + containerStatuses: |
| 89 | + - name: galera |
| 90 | + ready: true |
| 91 | + |
| 92 | + - name: Remove pod QoS |
| 93 | + description: Ensure that a pod QoS can be removed |
| 94 | + try: |
| 95 | + - patch: |
| 96 | + resource: |
| 97 | + apiVersion: mariadb.openstack.org/v1beta1 |
| 98 | + kind: Galera |
| 99 | + metadata: |
| 100 | + name: openstack |
| 101 | + spec: |
| 102 | + resources: |
| 103 | + - assert: |
| 104 | + resource: |
| 105 | + apiVersion: v1 |
| 106 | + kind: Pod |
| 107 | + metadata: |
| 108 | + name: openstack-galera-0 |
| 109 | + status: |
| 110 | + qosClass: BestEffort |
| 111 | + containerStatuses: |
| 112 | + - name: galera |
| 113 | + ready: true |
0 commit comments