-
-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add field to keep pvc after cr be deleted (#772)
* feat: add field to keep pvc after cr be deleted Signed-off-by: drivebyer <wuyangmuc@gmail.com> * fix kind Signed-off-by: drivebyer <wuyangmuc@gmail.com> * fix delete name Signed-off-by: drivebyer <wuyangmuc@gmail.com> --------- Signed-off-by: drivebyer <wuyangmuc@gmail.com>
- Loading branch information
Showing
22 changed files
with
915 additions
and
6 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
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
34 changes: 34 additions & 0 deletions
34
tests/e2e-chainsaw/v1beta2/keep-pvc/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,34 @@ | ||
# 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 |
48 changes: 48 additions & 0 deletions
48
tests/e2e-chainsaw/v1beta2/keep-pvc/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,48 @@ | ||
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: | ||
keepAfterDelete: true | ||
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/keep-pvc/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/keep-pvc/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: redis-cluster-v1beta2-leader-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: redis-cluster-v1beta2-leader-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: redis-cluster-v1beta2-leader-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: redis-cluster-v1beta2-follower-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: redis-cluster-v1beta2-follower-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: redis-cluster-v1beta2-follower-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.