-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rolling update sequence from leader to follower
Signed-off-by: drivebyer <[email protected]>
- Loading branch information
Showing
7 changed files
with
248 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
tests/e2e-chainsaw/v1beta2/disable-persistence/redis-cluster/chainsaw-test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
# 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 | ||
spec: | ||
steps: | ||
- try: | ||
- apply: | ||
file: cluster.yaml | ||
- assert: | ||
file: ready-cluster.yaml | ||
|
||
- name: Try saving a key | ||
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 | ||
|
||
- name: Rolling update the cluster | ||
try: | ||
- apply: | ||
file: cluster-hscale.yaml | ||
- assert: | ||
file: ready-cluster.yaml | ||
|
||
- name: Check if all keys exist | ||
try: | ||
- script: | ||
timeout: 30s | ||
content: > | ||
kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-0 -- redis-cli -c -p 6379 get foo-0 | ||
check: | ||
($stdout=='bar-0'): true | ||
- script: | ||
timeout: 30s | ||
content: > | ||
kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-1 -- redis-cli -c -p 6379 get foo-1 | ||
check: | ||
($stdout=='bar-1'): true | ||
- script: | ||
timeout: 30s | ||
content: > | ||
kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-leader redis-cluster-v1beta2-leader-2 -- redis-cli -c -p 6379 get foo-2 | ||
check: | ||
($stdout=='bar-2'): true | ||
- script: | ||
timeout: 30s | ||
content: > | ||
kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-0 -- redis-cli -c -p 6379 get foo-3 | ||
check: | ||
($stdout=='bar-3'): true | ||
- script: | ||
timeout: 30s | ||
content: > | ||
kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-1 -- redis-cli -c -p 6379 get foo-4 | ||
check: | ||
($stdout=='bar-4'): true | ||
- script: | ||
timeout: 30s | ||
content: > | ||
kubectl exec --namespace ${NAMESPACE} --container redis-cluster-v1beta2-follower redis-cluster-v1beta2-follower-2 -- redis-cli -c -p 6379 get foo-5 | ||
check: | ||
($stdout=='bar-5'): true |
36 changes: 36 additions & 0 deletions
36
tests/e2e-chainsaw/v1beta2/disable-persistence/redis-cluster/cluster-hscale.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
kind: RedisCluster | ||
metadata: | ||
name: redis-cluster-v1beta2 | ||
spec: | ||
clusterSize: 3 | ||
clusterVersion: v7 | ||
persistenceEnabled: false | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
fsGroup: 1000 | ||
kubernetesConfig: | ||
image: quay.io/opstree/redis:v7.0.12 | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 101m | ||
memory: 128Mi | ||
limits: | ||
cpu: 101m | ||
memory: 256Mi # Increased memory limit | ||
storage: | ||
volumeClaimTemplate: | ||
spec: | ||
accessModes: [ReadWriteOnce] | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
nodeConfVolume: true | ||
nodeConfVolumeClaimTemplate: | ||
spec: | ||
accessModes: [ReadWriteOnce] | ||
resources: | ||
requests: | ||
storage: 1Gi |
36 changes: 36 additions & 0 deletions
36
tests/e2e-chainsaw/v1beta2/disable-persistence/redis-cluster/cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
kind: RedisCluster | ||
metadata: | ||
name: redis-cluster-v1beta2 | ||
spec: | ||
clusterSize: 3 | ||
clusterVersion: v7 | ||
persistenceEnabled: false | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
fsGroup: 1000 | ||
kubernetesConfig: | ||
image: quay.io/opstree/redis:v7.0.12 | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 101m | ||
memory: 128Mi | ||
limits: | ||
cpu: 101m | ||
memory: 128Mi | ||
storage: | ||
volumeClaimTemplate: | ||
spec: | ||
accessModes: [ReadWriteOnce] | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
nodeConfVolume: true | ||
nodeConfVolumeClaimTemplate: | ||
spec: | ||
accessModes: [ReadWriteOnce] | ||
resources: | ||
requests: | ||
storage: 1Gi |
10 changes: 10 additions & 0 deletions
10
tests/e2e-chainsaw/v1beta2/disable-persistence/redis-cluster/ready-cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
kind: RedisCluster | ||
metadata: | ||
name: redis-cluster-v1beta2 | ||
status: | ||
readyFollowerReplicas: 3 | ||
readyLeaderReplicas: 3 | ||
state: Ready | ||
reason: RedisCluster is ready |