diff --git a/.github/workflows/e2e-chainsaw.yml b/.github/workflows/e2e-chainsaw.yml index c939d6815..a3e75a3dc 100644 --- a/.github/workflows/e2e-chainsaw.yml +++ b/.github/workflows/e2e-chainsaw.yml @@ -9,6 +9,18 @@ on: - master jobs: + + validate-yaml: + name: Validate YAML + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install yamllint + run: sudo apt-get install -y yamllint + - name: Lint YAML files + run: yamllint --strict ./tests/ + test: name: ${{ matrix.testpath }} runs-on: ubuntu-latest diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 000000000..5d83d60f3 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,9 @@ +extends: default + +rules: + line-length: + max: 200 + level: warning + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + comments-indentation: disable diff --git a/hack/yaml-fixer.sh b/hack/yaml-fixer.sh new file mode 100755 index 000000000..1989fa939 --- /dev/null +++ b/hack/yaml-fixer.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +export YAMLFIX_LINE_LENGTH="150" + +# This script is used to fix the yaml files in the repository. +# Note: yamlfix utility doesn't seems to be much mature idk but it is fixing the .crt .tls .ca extenstion present in testdata + +DIR="" + +if [ -n "$1" ]; then + DIR="$1" +fi + +if which yamlfix >/dev/null; then + echo "yamlfix version is." "$(yamlfix --version)" +else + echo "yamlfix is not installed. Please install it using 'pip install yamlfix'" + exit 0 +fi + + +# Since yamlfix is not able to search in a directory recursively +# run in parallel so stdout is mixed up +if [ -n "$DIR" ]; then + echo "------------------------------" + echo "Fixing all YAML files in the directory and its subdirectories: $DIR" + find "$DIR" \( -name '*.yml' -o -name '*.yaml' \) -type f -print0 | xargs -0 -P 4 -I {} yamlfix "{}" + echo "yamlfix has been applied to all YAML files in $DIR and its subdirectories." +fi diff --git a/tests/_config/chainsaw-configuration.yaml b/tests/_config/chainsaw-configuration.yaml index 2259297c9..c5318ce00 100644 --- a/tests/_config/chainsaw-configuration.yaml +++ b/tests/_config/chainsaw-configuration.yaml @@ -1,5 +1,5 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Configuration metadata: diff --git a/tests/_config/kind-config.yaml b/tests/_config/kind-config.yaml index 5553b6587..0b89ed05c 100644 --- a/tests/_config/kind-config.yaml +++ b/tests/_config/kind-config.yaml @@ -1,11 +1,12 @@ +--- kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 name: kind nodes: -- role: control-plane -- role: worker -- role: worker -- role: worker -- role: worker -- role: worker -- role: worker \ No newline at end of file + - role: control-plane + - role: worker + - role: worker + - role: worker + - role: worker + - role: worker + - role: worker diff --git a/tests/_config/kuttl-test.yaml b/tests/_config/kuttl-test.yaml index 8e560ef77..e64c01a54 100644 --- a/tests/_config/kuttl-test.yaml +++ b/tests/_config/kuttl-test.yaml @@ -1,7 +1,8 @@ +--- apiVersion: kuttl.dev/v1beta1 kind: TestSuite startKIND: false -kindConfig: "./kind-config.yaml" +kindConfig: ./kind-config.yaml parallel: 1 timeout: 1200 testDirs: @@ -10,5 +11,4 @@ testDirs: - tests/e2e/v1beta2/ignore-annots - tests/e2e/v1beta2/scaling - tests/e2e/v1beta2/hostnetwork -suppress : - - events \ No newline at end of file +suppress: [events] diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml index 675db6f1c..46441f262 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/acl-secret.yaml @@ -6,6 +6,6 @@ metadata: type: Opaque stringData: # yamllint disable-line rule:line-length - user.acl: | + user.acl: |- user opstree on ~* &* +@all >abc@123 user buildpiper on ~* &* +@all >abc@123 diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml index f83bfe75f..92a6da4b8 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/chainsaw-test.yaml @@ -1,144 +1,158 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-cluster-setup spec: steps: - - try: - - apply: - file: acl-secret.yaml - - assert: - resource: - apiVersion: v1 - kind: Secret - metadata: - name: acl-secret - - apply: - file: cluster.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - catch: - - description: Redis Operator Logs - podLogs: + - try: + - apply: + file: acl-secret.yaml + - assert: + resource: + apiVersion: v1 + kind: Secret + metadata: + name: acl-secret + - apply: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + catch: + - description: Redis Operator Logs + podLogs: namespace: redis-operator-system selector: control-plane=redis-operator container: manager - tail: -1 # tail all logs - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Cluster Nodes - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Check Cluster Slots Coverage - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - - name: Try saving a key With Password - try: - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-0 bar-0 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-1 bar-1 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-2 bar-2 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-3 bar-3 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-4 bar-4 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-5 bar-5 - check: - ($stdout=='OK'): true \ No newline at end of file + tail: -1 # tail all logs + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Cluster Nodes + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Check Cluster Slots Coverage + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - name: Try saving a key With Password + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-0 bar-0 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-1 bar-1 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-2 bar-2 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-3 bar-3 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-4 bar-4 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 --user opstree --pass abc@123 set foo-5 bar-5 + check: + ($stdout=='OK'): true diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml index 6c231d87b..e01010516 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -37,14 +38,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml index e8af234a6..90b2bf06f 100644 --- a/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/acl-user/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -198,4 +199,4 @@ spec: role: follower type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/ha-failover/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/ha-failover/chainsaw-test.yaml index 3fb05ca44..81716a6ee 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-failover/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-failover/chainsaw-test.yaml @@ -1,3 +1,4 @@ +--- apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: @@ -14,16 +15,14 @@ spec: catch: - description: Redis Operator Logs podLogs: - namespace: redis-operator-system - selector: control-plane=redis-operator - container: manager - tail: -1 # tail all logs - + namespace: redis-operator-system + selector: control-plane=redis-operator + container: manager + tail: -1 # tail all logs - name: Sleep for 3 minutes try: - sleep: duration: 3m - - name: Test sentinel monitoring try: - script: @@ -35,10 +34,10 @@ spec: catch: - description: Redis Operator Logs podLogs: - namespace: redis-operator-system - selector: control-plane=redis-operator - container: manager - tail: -1 # tail all logs + namespace: redis-operator-system + selector: control-plane=redis-operator + container: manager + tail: -1 # tail all logs # New created cluster, the first pod is master - name: Terminate the redis-replication-0 pod @@ -50,16 +49,14 @@ spec: catch: - description: Redis Operator Logs podLogs: - namespace: redis-operator-system - selector: control-plane=redis-operator - container: manager - tail: -1 # tail all logs - + namespace: redis-operator-system + selector: control-plane=redis-operator + container: manager + tail: -1 # tail all logs - name: Sleep for 3 minutes try: - sleep: duration: 3m - - name: Test sentinel monitoring try: - script: @@ -71,7 +68,7 @@ spec: catch: - description: Redis Operator Logs podLogs: - namespace: redis-operator-system - selector: control-plane=redis-operator - container: manager - tail: -1 # tail all logs \ No newline at end of file + namespace: redis-operator-system + selector: control-plane=redis-operator + container: manager + tail: -1 # tail all logs diff --git a/tests/e2e-chainsaw/v1beta2/ha-failover/cli-pod.yaml b/tests/e2e-chainsaw/v1beta2/ha-failover/cli-pod.yaml index e8501253e..e3049d88b 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-failover/cli-pod.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-failover/cli-pod.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Pod metadata: @@ -6,9 +7,9 @@ metadata: app: redis spec: containers: - - name: redis - image: redis:alpine - resources: - limits: - cpu: 200m - memory: 500Mi + - name: redis + image: redis:alpine + resources: + limits: + cpu: 200m + memory: 500Mi diff --git a/tests/e2e-chainsaw/v1beta2/ha-failover/replication.yaml b/tests/e2e-chainsaw/v1beta2/ha-failover/replication.yaml index 3fb33dcac..bf7c7e7b4 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-failover/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-failover/replication.yaml @@ -21,7 +21,7 @@ spec: storage: volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/ha-failover/sentinel.yaml b/tests/e2e-chainsaw/v1beta2/ha-failover/sentinel.yaml index 955066544..994b5626a 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-failover/sentinel.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-failover/sentinel.yaml @@ -9,8 +9,8 @@ spec: runAsUser: 1000 fsGroup: 1000 redisSentinelConfig: - redisReplicationName : redis-replication - quorum: "1" + redisReplicationName: redis-replication + quorum: '1' kubernetesConfig: image: quay.io/opstree/redis-sentinel:latest imagePullPolicy: Always @@ -20,4 +20,4 @@ spec: memory: 128Mi limits: cpu: 101m - memory: 128Mi \ No newline at end of file + memory: 128Mi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/fully-secured/random b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/fully-secured/random index e69de29bb..8b1378917 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/fully-secured/random +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/fully-secured/random @@ -0,0 +1 @@ + diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/chainsaw-test.yaml index 29a5487a2..434cb2a84 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/chainsaw-test.yaml @@ -1,56 +1,53 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-ha-setup-partial-secured-replication spec: steps: - - try: - - create: - file: secret.yaml - - assert: - file: secret.yaml - - apply: - file: replication.yaml - - assert: - file: ready-replication-sts.yaml - - assert: - file: ready-replication-svc.yaml - - assert: - file: ready-replication-pvc.yaml - - create: - file: password.yaml - - apply: - file: sentinel.yaml - - assert: - file: ready-sentinel-sts.yaml - - assert: - file: ready-sentinel-svc.yaml - - create: - file: cli-pod.yaml - - assert: - file: cli-pod.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Replicated Service from Cli Pod - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-replication.${NAMESPACE}.svc -p 6379 -a Opstree@1234 ping - check: - ($stdout=='PONG'): true - - - name: Ping Sentinel Service from Cli Pod - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 ping - check: - ($stdout=='PONG'): true + - try: + - create: + file: secret.yaml + - assert: + file: secret.yaml + - apply: + file: replication.yaml + - assert: + file: ready-replication-sts.yaml + - assert: + file: ready-replication-svc.yaml + - assert: + file: ready-replication-pvc.yaml + - create: + file: password.yaml + - apply: + file: sentinel.yaml + - assert: + file: ready-sentinel-sts.yaml + - assert: + file: ready-sentinel-svc.yaml + - create: + file: cli-pod.yaml + - assert: + file: cli-pod.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Replicated Service from Cli Pod + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-replication.${NAMESPACE}.svc -p 6379 -a Opstree@1234 ping + check: + ($stdout=='PONG'): true + - name: Ping Sentinel Service from Cli Pod + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 ping + check: + ($stdout=='PONG'): true diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/cli-pod.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/cli-pod.yaml index e8501253e..e3049d88b 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/cli-pod.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/cli-pod.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Pod metadata: @@ -6,9 +7,9 @@ metadata: app: redis spec: containers: - - name: redis - image: redis:alpine - resources: - limits: - cpu: 200m - memory: 500Mi + - name: redis + image: redis:alpine + resources: + limits: + cpu: 200m + memory: 500Mi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/password.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/password.yaml index 346addd89..d2411ff46 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/password.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/password.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: redis-replication-secret + name: redis-replication-secret stringData: - redis-replication-password: "Opstree@1234" + redis-replication-password: Opstree@1234 type: Opaque diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-pvc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-pvc.yaml index f57cb3f61..10d9c886c 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-sts.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-sts.yaml index f2ac67b1a..7e1712a8e 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -16,4 +17,4 @@ metadata: name: redis-replication status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-svc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-svc.yaml index 707a8df9b..3e2e7ccbb 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-replication-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -32,9 +33,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -62,9 +63,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -87,4 +88,4 @@ spec: app: redis-replication redis_setup_type: replication role: replication - type: ClusterIP \ No newline at end of file + type: ClusterIP diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-secret.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-secret.yaml index de09d2654..c6ee0b3ab 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-secret.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-secret.yaml @@ -2,5 +2,5 @@ apiVersion: v1 kind: Secret metadata: - name: redis-replication-secret -type: Opaque \ No newline at end of file + name: redis-replication-secret +type: Opaque diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-sts.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-sts.yaml index 28ed1dace..782908c01 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -24,7 +25,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -32,4 +33,4 @@ spec: role: sentinel status: readyReplicas: 1 - replicas: 1 \ No newline at end of file + replicas: 1 diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-svc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-svc.yaml index 4ce66a032..5f0556616 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/ready-sentinel-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -66,9 +67,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/replication.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/replication.yaml index cde71e67e..155811686 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/replication.yaml @@ -24,7 +24,7 @@ spec: storage: volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/sentinel.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/sentinel.yaml index 2cc5040c6..02fca1f8e 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/sentinel.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/replication-password/sentinel.yaml @@ -1,5 +1,5 @@ +--- # yaml-language-server: $schema=../../../../../../../../config/crd/bases/redis.redis.opstreelabs.in_redissentinels.yaml - apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisSentinel metadata: @@ -10,10 +10,10 @@ spec: runAsUser: 1000 fsGroup: 1000 redisSentinelConfig: - redisReplicationName : redis-replication - quorum: "1" + redisReplicationName: redis-replication + quorum: '1' redisReplicationPassword: - secretKeyRef: + secretKeyRef: name: redis-replication-secret key: redis-replication-password kubernetesConfig: @@ -25,4 +25,4 @@ spec: memory: 128Mi limits: cpu: 101m - memory: 128Mi \ No newline at end of file + memory: 128Mi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/chainsaw-test.yaml index 834f7caef..f9ad51130 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/chainsaw-test.yaml @@ -1,63 +1,59 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-ha-setup-partial-secured-sentinel spec: steps: - - try: - - apply: - file: replication.yaml - - assert: - file: ready-replication-sts.yaml - - assert: - file: ready-replication-svc.yaml - - assert: - file: ready-replication-pvc.yaml - - create: - file: secret.yaml - - assert: - file: secret.yaml - - apply: - file: sentinel.yaml - - assert: - file: ready-sentinel-sts.yaml - - assert: - file: ready-sentinel-svc.yaml - - create: - file: cli-pod.yaml - - assert: - file: cli-pod.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Replicated Service from Cli Pod - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-replication.${NAMESPACE}.svc -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Ping Sentinel Service from Cli Pod With password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 -a Opstree@1234 ping - check: - ($stdout=='PONG'): true - - - name: Ping Sentinel Service from Cli Pod Without password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true \ No newline at end of file + - try: + - apply: + file: replication.yaml + - assert: + file: ready-replication-sts.yaml + - assert: + file: ready-replication-svc.yaml + - assert: + file: ready-replication-pvc.yaml + - create: + file: secret.yaml + - assert: + file: secret.yaml + - apply: + file: sentinel.yaml + - assert: + file: ready-sentinel-sts.yaml + - assert: + file: ready-sentinel-svc.yaml + - create: + file: cli-pod.yaml + - assert: + file: cli-pod.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Replicated Service from Cli Pod + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-replication.${NAMESPACE}.svc -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Ping Sentinel Service from Cli Pod With password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 -a Opstree@1234 ping + check: + ($stdout=='PONG'): true + - name: Ping Sentinel Service from Cli Pod Without password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/cli-pod.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/cli-pod.yaml index e8501253e..e3049d88b 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/cli-pod.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/cli-pod.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Pod metadata: @@ -6,9 +7,9 @@ metadata: app: redis spec: containers: - - name: redis - image: redis:alpine - resources: - limits: - cpu: 200m - memory: 500Mi + - name: redis + image: redis:alpine + resources: + limits: + cpu: 200m + memory: 500Mi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-pvc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-pvc.yaml index f57cb3f61..10d9c886c 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-sts.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-sts.yaml index f2ac67b1a..7e1712a8e 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -16,4 +17,4 @@ metadata: name: redis-replication status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-svc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-svc.yaml index 707a8df9b..3e2e7ccbb 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-replication-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -32,9 +33,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -62,9 +63,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -87,4 +88,4 @@ spec: app: redis-replication redis_setup_type: replication role: replication - type: ClusterIP \ No newline at end of file + type: ClusterIP diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-sts.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-sts.yaml index 28ed1dace..782908c01 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -24,7 +25,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -32,4 +33,4 @@ spec: role: sentinel status: readyReplicas: 1 - replicas: 1 \ No newline at end of file + replicas: 1 diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-svc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-svc.yaml index 4ce66a032..5f0556616 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/ready-sentinel-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -66,9 +67,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/replication.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/replication.yaml index 3fb33dcac..bf7c7e7b4 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/replication.yaml @@ -21,7 +21,7 @@ spec: storage: volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/sentinel.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/sentinel.yaml index bd350a122..345287bcd 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/sentinel.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/secured/partially-secured/sentinel-password/sentinel.yaml @@ -9,8 +9,8 @@ spec: runAsUser: 1000 fsGroup: 1000 redisSentinelConfig: - redisReplicationName : redis-replication - quorum: "1" + redisReplicationName: redis-replication + quorum: '1' kubernetesConfig: image: quay.io/opstree/redis-sentinel:latest imagePullPolicy: Always @@ -23,4 +23,4 @@ spec: memory: 128Mi limits: cpu: 101m - memory: 128Mi \ No newline at end of file + memory: 128Mi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/chainsaw-test.yaml index 897524046..e0c31e0ea 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/chainsaw-test.yaml @@ -1,50 +1,47 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-ha-setup-unsecured spec: steps: - - try: - - apply: - file: replication.yaml - - assert: - file: ready-replication-sts.yaml - - assert: - file: ready-replication-svc.yaml - - assert: - file: ready-replication-pvc.yaml - - apply: - file: sentinel.yaml - - assert: - file: ready-sentinel-sts.yaml - - assert: - file: ready-sentinel-svc.yaml - - create: - file: cli-pod.yaml - - assert: - file: cli-pod.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Replicated Service from Cli Pod - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-replication.${NAMESPACE}.svc -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Ping Sentinel Service from Cli Pod - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 ping - check: - ($stdout=='PONG'): true + - try: + - apply: + file: replication.yaml + - assert: + file: ready-replication-sts.yaml + - assert: + file: ready-replication-svc.yaml + - assert: + file: ready-replication-pvc.yaml + - apply: + file: sentinel.yaml + - assert: + file: ready-sentinel-sts.yaml + - assert: + file: ready-sentinel-svc.yaml + - create: + file: cli-pod.yaml + - assert: + file: cli-pod.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Replicated Service from Cli Pod + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-replication.${NAMESPACE}.svc -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Ping Sentinel Service from Cli Pod + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis -- redis-cli -h redis-sentinel-sentinel.${NAMESPACE}.svc -p 26379 ping + check: + ($stdout=='PONG'): true diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/cli-pod.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/cli-pod.yaml index e8501253e..e3049d88b 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/cli-pod.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/cli-pod.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Pod metadata: @@ -6,9 +7,9 @@ metadata: app: redis spec: containers: - - name: redis - image: redis:alpine - resources: - limits: - cpu: 200m - memory: 500Mi + - name: redis + image: redis:alpine + resources: + limits: + cpu: 200m + memory: 500Mi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-pvc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-pvc.yaml index f57cb3f61..10d9c886c 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-sts.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-sts.yaml index f2ac67b1a..7e1712a8e 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -16,4 +17,4 @@ metadata: name: redis-replication status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-svc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-svc.yaml index 707a8df9b..3e2e7ccbb 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-replication-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -32,9 +33,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -62,9 +63,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -87,4 +88,4 @@ spec: app: redis-replication redis_setup_type: replication role: replication - type: ClusterIP \ No newline at end of file + type: ClusterIP diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-sts.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-sts.yaml index 28ed1dace..782908c01 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -24,7 +25,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -32,4 +33,4 @@ spec: role: sentinel status: readyReplicas: 1 - replicas: 1 \ No newline at end of file + replicas: 1 diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-svc.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-svc.yaml index 4ce66a032..5f0556616 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/ready-sentinel-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -66,9 +67,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/replication.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/replication.yaml index 3fb33dcac..bf7c7e7b4 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/replication.yaml @@ -21,7 +21,7 @@ spec: storage: volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/sentinel.yaml b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/sentinel.yaml index 955066544..994b5626a 100644 --- a/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/sentinel.yaml +++ b/tests/e2e-chainsaw/v1beta2/ha-setup/unsecured/sentinel.yaml @@ -9,8 +9,8 @@ spec: runAsUser: 1000 fsGroup: 1000 redisSentinelConfig: - redisReplicationName : redis-replication - quorum: "1" + redisReplicationName: redis-replication + quorum: '1' kubernetesConfig: image: quay.io/opstree/redis-sentinel:latest imagePullPolicy: Always @@ -20,4 +20,4 @@ spec: memory: 128Mi limits: cpu: 101m - memory: 128Mi \ No newline at end of file + memory: 128Mi diff --git a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/chainsaw-test.yaml index 92f2d2793..c3a37ab9c 100644 --- a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/chainsaw-test.yaml @@ -1,152 +1,152 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: host-network spec: steps: - - name: Setup redis cluster on host network - try: - - apply: - file: cluster.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - assert: - file: ready-pod.yaml - - - name: Install Redis Cli - try: - - script: - timeout: 5m - content: | - sudo apt install redis-tools -y - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Redis Cluster from every node - try: - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping - check: - ($stdout=='PONG'): true - - - name: Curl Exporter from every node - try: - - script: - timeout: 30s - content: | - # - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - - name: Try saving a key from every node - try: - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-0 bar-0 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-1 bar-1 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-2 bar-2 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-3 bar-3 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-4 bar-4 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-5 bar-5 - check: - ($stdout=='OK'): true \ No newline at end of file + - name: Setup redis cluster on host network + try: + - apply: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - assert: + file: ready-pod.yaml + - name: Install Redis Cli + try: + - script: + timeout: 5m + content: | + sudo apt install redis-tools -y + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Redis Cluster from every node + try: + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 ping + check: + ($stdout=='PONG'): true + - name: Curl Exporter from every node + try: + - script: + timeout: 30s + content: > + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | + xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | + xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | + xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | + xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | + xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | + xargs -I {} curl -s http://{}:9122/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - name: Try saving a key from every node + try: + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 1 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-0 bar-0 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 2 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-1 bar-1 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 3 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-2 bar-2 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 4 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-3 bar-3 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 5 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-4 bar-4 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl get node -o wide | grep 'worker' | awk '{print $6}' | head -n 6 | tail -n 1 | xargs -I {} redis-cli -h {} -c -p 6380 set foo-5 bar-5 + check: + ($stdout=='OK'): true diff --git a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/cluster.yaml index 687044052..05dadf043 100644 --- a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -6,7 +7,7 @@ spec: hostNetwork: true port: 6380 clusterSize: 3 - clusterVersion: v6 # hostNetwork only works with v6 + clusterVersion: v6 # hostNetwork only works with v6 persistenceEnabled: true podSecurityContext: runAsUser: 1000 @@ -37,14 +38,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pod.yaml b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pod.yaml index b26382e6d..2b383ec8b 100644 --- a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pod.yaml +++ b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pod.yaml @@ -1,8 +1,9 @@ +--- apiVersion: v1 kind: Pod metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 name: redis-cluster-v1beta2-leader-0 spec: @@ -10,17 +11,17 @@ spec: - name: redis-cluster-v1beta2-leader env: - name: PERSISTENCE_ENABLED - value: "true" + value: 'true' - name: REDIS_ADDR - value: "redis://localhost:6379" + value: redis://localhost:6379 - name: REDIS_MAJOR_VERSION - value: "v6" + value: v6 - name: REDIS_PORT - value: "6380" + value: '6380' - name: SERVER_MODE - value: "cluster" + value: cluster - name: SETUP_MODE - value: "cluster" + value: cluster - name: redis-exporter hostNetwork: true status: @@ -30,7 +31,7 @@ apiVersion: v1 kind: Pod metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 name: redis-cluster-v1beta2-leader-1 spec: @@ -38,17 +39,17 @@ spec: - name: redis-cluster-v1beta2-leader env: - name: PERSISTENCE_ENABLED - value: "true" + value: 'true' - name: REDIS_ADDR - value: "redis://localhost:6379" + value: redis://localhost:6379 - name: REDIS_MAJOR_VERSION - value: "v6" + value: v6 - name: REDIS_PORT - value: "6380" + value: '6380' - name: SERVER_MODE - value: "cluster" + value: cluster - name: SETUP_MODE - value: "cluster" + value: cluster - name: redis-exporter hostNetwork: true status: @@ -58,7 +59,7 @@ apiVersion: v1 kind: Pod metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 name: redis-cluster-v1beta2-leader-2 spec: @@ -66,17 +67,17 @@ spec: - name: redis-cluster-v1beta2-leader env: - name: PERSISTENCE_ENABLED - value: "true" + value: 'true' - name: REDIS_ADDR - value: "redis://localhost:6379" + value: redis://localhost:6379 - name: REDIS_MAJOR_VERSION - value: "v6" + value: v6 - name: REDIS_PORT - value: "6380" + value: '6380' - name: SERVER_MODE - value: "cluster" + value: cluster - name: SETUP_MODE - value: "cluster" + value: cluster - name: redis-exporter hostNetwork: true status: @@ -86,7 +87,7 @@ apiVersion: v1 kind: Pod metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 name: redis-cluster-v1beta2-follower-0 spec: @@ -94,17 +95,17 @@ spec: - name: redis-cluster-v1beta2-follower env: - name: PERSISTENCE_ENABLED - value: "true" + value: 'true' - name: REDIS_ADDR - value: "redis://localhost:6379" + value: redis://localhost:6379 - name: REDIS_MAJOR_VERSION - value: "v6" + value: v6 - name: REDIS_PORT - value: "6380" + value: '6380' - name: SERVER_MODE - value: "cluster" + value: cluster - name: SETUP_MODE - value: "cluster" + value: cluster - name: redis-exporter hostNetwork: true status: @@ -114,7 +115,7 @@ apiVersion: v1 kind: Pod metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 name: redis-cluster-v1beta2-follower-1 spec: @@ -122,17 +123,17 @@ spec: - name: redis-cluster-v1beta2-follower env: - name: PERSISTENCE_ENABLED - value: "true" + value: 'true' - name: REDIS_ADDR - value: "redis://localhost:6379" + value: redis://localhost:6379 - name: REDIS_MAJOR_VERSION - value: "v6" + value: v6 - name: REDIS_PORT - value: "6380" + value: '6380' - name: SERVER_MODE - value: "cluster" + value: cluster - name: SETUP_MODE - value: "cluster" + value: cluster - name: redis-exporter hostNetwork: true status: @@ -142,7 +143,7 @@ apiVersion: v1 kind: Pod metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 name: redis-cluster-v1beta2-follower-2 spec: @@ -150,18 +151,18 @@ spec: - name: redis-cluster-v1beta2-follower env: - name: PERSISTENCE_ENABLED - value: "true" + value: 'true' - name: REDIS_ADDR - value: "redis://localhost:6379" + value: redis://localhost:6379 - name: REDIS_MAJOR_VERSION - value: "v6" + value: v6 - name: REDIS_PORT - value: "6380" + value: '6380' - name: SERVER_MODE - value: "cluster" + value: cluster - name: SETUP_MODE - value: "cluster" + value: cluster - name: redis-exporter hostNetwork: true status: - phase: Running \ No newline at end of file + phase: Running diff --git a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-svc.yaml index 1d248a5d5..a438e242f 100644 --- a/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/hostnetwork/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9122" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9122' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9122" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9122' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9122" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9122' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9122" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9122' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9122" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9122' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9122" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9122' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -198,4 +199,4 @@ spec: role: follower type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/chainsaw-test.yaml index f78603de4..a708b0a95 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/chainsaw-test.yaml @@ -1,20 +1,20 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-cluster-ignore-annots spec: steps: - - name: Setup Redis Cluster - try: - - create: - file: cluster.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-pvc.yaml - - error: - file: ignore-annots-sts.yaml + - name: Setup Redis Cluster + try: + - create: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-pvc.yaml + - error: + file: ignore-annots-sts.yaml diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/cluster.yaml index 9744e4f3a..6d24c9872 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/cluster.yaml @@ -1,9 +1,10 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: name: redis-cluster-v1beta2 annotations: - need-ignore-key: "need-ignore-value" + need-ignore-key: need-ignore-value spec: clusterSize: 3 clusterVersion: v7 @@ -12,8 +13,7 @@ spec: runAsUser: 1000 fsGroup: 1000 kubernetesConfig: - ignoreAnnotations: - - "need-ignore-key" + ignoreAnnotations: [need-ignore-key] image: quay.io/opstree/redis:latest imagePullPolicy: Always resources: @@ -27,14 +27,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ignore-annots-sts.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ignore-annots-sts.yaml index ec4d3c68a..7d8847b55 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ignore-annots-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ignore-annots-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -7,12 +8,12 @@ metadata: redis_setup_type: cluster role: leader annotations: - need-ignore-key: "need-ignore-value" + need-ignore-key: need-ignore-value spec: template: metadata: annotations: - need-ignore-key: "need-ignore-value" + need-ignore-key: need-ignore-value --- apiVersion: apps/v1 kind: StatefulSet @@ -23,9 +24,9 @@ metadata: redis_setup_type: cluster role: follower annotations: - need-ignore-key: "need-ignore-value" + need-ignore-key: need-ignore-value spec: template: metadata: annotations: - need-ignore-key: "need-ignore-value" \ No newline at end of file + need-ignore-key: need-ignore-value diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-cluster.yaml index 186f67d63..fb6f17085 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-cluster.yaml @@ -1,9 +1,10 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: name: redis-cluster-v1beta2 annotations: - need-ignore-key: "need-ignore-value" + need-ignore-key: need-ignore-value status: readyFollowerReplicas: 3 readyLeaderReplicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-sts.yaml index d272d671b..bd107d9b1 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -10,7 +11,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 status: replicas: 3 @@ -28,7 +29,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 status: replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/chainsaw-test.yaml index 338c32525..3ccb62680 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/chainsaw-test.yaml @@ -1,20 +1,20 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-cluster-ignore-annots spec: steps: - - name: Setup Redis Standalone - try: - - create: - file: standalone.yaml - - assert: - file: ready-standalone.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-pvc.yaml - - error: - file: ignore-annots-sts.yaml + - name: Setup Redis Standalone + try: + - create: + file: standalone.yaml + - assert: + file: ready-standalone.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-pvc.yaml + - error: + file: ignore-annots-sts.yaml diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ignore-annots-sts.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ignore-annots-sts.yaml index ced8a3244..d7754234d 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ignore-annots-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ignore-annots-sts.yaml @@ -1,11 +1,12 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: name: redis-standalone-v1beta2 annotations: - need-ignore-key: "need-ignore-value" + need-ignore-key: need-ignore-value spec: template: metadata: annotations: - need-ignore-key: "need-ignore-value" \ No newline at end of file + need-ignore-key: need-ignore-value diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-pvc.yaml index 777fa3656..29ecbfc3d 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: standalone role: standalone status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-standalone.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-standalone.yaml index 1e25d81c1..cfc5107ad 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-standalone.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-standalone.yaml @@ -1,6 +1,7 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: Redis metadata: name: redis-standalone-v1beta2 annotations: - need-ignore-key: "need-ignore-value" \ No newline at end of file + need-ignore-key: need-ignore-value diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-sts.yaml index 4e95a8910..9c54cdb5f 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -10,7 +11,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 status: replicas: 1 diff --git a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/standalone.yaml b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/standalone.yaml index 6a940f706..04eed47ed 100644 --- a/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/standalone.yaml +++ b/tests/e2e-chainsaw/v1beta2/ignore-annots/redis-standalone/standalone.yaml @@ -1,16 +1,16 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: Redis metadata: name: redis-standalone-v1beta2 annotations: - need-ignore-key: "need-ignore-value" + need-ignore-key: need-ignore-value spec: podSecurityContext: runAsUser: 1000 - fsGroup: 1000 + fsGroup: 1000 kubernetesConfig: - ignoreAnnotations: - - "need-ignore-key" + ignoreAnnotations: [need-ignore-key] image: quay.io/opstree/redis:latest imagePullPolicy: Always resources: @@ -24,7 +24,7 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/chainsaw-test.yaml index 5ee5221b4..f3639eadc 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/chainsaw-test.yaml @@ -1,34 +1,33 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: keep-pvc spec: steps: - - name: Install - try: - - apply: - file: cluster.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - - name: Uninstall - try: - - delete: - ref: - name: redis-cluster-v1beta2 - kind: RedisCluster - apiVersion: redis.redis.opstreelabs.in/v1beta2 - - error: - file: ready-sts.yaml - - error: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml + - name: Install + try: + - apply: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - name: Uninstall + try: + - delete: + ref: + name: redis-cluster-v1beta2 + kind: RedisCluster + apiVersion: redis.redis.opstreelabs.in/v1beta2 + - error: + file: ready-sts.yaml + - error: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/cluster.yaml index 126651a37..0fac38be4 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -35,14 +36,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-svc.yaml index e8af234a6..90b2bf06f 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -198,4 +199,4 @@ spec: role: follower type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/chainsaw-test.yaml index 922c98e94..296fa9f7b 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/chainsaw-test.yaml @@ -1,32 +1,31 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: keep-pvc spec: steps: - - name: Install - try: - - apply: - file: replication.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - - name: Uninstall - try: - - delete: - ref: - name: redis-replication - kind: RedisReplication - apiVersion: redis.redis.opstreelabs.in/v1beta2 - - error: - file: ready-sts.yaml - - error: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml \ No newline at end of file + - name: Install + try: + - apply: + file: replication.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - name: Uninstall + try: + - delete: + ref: + name: redis-replication + kind: RedisReplication + apiVersion: redis.redis.opstreelabs.in/v1beta2 + - error: + file: ready-sts.yaml + - error: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-pvc.yaml index f57cb3f61..10d9c886c 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-sts.yaml index f2ac67b1a..7e1712a8e 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -16,4 +17,4 @@ metadata: name: redis-replication status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-svc.yaml index 707a8df9b..3e2e7ccbb 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -32,9 +33,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -62,9 +63,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -87,4 +88,4 @@ spec: app: redis-replication redis_setup_type: replication role: replication - type: ClusterIP \ No newline at end of file + type: ClusterIP diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/replication.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/replication.yaml index 5b3f3c5ac..d7637d0de 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-replication/replication.yaml @@ -22,7 +22,7 @@ spec: keepAfterDelete: true volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/chainsaw-test.yaml index 130ba36df..2dc6062d7 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/chainsaw-test.yaml @@ -1,32 +1,31 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: keep-pvc spec: steps: - - name: Install - try: - - apply: - file: standalone.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - - name: Uninstall - try: - - delete: - ref: - name: redis-standalone-v1beta2 - kind: Redis - apiVersion: redis.redis.opstreelabs.in/v1beta2 - - error: - file: ready-sts.yaml - - error: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml \ No newline at end of file + - name: Install + try: + - apply: + file: standalone.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - name: Uninstall + try: + - delete: + ref: + name: redis-standalone-v1beta2 + kind: Redis + apiVersion: redis.redis.opstreelabs.in/v1beta2 + - error: + file: ready-sts.yaml + - error: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-pvc.yaml index 777fa3656..29ecbfc3d 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: standalone role: standalone status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-sts.yaml index 5402de920..d7941e8ba 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-svc.yaml index 08b416ce2..05965659c 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -35,9 +36,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -67,9 +68,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -93,4 +94,4 @@ spec: role: standalone type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/standalone.yaml b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/standalone.yaml index 3962ff653..f692af513 100644 --- a/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/standalone.yaml +++ b/tests/e2e-chainsaw/v1beta2/keep-pvc/redis-standalone/standalone.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: Redis metadata: @@ -5,7 +6,7 @@ metadata: spec: podSecurityContext: runAsUser: 1000 - fsGroup: 1000 + fsGroup: 1000 kubernetesConfig: image: quay.io/opstree/redis:latest imagePullPolicy: Always @@ -21,7 +22,7 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/chainsaw-test.yaml index 2ed8bbb82..51161bc06 100644 --- a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/chainsaw-test.yaml @@ -1,130 +1,126 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-cluster-nodeport spec: steps: - - name: Setup redis cluster use nodeport - try: - - apply: - file: cluster.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Cluster - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Check Cluster - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli --cluster check 127.0.0.1:6379 - check: - (contains($stdout, '[OK] All 16384 slots covered.')): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli --cluster check 127.0.0.1:6379 - check: - (contains($stdout, '[OK] All 16384 slots covered.')): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli --cluster check 127.0.0.1:6379 - check: - (contains($stdout, '[OK] All 16384 slots covered.')): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli --cluster check 127.0.0.1:6379 - check: - (contains($stdout, '[OK] All 16384 slots covered.')): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli --cluster check 127.0.0.1:6379 - check: - (contains($stdout, '[OK] All 16384 slots covered.')): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli --cluster check 127.0.0.1:6379 - check: - (contains($stdout, '[OK] All 16384 slots covered.')): true - - - name: Try saving a key With Password - try: - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 set foo-0 bar-0 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 set foo-1 bar-1 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 set foo-2 bar-2 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 set foo-3 bar-3 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 set foo-4 bar-4 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 set foo-5 bar-5 - check: - ($stdout=='OK'): true \ No newline at end of file + - name: Setup redis cluster use nodeport + try: + - apply: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Cluster + try: + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Check Cluster + try: + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli --cluster check 127.0.0.1:6379 + check: + (contains($stdout, '[OK] All 16384 slots covered.')): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli --cluster check 127.0.0.1:6379 + check: + (contains($stdout, '[OK] All 16384 slots covered.')): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli --cluster check 127.0.0.1:6379 + check: + (contains($stdout, '[OK] All 16384 slots covered.')): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli --cluster check 127.0.0.1:6379 + check: + (contains($stdout, '[OK] All 16384 slots covered.')): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli --cluster check 127.0.0.1:6379 + check: + (contains($stdout, '[OK] All 16384 slots covered.')): true + - script: + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli --cluster check 127.0.0.1:6379 + check: + (contains($stdout, '[OK] All 16384 slots covered.')): true + - name: Try saving a key With Password + try: + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 set foo-0 bar-0 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 set foo-1 bar-1 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 set foo-2 bar-2 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 set foo-3 bar-3 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 set foo-4 bar-4 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: | + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 set foo-5 bar-5 + check: + ($stdout=='OK'): true diff --git a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/cluster.yaml index 805d02a3c..634018552 100644 --- a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -36,14 +37,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-svc.yaml index c56a06bd7..944a19031 100644 --- a/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/nodeport/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/chainsaw-test.yaml index 1d76bce27..b7974b9db 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/chainsaw-test.yaml @@ -1,223 +1,247 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-cluster-password spec: steps: - - try: - - apply: - file: cluster.yaml - - apply: - file: secret.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - assert: - file: secret.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Cluster With Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - - name: Try saving a key With Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 -a Opstree1234 set foo-0 bar-0 - check: - ($stdout=='OK'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 -a Opstree1234 set foo-1 bar-1 - check: - ($stdout=='OK'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 -a Opstree1234 set foo-2 bar-2 - check: - ($stdout=='OK'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 -a Opstree1234 set foo-3 bar-3 - check: - ($stdout=='OK'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 -a Opstree1234 set foo-4 bar-4 - check: - ($stdout=='OK'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 -a Opstree1234 set foo-5 bar-5 - check: - ($stdout=='OK'): true - - - name: Ping Cluster Without Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - - name: Try saving a key Without Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 set foo-0 bar-0 - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 set foo-1 bar-1 - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 set foo-2 bar-2 - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 set foo-3 bar-3 - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 set foo-4 bar-4 - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 set foo-5 bar-5 - check: - ($stdout=='NOAUTH Authentication required.'): true - - - name: Test Redis Exporter - try: - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true \ No newline at end of file + - try: + - apply: + file: cluster.yaml + - apply: + file: secret.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - assert: + file: secret.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Cluster With Password + try: + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - name: Try saving a key With Password + try: + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 -a Opstree1234 set foo-0 bar-0 + check: + ($stdout=='OK'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 -a Opstree1234 set foo-1 bar-1 + check: + ($stdout=='OK'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 -a Opstree1234 set foo-2 bar-2 + check: + ($stdout=='OK'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 -a Opstree1234 set foo-3 bar-3 + check: + ($stdout=='OK'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 -a Opstree1234 set foo-4 bar-4 + check: + ($stdout=='OK'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 -a Opstree1234 set foo-5 bar-5 + check: + ($stdout=='OK'): true + - name: Ping Cluster Without Password + try: + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - name: Try saving a key Without Password + try: + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 set foo-0 bar-0 + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 set foo-1 bar-1 + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 set foo-2 bar-2 + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 set foo-3 bar-3 + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 set foo-4 bar-4 + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 set foo-5 bar-5 + check: + ($stdout=='NOAUTH Authentication required.'): true + - name: Test Redis Exporter + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/cluster.yaml index 257720a64..64ee82b4e 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -37,14 +38,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-svc.yaml index e8af234a6..90b2bf06f 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -198,4 +199,4 @@ spec: role: follower type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-replication/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-replication/chainsaw-test.yaml index f15f063ad..5bdd5f8ae 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-replication/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-replication/chainsaw-test.yaml @@ -1,59 +1,56 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-replication-password spec: steps: - - try: - - apply: - file: replication.yaml - - apply: - file: secret.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - assert: - file: secret.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Replicated Cluster With Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 -a Opstree1234 ping - check: - ($stdout=='PONG'): true - - - name: Try saving a key With Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 -a Opstree1234 set foo-0 bar-0 - check: - ($stdout=='OK'): true + - try: + - apply: + file: replication.yaml + - apply: + file: secret.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - assert: + file: secret.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Replicated Cluster With Password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 -a Opstree1234 ping + check: + ($stdout=='PONG'): true + - name: Try saving a key With Password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 -a Opstree1234 set foo-0 bar-0 + check: + ($stdout=='OK'): true # - script: # timeout: 10s # content: | @@ -66,45 +63,43 @@ spec: # kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 -a Opstree1234 set foo-2 bar-2 # check: # ($stdout=='READONLY You can't write against a read only replica.'): true - - - name: Ping Replicated Cluster Without Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 ping - check: - ($stdout=='NOAUTH Authentication required.'): true - - - name: Try saving a key Without Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 set foo-0 bar-0 - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 set foo-1 bar-1 - check: - ($stdout=='NOAUTH Authentication required.'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 set foo-2 bar-2 - check: - ($stdout=='NOAUTH Authentication required.'): true + - name: Ping Replicated Cluster Without Password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 ping + check: + ($stdout=='NOAUTH Authentication required.'): true + - name: Try saving a key Without Password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 set foo-0 bar-0 + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 set foo-1 bar-1 + check: + ($stdout=='NOAUTH Authentication required.'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 set foo-2 bar-2 + check: + ($stdout=='NOAUTH Authentication required.'): true diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-pvc.yaml index f57cb3f61..10d9c886c 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-sts.yaml index f2ac67b1a..7e1712a8e 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -16,4 +17,4 @@ metadata: name: redis-replication status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-svc.yaml index 707a8df9b..3e2e7ccbb 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-replication/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -32,9 +33,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -62,9 +63,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -87,4 +88,4 @@ spec: app: redis-replication redis_setup_type: replication role: replication - type: ClusterIP \ No newline at end of file + type: ClusterIP diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-replication/replication.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-replication/replication.yaml index 7ee034870..b177f395c 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-replication/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-replication/replication.yaml @@ -24,7 +24,7 @@ spec: storage: volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/chainsaw-test.yaml index f6c0c723e..4f378bc59 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/chainsaw-test.yaml @@ -1,53 +1,50 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-replication-password spec: steps: - - try: - - apply: - file: standalone.yaml - - apply: - file: secret.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - assert: - file: secret.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Try saving a key With Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-standalone-v1beta2-0 -c redis-standalone-v1beta2 -- redis-cli -p 6379 -a Opstree1234 set foo-0 bar-0 - check: - ($stdout=='OK'): true - - - name: Try saving a key Without Password - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-standalone-v1beta2-0 -c redis-standalone-v1beta2 -- redis-cli -p 6379 set foo-0 bar-0 - check: - ($stdout=='NOAUTH Authentication required.'): true - - - name: Test Redis Exporter - try: - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} redis-standalone-v1beta2-0 -c redis-standalone-v1beta2 -- wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' - check: - ($stdout=='1'): true \ No newline at end of file + - try: + - apply: + file: standalone.yaml + - apply: + file: secret.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + - assert: + file: secret.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Try saving a key With Password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-standalone-v1beta2-0 -c redis-standalone-v1beta2 -- redis-cli -p 6379 -a Opstree1234 set foo-0 bar-0 + check: + ($stdout=='OK'): true + - name: Try saving a key Without Password + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-standalone-v1beta2-0 -c redis-standalone-v1beta2 -- redis-cli -p 6379 set foo-0 bar-0 + check: + ($stdout=='NOAUTH Authentication required.'): true + - name: Test Redis Exporter + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} redis-standalone-v1beta2-0 -c redis-standalone-v1beta2 -- + wget -qO- http://localhost:9121/metrics | grep -v '^#' | grep -E '\bredis_up\b' | awk '{print $2}' + check: + ($stdout=='1'): true diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-pvc.yaml index 777fa3656..29ecbfc3d 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: standalone role: standalone status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-sts.yaml index 5402de920..d7941e8ba 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-svc.yaml index 275aae8cd..b1f49ac47 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -35,9 +36,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -71,9 +72,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -97,4 +98,4 @@ spec: role: standalone type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/standalone.yaml b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/standalone.yaml index ad7eed929..1bcca28d4 100644 --- a/tests/e2e-chainsaw/v1beta2/password/redis-standalone/standalone.yaml +++ b/tests/e2e-chainsaw/v1beta2/password/redis-standalone/standalone.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: Redis metadata: @@ -5,7 +6,7 @@ metadata: spec: podSecurityContext: runAsUser: 1000 - fsGroup: 1000 + fsGroup: 1000 kubernetesConfig: image: quay.io/opstree/redis:latest imagePullPolicy: Always @@ -34,7 +35,7 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/chainsaw-test.yaml index a022f9537..db0efcb92 100644 --- a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/chainsaw-test.yaml @@ -8,11 +8,11 @@ spec: - name: Add PVC name environment try: - script: - content: | - kubectl patch deployment redis-operator-redis-operator --namespace redis-operator-system --type json -p='[{"op": "add", "path": "/spec/template/spec/containers/0/env/-", "value": {"name": "OPERATOR_STS_PVC_TEMPLATE_NAME", "value": "data"}}]' + content: > + kubectl patch deployment redis-operator-redis-operator --namespace redis-operator-system --type json + -p='[{"op": "add", "path": "/spec/template/spec/containers/0/env/-", "value": {"name": "OPERATOR_STS_PVC_TEMPLATE_NAME", "value": "data"}}]' - sleep: duration: 1m - - name: redis-cluster-install try: - apply: @@ -25,7 +25,6 @@ spec: file: ready-svc.yaml - assert: file: ready-pvc.yaml - - name: redis-cluster-uninstall try: - delete: @@ -41,10 +40,9 @@ spec: file: ready-svc.yaml - error: file: ready-pvc.yaml - - name: Remove PVC name environment try: - script: - content: | + content: |- kubectl patch deployment redis-operator-redis-operator --namespace redis-operator-system --type json -p='[{"op": "remove", "path": "/spec/template/spec/containers/0/env/1"}]' kubectl wait --for=condition=available --timeout=300s deployment/redis-operator-redis-operator -n redis-operator-system diff --git a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/cluster.yaml index ecf147104..ccbde1924 100644 --- a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -34,14 +35,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-pvc.yaml index 2511fa8d5..c7706058c 100644 --- a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-svc.yaml index e8af234a6..90b2bf06f 100644 --- a/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -198,4 +199,4 @@ spec: role: follower type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/chainsaw-test.yaml index 85aa0cb3d..6eafeb05d 100644 --- a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/chainsaw-test.yaml @@ -1,227 +1,256 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-cluster-setup spec: steps: - - name: Create Redis Cluster - try: - - create: - file: cluster.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Cluster Nodes - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Check Cluster Slots - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - - name: Scale Redis Cluster - try: - - apply: - file: cluster-scale-up.yaml - - assert: - file: ready-cluster-scale-up.yaml - - assert: - file: ready-sts-scale-up.yaml - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Scaled Cluster Nodes - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-3 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-4 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-5 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-3 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-4 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-5 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Check Scaled Cluster Slots - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-3 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-4 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-5 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-3 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-4 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-5 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true \ No newline at end of file + - name: Create Redis Cluster + try: + - create: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Cluster Nodes + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Check Cluster Slots + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - name: Scale Redis Cluster + try: + - apply: + file: cluster-scale-up.yaml + - assert: + file: ready-cluster-scale-up.yaml + - assert: + file: ready-sts-scale-up.yaml + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Scaled Cluster Nodes + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-3 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-4 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-5 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-3 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-4 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-5 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Check Scaled Cluster Slots + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-3 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-4 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-5 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-3 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-4 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-5 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true diff --git a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster-scale-up.yaml b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster-scale-up.yaml index 5f64363e8..ac5e85413 100644 --- a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster-scale-up.yaml +++ b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster-scale-up.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -34,14 +35,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster.yaml index ecf147104..ccbde1924 100644 --- a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -34,14 +35,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster-scale-up.yaml b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster-scale-up.yaml index 907e75ccc..eb06df309 100644 --- a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster-scale-up.yaml +++ b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster-scale-up.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -5,4 +6,4 @@ metadata: status: state: Ready readyLeaderReplicas: 6 - readyFollowerReplicas: 6 \ No newline at end of file + readyFollowerReplicas: 6 diff --git a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster.yaml index 3a08c80b6..bc823bbb0 100644 --- a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -5,4 +6,4 @@ metadata: status: state: Ready readyLeaderReplicas: 3 - readyFollowerReplicas: 3 \ No newline at end of file + readyFollowerReplicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts-scale-up.yaml b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts-scale-up.yaml index 61d865e0f..6de6ae80b 100644 --- a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts-scale-up.yaml +++ b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts-scale-up.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/scaling/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml index c036ab288..7af2381d7 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/chainsaw-test.yaml @@ -1,138 +1,150 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-cluster-setup spec: steps: - - try: - - apply: - file: cluster.yaml - - assert: - file: ready-cluster.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - catch: - - description: Redis Operator Logs - podLogs: + - try: + - apply: + file: cluster.yaml + - assert: + file: ready-cluster.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + catch: + - description: Redis Operator Logs + podLogs: namespace: redis-operator-system selector: control-plane=redis-operator container: manager - tail: -1 # tail all logs - - - name: Sleep for five minutes - try: - - sleep: - duration: 5m - - - name: Ping Cluster - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Check Cluster - try: - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - script: - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' - check: - ($stdout=='[OK] All 16384 slots covered.'): true - - - - name: Try saving a key With Password - try: - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 set foo-0 bar-0 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 set foo-1 bar-1 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 set foo-2 bar-2 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 set foo-3 bar-3 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 set foo-4 bar-4 - check: - ($stdout=='OK'): true - - script: - timeout: 30s - content: | - kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 set foo-5 bar-5 - check: - ($stdout=='OK'): true - + tail: -1 # tail all logs + - name: Sleep for five minutes + try: + - sleep: + duration: 5m + - name: Ping Cluster + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Check Cluster + try: + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered.' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - script: + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli --cluster check 127.0.0.1:6379 | grep 'All 16384 slots covered' + check: + ($stdout=='[OK] All 16384 slots covered.'): true + - name: Try saving a key With Password + try: + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- + redis-cli -c -p 6379 set foo-0 bar-0 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- + redis-cli -c -p 6379 set foo-1 bar-1 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- + redis-cli -c -p 6379 set foo-2 bar-2 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- + redis-cli -c -p 6379 set foo-3 bar-3 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- + redis-cli -c -p 6379 set foo-4 bar-4 + check: + ($stdout=='OK'): true + - script: + timeout: 30s + content: > + kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- + redis-cli -c -p 6379 set foo-5 bar-5 + check: + ($stdout=='OK'): true diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/cluster.yaml index ecf147104..ccbde1924 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -34,14 +35,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-svc.yaml index e8af234a6..90b2bf06f 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -198,4 +199,4 @@ spec: role: follower type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/chainsaw-test.yaml index 0b536b458..c74eed234 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/chainsaw-test.yaml @@ -1,56 +1,64 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-replication-setup spec: steps: - - try: - - apply: - file: replication.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - - assert: - file: ready-pvc.yaml - - assert: - file: ready-replication.yaml - catch: - - description: Redis Operator Logs - podLogs: + - try: + - apply: + file: replication.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + - assert: + file: ready-pvc.yaml + catch: + - description: Redis Operator Logs + podLogs: namespace: redis-operator-system selector: control-plane=redis-operator container: manager - tail: -1 # tail all logs - - - name: Ping Replicated Cluster - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 ping - check: - ($stdout=='PONG'): true - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 ping - check: - ($stdout=='PONG'): true - - - name: Try saving a key - try: - - script: - timeout: 10s - content: | - kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 set foo-0 bar-0 - check: - ($stdout=='OK'): true \ No newline at end of file + tail: -1 # tail all logs + - name: Ping Replicated Cluster + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 ping + check: + ($stdout=='PONG'): true + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 ping + check: + ($stdout=='PONG'): true + - name: Try saving a key + try: + - script: + timeout: 10s + content: | + kubectl exec --namespace ${NAMESPACE} redis-replication-0 -- redis-cli -p 6379 set foo-0 bar-0 + check: + ($stdout=='OK'): true + # - script: + # timeout: 10s + # content: | + # kubectl exec --namespace ${NAMESPACE} redis-replication-1 -- redis-cli -p 6379 set foo-1 bar-1 + # check: + # ($stdout==`READONLY You can't write against a read only replica.`): true + # - script: + # timeout: 10s + # content: | + # kubectl exec --namespace ${NAMESPACE} redis-replication-2 -- redis-cli -p 6379 set foo-2 bar-2 + # check: + # ($stdout==`READONLY You can't write against a read only replica.`): true diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-pvc.yaml index f57cb3f61..10d9c886c 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-replication.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-replication.yaml index f3a13d647..58db03571 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-replication.yaml @@ -5,4 +5,4 @@ metadata: name: redis-replication status: # by default, the first pod is being selected as master - masterNode: redis-replication-0 \ No newline at end of file + masterNode: redis-replication-0 diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-sts.yaml index f2ac67b1a..7e1712a8e 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -16,4 +17,4 @@ metadata: name: redis-replication status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-svc.yaml index 707a8df9b..3e2e7ccbb 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -32,9 +33,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -62,9 +63,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -87,4 +88,4 @@ spec: app: redis-replication redis_setup_type: replication role: replication - type: ClusterIP \ No newline at end of file + type: ClusterIP diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/replication.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/replication.yaml index 3fb33dcac..bf7c7e7b4 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-replication/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-replication/replication.yaml @@ -21,7 +21,7 @@ spec: storage: volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/chainsaw-test.yaml index c3a26553d..4f42a8edd 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/chainsaw-test.yaml @@ -1,22 +1,22 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: name: redis-sentinel-setup spec: steps: - - try: - - apply: - file: sentinel.yaml - - assert: - file: ready-sts.yaml - - assert: - file: ready-svc.yaml - catch: - - description: Redis Operator Logs - podLogs: + - try: + - apply: + file: sentinel.yaml + - assert: + file: ready-sts.yaml + - assert: + file: ready-svc.yaml + catch: + - description: Redis Operator Logs + podLogs: namespace: redis-operator-system selector: control-plane=redis-operator container: manager - tail: -1 # tail all logs \ No newline at end of file + tail: -1 # tail all logs diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-sts.yaml index c6056ab05..c983596f2 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -24,7 +25,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -32,4 +33,4 @@ spec: role: sentinel status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-svc.yaml index 4ce66a032..5f0556616 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -66,9 +67,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel diff --git a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/sentinel.yaml b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/sentinel.yaml index 7260486a6..2fc9f45fd 100644 --- a/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/sentinel.yaml +++ b/tests/e2e-chainsaw/v1beta2/setup/redis-sentinel/sentinel.yaml @@ -19,4 +19,4 @@ spec: memory: 128Mi limits: cpu: 101m - memory: 128Mi \ No newline at end of file + memory: 128Mi diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/chainsaw-test.yaml index c0f32993d..9c9970e7d 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/chainsaw-test.yaml @@ -17,7 +17,6 @@ spec: file: ready-svc.yaml - assert: file: ready-pvc.yaml - - name: redis-cluster-uninstall try: - delete: diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/cluster.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/cluster.yaml index ecf147104..ccbde1924 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: @@ -34,14 +35,14 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi nodeConfVolume: true nodeConfVolumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-cluster.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-cluster.yaml index 49e754e81..004498aff 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-cluster.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: RedisCluster metadata: diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-pvc.yaml index a89bfa22a..92097d64b 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -52,8 +50,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -67,8 +64,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -82,14 +78,11 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound - --- - apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -99,8 +92,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -114,8 +106,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -129,8 +120,7 @@ metadata: redis_setup_type: cluster role: leader status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -144,8 +134,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -159,8 +148,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -174,8 +162,7 @@ metadata: redis_setup_type: cluster role: follower status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-sts.yaml index 1053eb784..73545eaab 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -9,9 +10,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-svc.yaml index e8af234a6..90b2bf06f 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-cluster/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -70,9 +71,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-leader @@ -103,9 +104,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -139,9 +140,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -171,9 +172,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-cluster-v1beta2 labels: app: redis-cluster-v1beta2-follower @@ -198,4 +199,4 @@ spec: role: follower type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/chainsaw-test.yaml index e040a64d2..be97ff7d5 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/chainsaw-test.yaml @@ -1,5 +1,5 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: @@ -17,7 +17,6 @@ spec: file: ready-svc.yaml - assert: file: ready-pvc.yaml - - name: redis-replication-uninstall description: Uninstall Redis Replication try: diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-pvc.yaml index f57cb3f61..10d9c886c 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -22,8 +22,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound @@ -37,8 +36,7 @@ metadata: redis_setup_type: replication role: replication status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-sts.yaml index f2ac67b1a..7e1712a8e 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -16,4 +17,4 @@ metadata: name: redis-replication status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-svc.yaml index 707a8df9b..3e2e7ccbb 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -32,9 +33,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -62,9 +63,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-replication labels: app: redis-replication @@ -87,4 +88,4 @@ spec: app: redis-replication redis_setup_type: replication role: replication - type: ClusterIP \ No newline at end of file + type: ClusterIP diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/replication.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/replication.yaml index 7c85e8e03..4e09fea71 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/replication.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-replication/replication.yaml @@ -32,7 +32,7 @@ spec: storage: volumeClaimTemplate: spec: - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/chainsaw-test.yaml index 163731940..1f528e011 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/chainsaw-test.yaml @@ -1,5 +1,5 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: @@ -15,7 +15,6 @@ spec: file: ready-sts.yaml - assert: file: ready-svc.yaml - - name: redis-sentinel-uninstall description: Uninstall Redis Sentinel try: @@ -28,4 +27,3 @@ spec: file: ready-sts.yaml - error: file: ready-svc.yaml - diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-sts.yaml index c6056ab05..c983596f2 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-sts.yaml @@ -1,8 +1,9 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -24,7 +25,7 @@ spec: template: metadata: annotations: - redis.opstreelabs.in: "true" + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -32,4 +33,4 @@ spec: role: sentinel status: readyReplicas: 3 - replicas: 3 \ No newline at end of file + replicas: 3 diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-svc.yaml index 4ce66a032..5f0556616 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -34,9 +35,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel @@ -66,9 +67,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-sentinel labels: app: redis-sentinel-sentinel diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/sentinel.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/sentinel.yaml index ca09db7f9..e214fc254 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/sentinel.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-sentinel/sentinel.yaml @@ -20,4 +20,4 @@ spec: memory: 128Mi limits: cpu: 101m - memory: 128Mi \ No newline at end of file + memory: 128Mi diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/chainsaw-test.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/chainsaw-test.yaml index 1300c14c6..6b27fd2ce 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/chainsaw-test.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/chainsaw-test.yaml @@ -1,5 +1,5 @@ +--- # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json - apiVersion: chainsaw.kyverno.io/v1alpha1 kind: Test metadata: @@ -16,7 +16,6 @@ spec: file: ready-svc.yaml - assert: file: ready-pvc.yaml - - name: redis-standalone-uninstall try: - delete: diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-pvc.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-pvc.yaml index 5649e1c3b..29ecbfc3d 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-pvc.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-pvc.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -7,8 +8,7 @@ metadata: redis_setup_type: standalone role: standalone status: - accessModes: - - ReadWriteOnce + accessModes: [ReadWriteOnce] capacity: storage: 1Gi phase: Bound diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-sts.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-sts.yaml index 5402de920..d7941e8ba 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-sts.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-svc.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-svc.yaml index 08b416ce2..05965659c 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-svc.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/ready-svc.yaml @@ -1,10 +1,11 @@ +--- apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -35,9 +36,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -67,9 +68,9 @@ apiVersion: v1 kind: Service metadata: annotations: - prometheus.io/port: "9121" - prometheus.io/scrape: "true" - redis.opstreelabs.in: "true" + prometheus.io/port: '9121' + prometheus.io/scrape: 'true' + redis.opstreelabs.in: 'true' redis.opstreelabs.instance: redis-standalone-v1beta2 labels: app: redis-standalone-v1beta2 @@ -93,4 +94,4 @@ spec: role: standalone type: ClusterIP status: - loadBalancer: {} \ No newline at end of file + loadBalancer: {} diff --git a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/standalone.yaml b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/standalone.yaml index c0cc6ded9..aaea4cac7 100644 --- a/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/standalone.yaml +++ b/tests/e2e-chainsaw/v1beta2/teardown/redis-standalone/standalone.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta2 kind: Redis metadata: @@ -5,7 +6,7 @@ metadata: spec: podSecurityContext: runAsUser: 1000 - fsGroup: 1000 + fsGroup: 1000 kubernetesConfig: image: quay.io/opstree/redis:latest imagePullPolicy: Always @@ -20,7 +21,7 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi diff --git a/tests/e2e/v1beta1/setup/00-install.yaml b/tests/e2e/v1beta1/setup/00-install.yaml index 94b166978..05090155c 100644 --- a/tests/e2e/v1beta1/setup/00-install.yaml +++ b/tests/e2e/v1beta1/setup/00-install.yaml @@ -1,7 +1,5 @@ +--- apiVersion: kuttl.dev/v1beta1 kind: TestStep -apply : - - cluster.yaml -assert : - - ready-cluster.yaml - - ready-cluster-sts.yaml \ No newline at end of file +apply: [cluster.yaml] +assert: [ready-cluster.yaml, ready-cluster-sts.yaml] diff --git a/tests/e2e/v1beta1/setup/cluster.yaml b/tests/e2e/v1beta1/setup/cluster.yaml index 6315fc563..fe7a6119f 100644 --- a/tests/e2e/v1beta1/setup/cluster.yaml +++ b/tests/e2e/v1beta1/setup/cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta1 kind: RedisCluster metadata: @@ -34,7 +35,7 @@ spec: volumeClaimTemplate: spec: # storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: - storage: 1Gi \ No newline at end of file + storage: 1Gi diff --git a/tests/e2e/v1beta1/setup/ready-cluster-sts.yaml b/tests/e2e/v1beta1/setup/ready-cluster-sts.yaml index 8c0fec94c..909597dc1 100644 --- a/tests/e2e/v1beta1/setup/ready-cluster-sts.yaml +++ b/tests/e2e/v1beta1/setup/ready-cluster-sts.yaml @@ -1,3 +1,4 @@ +--- apiVersion: apps/v1 kind: StatefulSet metadata: @@ -5,9 +6,7 @@ metadata: status: replicas: 3 readyReplicas: 3 - --- - apiVersion: apps/v1 kind: StatefulSet metadata: diff --git a/tests/e2e/v1beta1/setup/ready-cluster.yaml b/tests/e2e/v1beta1/setup/ready-cluster.yaml index 79a48407b..88a19d87e 100644 --- a/tests/e2e/v1beta1/setup/ready-cluster.yaml +++ b/tests/e2e/v1beta1/setup/ready-cluster.yaml @@ -1,3 +1,4 @@ +--- apiVersion: redis.redis.opstreelabs.in/v1beta1 kind: RedisCluster metadata: diff --git a/tests/testdata/redis-cluster.yaml b/tests/testdata/redis-cluster.yaml index b107d6508..26eee377e 100644 --- a/tests/testdata/redis-cluster.yaml +++ b/tests/testdata/redis-cluster.yaml @@ -7,7 +7,7 @@ metadata: labels: app: redis-cluster annotations: - opstreelabs.in/redis: "true" + opstreelabs.in/redis: 'true' spec: clusterSize: 3 kubernetesConfig: @@ -25,8 +25,7 @@ spec: redisSecret: name: redis-secret key: password - ignoreAnnotations: - - "opstreelabs.in/ignore" + ignoreAnnotations: [opstreelabs.in/ignore] podSecurityContext: runAsUser: 1000 fsGroup: 1000 @@ -37,18 +36,18 @@ spec: runAsNonRoot: true readOnlyRootFilesystem: true capabilities: - drop: [ "ALL" ] - add: [ "NET_BIND_SERVICE" ] + drop: [ALL] + add: [NET_BIND_SERVICE] replicas: 3 redisConfig: additionalRedisConfig: redis-external-config-leader tolerations: - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoSchedule" - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoExecute" + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoExecute affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: @@ -56,8 +55,7 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/infra operator: In - values: - - redisLeader + values: [redisLeader] redisFollower: securityContext: runAsUser: 1000 @@ -65,18 +63,18 @@ spec: runAsNonRoot: true readOnlyRootFilesystem: true capabilities: - drop: [ "ALL" ] - add: [ "NET_BIND_SERVICE" ] + drop: [ALL] + add: [NET_BIND_SERVICE] replicas: 3 redisConfig: additionalRedisConfig: redis-external-config-follower tolerations: - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoSchedule" - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoExecute" + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoExecute affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: @@ -84,8 +82,7 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/infra operator: In - values: - - redisFollower + values: [redisFollower] redisExporter: enabled: true image: quay.io/opstree/redis-exporter:v1.44.0 @@ -99,7 +96,7 @@ spec: memory: 128Mi env: - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS - value: "true" + value: 'true' - name: UI_PROPERTIES_FILE_NAME valueFrom: configMapKeyRef: @@ -116,14 +113,14 @@ spec: nodeConfVolumeClaimTemplate: spec: storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi volumeClaimTemplate: spec: storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi @@ -148,15 +145,15 @@ spec: secretName: redis-tls-cert env: - name: CUSTOM_ENV_VAR_1 - value: "custom_value_1" + value: custom_value_1 - name: CUSTOM_ENV_VAR_2 - value: "custom_value_2" + value: custom_value_2 initContainer: enabled: true image: quay.io/opstree/redis-operator-restore:latest imagePullPolicy: Always - command: ["/bin/bash", "-c", "/app/restore.bash"] - args: ["--restore-from", "redis-cluster-restore"] + command: [/bin/bash, -c, /app/restore.bash] + args: [--restore-from, redis-cluster-restore] resources: requests: cpu: 100m @@ -174,4 +171,4 @@ spec: valueFrom: secretKeyRef: name: env-secrets - key: CLUSTER_NAMESPACE \ No newline at end of file + key: CLUSTER_NAMESPACE diff --git a/tests/testdata/redis-replication.yaml b/tests/testdata/redis-replication.yaml index 2f695bfe1..4214e2f3c 100644 --- a/tests/testdata/redis-replication.yaml +++ b/tests/testdata/redis-replication.yaml @@ -7,7 +7,7 @@ metadata: labels: app: redis-replication annotations: - opstreelabs.in/redis: "true" + opstreelabs.in/redis: 'true' spec: clusterSize: 3 redisConfig: @@ -21,8 +21,8 @@ spec: runAsNonRoot: true readOnlyRootFilesystem: true capabilities: - drop: ["ALL"] - add: ["NET_BIND_SERVICE"] + drop: [ALL] + add: [NET_BIND_SERVICE] kubernetesConfig: image: quay.io/opstree/redis:v7.0.12 imagePullPolicy: IfNotPresent @@ -38,8 +38,7 @@ spec: redisSecret: name: redis-secret key: password - ignoreAnnotations: - - "opstreelabs.in/ignore" + ignoreAnnotations: [opstreelabs.in/ignore] redisExporter: enabled: true image: quay.io/opstree/redis-exporter:v1.44.0 @@ -53,7 +52,7 @@ spec: memory: 128Mi env: - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS - value: "true" + value: 'true' - name: UI_PROPERTIES_FILE_NAME valueFrom: configMapKeyRef: @@ -68,7 +67,7 @@ spec: volumeClaimTemplate: spec: storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi @@ -90,15 +89,14 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/infra operator: In - values: - - worker + values: [worker] tolerations: - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoSchedule" - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoExecute" + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoExecute serviceAccountName: redis-sa terminationGracePeriodSeconds: 30 acl: @@ -112,15 +110,15 @@ spec: secretName: redis-tls-cert env: - name: CUSTOM_ENV_VAR_1 - value: "custom_value_1" + value: custom_value_1 - name: CUSTOM_ENV_VAR_2 - value: "custom_value_2" + value: custom_value_2 initContainer: enabled: true image: quay.io/opstree/redis-operator-restore:latest imagePullPolicy: Always - command: ["/bin/bash", "-c", "/app/restore.bash"] - args: ["--restore-from", "redis-replication-restore"] + command: [/bin/bash, -c, /app/restore.bash] + args: [--restore-from, redis-replication-restore] resources: requests: cpu: 100m diff --git a/tests/testdata/redis-sentinel.yaml b/tests/testdata/redis-sentinel.yaml index 40bf80154..f102f92f2 100644 --- a/tests/testdata/redis-sentinel.yaml +++ b/tests/testdata/redis-sentinel.yaml @@ -7,7 +7,7 @@ metadata: labels: app: redis-sentinel annotations: - opstreelabs.in/redis: "true" + opstreelabs.in/redis: 'true' spec: clusterSize: 3 podSecurityContext: @@ -19,8 +19,8 @@ spec: runAsNonRoot: true readOnlyRootFilesystem: true capabilities: - drop: ["ALL"] - add: ["NET_BIND_SERVICE"] + drop: [ALL] + add: [NET_BIND_SERVICE] kubernetesConfig: image: quay.io/opstree/redis:v7.0.12 imagePullPolicy: IfNotPresent @@ -36,8 +36,7 @@ spec: redisSecret: name: redis-secret key: password - ignoreAnnotations: - - "opstreelabs.in/ignore" + ignoreAnnotations: [opstreelabs.in/ignore] redisExporter: enabled: true image: quay.io/opstree/redis-exporter:v1.44.0 @@ -51,7 +50,7 @@ spec: memory: 128Mi env: - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS - value: "true" + value: 'true' - name: UI_PROPERTIES_FILE_NAME valueFrom: configMapKeyRef: @@ -72,15 +71,14 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/infra operator: In - values: - - worker + values: [worker] tolerations: - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoSchedule" - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoExecute" + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoExecute serviceAccountName: redis-sa terminationGracePeriodSeconds: 30 TLS: @@ -91,15 +89,15 @@ spec: secretName: redis-tls-cert env: - name: CUSTOM_ENV_VAR_1 - value: "custom_value_1" + value: custom_value_1 - name: CUSTOM_ENV_VAR_2 - value: "custom_value_2" + value: custom_value_2 initContainer: enabled: true image: quay.io/opstree/redis-operator-restore:latest imagePullPolicy: Always - command: ["/bin/bash", "-c", "/app/restore.bash"] - args: ["--restore-from", "redis-sentinel-restore"] + command: [/bin/bash, -c, /app/restore.bash] + args: [--restore-from, redis-sentinel-restore] resources: requests: cpu: 100m diff --git a/tests/testdata/redis-standalone.yaml b/tests/testdata/redis-standalone.yaml index a3b351259..305d9b9b6 100644 --- a/tests/testdata/redis-standalone.yaml +++ b/tests/testdata/redis-standalone.yaml @@ -7,7 +7,7 @@ metadata: labels: app: redis-standalone annotations: - opstreelabs.in/redis: "true" + opstreelabs.in/redis: 'true' spec: redisConfig: additionalRedisConfig: redis-external-config @@ -20,8 +20,8 @@ spec: runAsNonRoot: true readOnlyRootFilesystem: true capabilities: - drop: ["ALL"] - add: ["NET_BIND_SERVICE"] + drop: [ALL] + add: [NET_BIND_SERVICE] kubernetesConfig: image: quay.io/opstree/redis:v7.0.12 imagePullPolicy: IfNotPresent @@ -37,8 +37,7 @@ spec: redisSecret: name: redis-secret key: password - ignoreAnnotations: - - "opstreelabs.in/ignore" + ignoreAnnotations: [opstreelabs.in/ignore] redisExporter: enabled: true image: quay.io/opstree/redis-exporter:v1.44.0 @@ -52,7 +51,7 @@ spec: memory: 128Mi env: - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS - value: "true" + value: 'true' - name: UI_PROPERTIES_FILE_NAME valueFrom: configMapKeyRef: @@ -67,7 +66,7 @@ spec: volumeClaimTemplate: spec: storageClassName: standard - accessModes: ["ReadWriteOnce"] + accessModes: [ReadWriteOnce] resources: requests: storage: 1Gi @@ -89,15 +88,14 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/infra operator: In - values: - - worker + values: [worker] tolerations: - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoSchedule" - - key: "node-role.kubernetes.io/infra" - operator: "Exists" - effect: "NoExecute" + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/infra + operator: Exists + effect: NoExecute serviceAccountName: redis-sa terminationGracePeriodSeconds: 30 acl: @@ -111,15 +109,15 @@ spec: secretName: redis-tls-cert env: - name: CUSTOM_ENV_VAR_1 - value: "custom_value_1" + value: custom_value_1 - name: CUSTOM_ENV_VAR_2 - value: "custom_value_2" + value: custom_value_2 initContainer: enabled: true image: quay.io/opstree/redis-operator-restore:latest imagePullPolicy: Always - command: ["/bin/bash", "-c", "/app/restore.bash"] - args: ["--restore-from", "redis-standalone-restore"] + command: [/bin/bash, -c, /app/restore.bash] + args: [--restore-from, redis-standalone-restore] resources: requests: cpu: 100m diff --git a/tests/testdata/secrets/ca.crt b/tests/testdata/secrets/ca.crt index 483acebbe..de97d5d33 100644 --- a/tests/testdata/secrets/ca.crt +++ b/tests/testdata/secrets/ca.crt @@ -16,4 +16,4 @@ tkEB4yCOj72p3DmC/bJSa4zp0ng/AoATA7GPmm+l1hEMDLd+mtosMtev0DWDyF0j acrlBvRv4Eq6kFuBBzcPqKC2DuFWIU/ZCBkwn2tScPEf0UjZUXl74k9Taz37Av9Z KQByaF94pYf/7kPRIn2Zw0xXRTJ0wD9bi4Q6YfnN/ntrcs1CNKWb4MMbU2gnz0RN zCjC ------END CERTIFICATE----- +-----END CERTIFICATE----- \ No newline at end of file diff --git a/tests/testdata/secrets/tls.crt b/tests/testdata/secrets/tls.crt index b60b071aa..2f5542cbd 100644 --- a/tests/testdata/secrets/tls.crt +++ b/tests/testdata/secrets/tls.crt @@ -14,4 +14,4 @@ iZ2Iw/MKLJEVxOxNRPzeKE6bHqvO6dijUGrB++XugrGVwMQjMZsJuu6bN7CYRgsA OoRKohDkhaKsW/RkGIYDIxqm+zsPv69PTALlUXJtgnlkvNc6F5Fd5pwuW8TJ/wLe eyQM56RaW2OInIOO4ehJkgRnLdukkECvYEwlZD3RgGFvUIGZFZXDS7FvpzZaUmdz XtNWJjYUsc8d8iljTQ== ------END CERTIFICATE----- +-----END CERTIFICATE----- \ No newline at end of file diff --git a/tests/testdata/secrets/tls.key b/tests/testdata/secrets/tls.key index 485f0189c..97ab91a7a 100644 --- a/tests/testdata/secrets/tls.key +++ b/tests/testdata/secrets/tls.key @@ -25,4 +25,4 @@ qeL1G2ADhqcXR5O0adubBLDP01nqMlYoOr5s2rislpTOmers8eJZ1/p9J2ZNhFow WTwyMda9qjnQvDovPcm5ci1SEjJUCusJKNwoZiU9/xuU1P9t234qmNsmQV5Tpplg aH139Yw8kz7u9z1o2ajO6rG7rQ5qUgYXHgEhIoRnkCfx4uekeaO5lgdwIDR0zC1I BfJBeduDgVHEyYxEU78tprfc ------END PRIVATE KEY----- +-----END PRIVATE KEY----- \ No newline at end of file