forked from OT-CONTAINER-KIT/redis-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add environment to customize data pvc prefix (OT-CONTAINER-KIT#742
) * support customize pvc template name Signed-off-by: drivebyer <[email protected]> * add test case Signed-off-by: drivebyer <[email protected]> * kubectl Signed-off-by: drivebyer <[email protected]> * wait operator ready Signed-off-by: drivebyer <[email protected]> * fix sleep Signed-off-by: drivebyer <[email protected]> * fix sleep Signed-off-by: drivebyer <[email protected]> * remove debug Signed-off-by: drivebyer <[email protected]> --------- Signed-off-by: drivebyer <[email protected]> Signed-off-by: Matt Robinson <[email protected]>
- Loading branch information
1 parent
c676d3f
commit 04dd3fe
Showing
11 changed files
with
530 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,5 @@ spec: | |
timeouts: | ||
apply: 5m | ||
delete: 5m | ||
assert: 15m | ||
error: 15m | ||
assert: 10m | ||
error: 10m |
50 changes: 50 additions & 0 deletions
50
tests/e2e-chainsaw/v1beta2/pvc-name/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,50 @@ | ||
--- | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: pvc-name | ||
spec: | ||
steps: | ||
- 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"}}]' | ||
- sleep: | ||
duration: 1m | ||
|
||
- name: redis-cluster-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: redis-cluster-uninstall | ||
try: | ||
- delete: | ||
ref: | ||
name: redis-cluster-v1beta2 | ||
kind: RedisCluster | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
- error: | ||
file: ready-cluster.yaml | ||
- error: | ||
file: ready-sts.yaml | ||
- error: | ||
file: ready-svc.yaml | ||
- error: | ||
file: ready-pvc.yaml | ||
|
||
- name: Remove PVC name environment | ||
try: | ||
- script: | ||
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 |
47 changes: 47 additions & 0 deletions
47
tests/e2e-chainsaw/v1beta2/pvc-name/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,47 @@ | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
kind: RedisCluster | ||
metadata: | ||
name: redis-cluster-v1beta2 | ||
spec: | ||
clusterSize: 3 | ||
clusterVersion: v7 | ||
persistenceEnabled: true | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
fsGroup: 1000 | ||
kubernetesConfig: | ||
image: quay.io/opstree/redis:latest | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 101m | ||
memory: 128Mi | ||
limits: | ||
cpu: 101m | ||
memory: 128Mi | ||
redisExporter: | ||
enabled: true | ||
image: quay.io/opstree/redis-exporter:v1.44.0 | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 128Mi | ||
limits: | ||
cpu: 100m | ||
memory: 128Mi | ||
storage: | ||
volumeClaimTemplate: | ||
spec: | ||
# storageClassName: standard | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
nodeConfVolume: true | ||
nodeConfVolumeClaimTemplate: | ||
spec: | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: 1Gi |
7 changes: 7 additions & 0 deletions
7
tests/e2e-chainsaw/v1beta2/pvc-name/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,7 @@ | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
kind: RedisCluster | ||
metadata: | ||
name: redis-cluster-v1beta2 | ||
status: | ||
readyFollowerReplicas: 3 | ||
readyLeaderReplicas: 3 |
181 changes: 181 additions & 0 deletions
181
tests/e2e-chainsaw/v1beta2/pvc-name/redis-cluster/ready-pvc.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,181 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-leader-0 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-leader-1 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-leader-2 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-follower-0 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-follower-1 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-follower-2 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-redis-cluster-v1beta2-leader-0 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-redis-cluster-v1beta2-leader-1 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-redis-cluster-v1beta2-leader-2 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-redis-cluster-v1beta2-follower-0 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-redis-cluster-v1beta2-follower-1 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data-redis-cluster-v1beta2-follower-2 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound |
Oops, something went wrong.