From c28a08013240abcc48effc6688c5ba1fabb7e91f Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 9 Aug 2024 08:14:34 +0000 Subject: [PATCH 1/2] test: add default namespace in examples to fix e2e test failure fix --- Makefile | 4 ++-- deploy/example/cloning/nginx-pod-restored-cloning.yaml | 1 + deploy/example/daemonset-nfs-ephemeral.yaml | 1 + deploy/example/deployment.yaml | 2 ++ deploy/example/nfs-provisioner/nfs-server.yaml | 2 ++ deploy/example/nfs-provisioner/nginx-pod.yaml | 3 +++ deploy/example/nginx-pod-inline-volume.yaml | 1 + deploy/example/nginx-pod-nfs.yaml | 1 + deploy/example/pvc-nfs-csi-dynamic.yaml | 1 + deploy/example/pvc-nfs-csi-static.yaml | 1 + deploy/example/snapshot/nginx-pod-restored-snapshot.yaml | 1 + deploy/example/statefulset.yaml | 1 + 12 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f3de87e8c..977a094ad 100644 --- a/Makefile +++ b/Makefile @@ -131,8 +131,8 @@ endif .PHONY: install-nfs-server install-nfs-server: kubectl apply -f ./deploy/example/nfs-provisioner/nfs-server.yaml - kubectl delete secret mount-options --ignore-not-found - kubectl create secret generic mount-options --from-literal mountOptions="nfsvers=4.1" + kubectl delete secret mount-options -n default --ignore-not-found + kubectl create secret generic mount-options --from-literal mountOptions="nfsvers=4.1" -n default .PHONY: install-helm install-helm: diff --git a/deploy/example/cloning/nginx-pod-restored-cloning.yaml b/deploy/example/cloning/nginx-pod-restored-cloning.yaml index bcb033dab..c1fecf4d3 100644 --- a/deploy/example/cloning/nginx-pod-restored-cloning.yaml +++ b/deploy/example/cloning/nginx-pod-restored-cloning.yaml @@ -3,6 +3,7 @@ kind: Pod apiVersion: v1 metadata: name: nginx-nfs-restored-cloning + namespace: default spec: nodeSelector: "kubernetes.io/os": linux diff --git a/deploy/example/daemonset-nfs-ephemeral.yaml b/deploy/example/daemonset-nfs-ephemeral.yaml index de9ea1e87..f0974c730 100644 --- a/deploy/example/daemonset-nfs-ephemeral.yaml +++ b/deploy/example/daemonset-nfs-ephemeral.yaml @@ -3,6 +3,7 @@ kind: DaemonSet apiVersion: apps/v1 metadata: name: daemonset-nfs-ephemeral + namespace: default spec: selector: matchLabels: diff --git a/deploy/example/deployment.yaml b/deploy/example/deployment.yaml index 216ff304d..45cdc6438 100644 --- a/deploy/example/deployment.yaml +++ b/deploy/example/deployment.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-deployment-nfs + namespace: default spec: accessModes: - ReadWriteMany # In this example, multiple Pods consume the same PVC. @@ -15,6 +16,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: deployment-nfs + namespace: default spec: replicas: 1 selector: diff --git a/deploy/example/nfs-provisioner/nfs-server.yaml b/deploy/example/nfs-provisioner/nfs-server.yaml index 419e60e19..54c16a036 100644 --- a/deploy/example/nfs-provisioner/nfs-server.yaml +++ b/deploy/example/nfs-provisioner/nfs-server.yaml @@ -3,6 +3,7 @@ kind: Service apiVersion: v1 metadata: name: nfs-server + namespace: default labels: app: nfs-server spec: @@ -21,6 +22,7 @@ kind: Deployment apiVersion: apps/v1 metadata: name: nfs-server + namespace: default spec: replicas: 1 selector: diff --git a/deploy/example/nfs-provisioner/nginx-pod.yaml b/deploy/example/nfs-provisioner/nginx-pod.yaml index 236e365c1..6766ad060 100644 --- a/deploy/example/nfs-provisioner/nginx-pod.yaml +++ b/deploy/example/nfs-provisioner/nginx-pod.yaml @@ -5,6 +5,7 @@ metadata: annotations: pv.kubernetes.io/provisioned-by: nfs.csi.k8s.io name: pv-nginx + namespace: default spec: capacity: storage: 10Gi @@ -26,6 +27,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc-nginx + namespace: default spec: accessModes: - ReadWriteOnce @@ -39,6 +41,7 @@ apiVersion: v1 kind: Pod metadata: name: nginx-nfs-example + namespace: default spec: containers: - image: nginx diff --git a/deploy/example/nginx-pod-inline-volume.yaml b/deploy/example/nginx-pod-inline-volume.yaml index 2ef27c012..0df95e42d 100644 --- a/deploy/example/nginx-pod-inline-volume.yaml +++ b/deploy/example/nginx-pod-inline-volume.yaml @@ -3,6 +3,7 @@ kind: Pod apiVersion: v1 metadata: name: nginx-pod-inline-volume + namespace: default spec: nodeSelector: "kubernetes.io/os": linux diff --git a/deploy/example/nginx-pod-nfs.yaml b/deploy/example/nginx-pod-nfs.yaml index f46f8d648..efb662440 100644 --- a/deploy/example/nginx-pod-nfs.yaml +++ b/deploy/example/nginx-pod-nfs.yaml @@ -3,6 +3,7 @@ kind: Pod apiVersion: v1 metadata: name: nginx-nfs + namespace: default spec: nodeSelector: "kubernetes.io/os": linux diff --git a/deploy/example/pvc-nfs-csi-dynamic.yaml b/deploy/example/pvc-nfs-csi-dynamic.yaml index 9055da394..d63415f00 100644 --- a/deploy/example/pvc-nfs-csi-dynamic.yaml +++ b/deploy/example/pvc-nfs-csi-dynamic.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pvc-nfs-dynamic + namespace: default spec: accessModes: - ReadWriteMany diff --git a/deploy/example/pvc-nfs-csi-static.yaml b/deploy/example/pvc-nfs-csi-static.yaml index 91a2cf750..446f0aac9 100644 --- a/deploy/example/pvc-nfs-csi-static.yaml +++ b/deploy/example/pvc-nfs-csi-static.yaml @@ -3,6 +3,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc-nfs-static + namespace: default spec: accessModes: - ReadWriteMany diff --git a/deploy/example/snapshot/nginx-pod-restored-snapshot.yaml b/deploy/example/snapshot/nginx-pod-restored-snapshot.yaml index 37d4b76e9..eeeea9562 100644 --- a/deploy/example/snapshot/nginx-pod-restored-snapshot.yaml +++ b/deploy/example/snapshot/nginx-pod-restored-snapshot.yaml @@ -3,6 +3,7 @@ kind: Pod apiVersion: v1 metadata: name: nginx-nfs-restored-snapshot + namespace: default spec: nodeSelector: "kubernetes.io/os": linux diff --git a/deploy/example/statefulset.yaml b/deploy/example/statefulset.yaml index d8252337a..98b3c85e9 100644 --- a/deploy/example/statefulset.yaml +++ b/deploy/example/statefulset.yaml @@ -3,6 +3,7 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: statefulset-nfs + namespace: default labels: app: nginx spec: From e79a19deefee92b6b210f043b15b5f47aaf2eb6b Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 9 Aug 2024 09:44:29 +0000 Subject: [PATCH 2/2] fix --- hack/verify-examples.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/verify-examples.sh b/hack/verify-examples.sh index 3ff485a0a..33831579b 100755 --- a/hack/verify-examples.sh +++ b/hack/verify-examples.sh @@ -21,9 +21,9 @@ rollout_and_wait() { APPNAME=$(kubectl apply -f $1 | grep -E "^(:?daemonset|deployment|statefulset|pod)" | awk '{printf $1}') if [[ -n $(expr "${APPNAME}" : "\(daemonset\|deployment\|statefulset\|pod\)" || true) ]]; then - kubectl rollout status $APPNAME --watch --timeout=5m + kubectl rollout status $APPNAME --watch --timeout=5m -n default else - kubectl wait "${APPNAME}" --for condition=ready --timeout=5m + kubectl wait "${APPNAME}" --for condition=ready --timeout=5m -n default fi }