diff --git a/deploy/kubernetes-1.18/hostpath/csi-hostpath-attacher.yaml b/deploy/kubernetes-1.18/hostpath/csi-hostpath-attacher.yaml index 90b3ee349..7ff4231bc 100644 --- a/deploy/kubernetes-1.18/hostpath/csi-hostpath-attacher.yaml +++ b/deploy/kubernetes-1.18/hostpath/csi-hostpath-attacher.yaml @@ -29,10 +29,10 @@ spec: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - - key: app.kubernetes.io/name + - key: app.kubernetes.io/instance operator: In values: - - csi-hostpathplugin + - hostpath.csi.k8s.io topologyKey: kubernetes.io/hostname serviceAccountName: csi-attacher containers: diff --git a/deploy/kubernetes-1.18/hostpath/csi-hostpath-plugin.yaml b/deploy/kubernetes-1.18/hostpath/csi-hostpath-plugin.yaml index 2c3ccfb8f..6496cc55d 100644 --- a/deploy/kubernetes-1.18/hostpath/csi-hostpath-plugin.yaml +++ b/deploy/kubernetes-1.18/hostpath/csi-hostpath-plugin.yaml @@ -1,26 +1,3 @@ -# Service defined here, plus serviceName below in StatefulSet, -# are needed only because of condition explained in -# https://github.com/kubernetes/kubernetes/issues/69608 - -kind: Service -apiVersion: v1 -metadata: - name: csi-hostpathplugin - labels: - app.kubernetes.io/instance: hostpath.csi.k8s.io - app.kubernetes.io/part-of: csi-driver-host-path - app.kubernetes.io/name: csi-hostpathplugin - app.kubernetes.io/component: plugin -spec: - selector: - app.kubernetes.io/instance: hostpath.csi.k8s.io - app.kubernetes.io/part-of: csi-driver-host-path - app.kubernetes.io/name: csi-hostpathplugin - app.kubernetes.io/component: plugin - ports: - - name: dummy - port: 12345 ---- kind: StatefulSet apiVersion: apps/v1 metadata: diff --git a/deploy/kubernetes-1.18/hostpath/csi-hostpath-provisioner.yaml b/deploy/kubernetes-1.18/hostpath/csi-hostpath-provisioner.yaml index 3321bf102..db1713f0d 100644 --- a/deploy/kubernetes-1.18/hostpath/csi-hostpath-provisioner.yaml +++ b/deploy/kubernetes-1.18/hostpath/csi-hostpath-provisioner.yaml @@ -29,10 +29,10 @@ spec: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - - key: app.kubernetes.io/name + - key: app.kubernetes.io/instance operator: In values: - - csi-hostpathplugin + - hostpath.csi.k8s.io topologyKey: kubernetes.io/hostname serviceAccountName: csi-provisioner containers: diff --git a/deploy/kubernetes-1.18/hostpath/csi-hostpath-resizer.yaml b/deploy/kubernetes-1.18/hostpath/csi-hostpath-resizer.yaml index 52216de16..2d8c8967c 100644 --- a/deploy/kubernetes-1.18/hostpath/csi-hostpath-resizer.yaml +++ b/deploy/kubernetes-1.18/hostpath/csi-hostpath-resizer.yaml @@ -29,10 +29,10 @@ spec: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - - key: app.kubernetes.io/name + - key: app.kubernetes.io/instance operator: In values: - - csi-hostpathplugin + - hostpath.csi.k8s.io topologyKey: kubernetes.io/hostname serviceAccountName: csi-resizer containers: diff --git a/deploy/kubernetes-1.18/hostpath/csi-hostpath-snapshotter.yaml b/deploy/kubernetes-1.18/hostpath/csi-hostpath-snapshotter.yaml index 470332da9..bbd798af2 100644 --- a/deploy/kubernetes-1.18/hostpath/csi-hostpath-snapshotter.yaml +++ b/deploy/kubernetes-1.18/hostpath/csi-hostpath-snapshotter.yaml @@ -29,10 +29,10 @@ spec: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - - key: app.kubernetes.io/name + - key: app.kubernetes.io/instance operator: In values: - - csi-hostpathplugin + - hostpath.csi.k8s.io topologyKey: kubernetes.io/hostname serviceAccountName: csi-snapshotter containers: diff --git a/deploy/kubernetes-1.18/hostpath/csi-hostpath-testing.yaml b/deploy/kubernetes-1.18/hostpath/csi-hostpath-testing.yaml index f0dd9129f..4e4eb1354 100644 --- a/deploy/kubernetes-1.18/hostpath/csi-hostpath-testing.yaml +++ b/deploy/kubernetes-1.18/hostpath/csi-hostpath-testing.yaml @@ -57,10 +57,10 @@ spec: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - - key: app.kubernetes.io/name + - key: app.kubernetes.io/instance operator: In values: - - csi-hostpathplugin + - hostpath.csi.k8s.io topologyKey: kubernetes.io/hostname containers: - name: socat diff --git a/deploy/kubernetes-1.20/hostpath/csi-hostpath-plugin.yaml b/deploy/kubernetes-1.20/hostpath/csi-hostpath-plugin.yaml index 9930a7c67..6496cc55d 100644 --- a/deploy/kubernetes-1.20/hostpath/csi-hostpath-plugin.yaml +++ b/deploy/kubernetes-1.20/hostpath/csi-hostpath-plugin.yaml @@ -1,23 +1,3 @@ -# Service defined here, plus serviceName below in StatefulSet, -# are needed only because of condition explained in -# https://github.com/kubernetes/kubernetes/issues/69608 - -kind: Service -apiVersion: v1 -metadata: - name: csi-hostpathplugin - labels: - app.kubernetes.io/instance: hostpath.csi.k8s.io - app.kubernetes.io/part-of: csi-driver-host-path - app.kubernetes.io/name: csi-hostpathplugin - app.kubernetes.io/component: plugin -spec: - selector: - app: csi-hostpathplugin - ports: - - name: dummy - port: 12345 ---- kind: StatefulSet apiVersion: apps/v1 metadata: diff --git a/deploy/kubernetes-distributed/deploy.sh b/deploy/kubernetes-distributed/deploy.sh index 857f5ae90..6ece31017 100755 --- a/deploy/kubernetes-distributed/deploy.sh +++ b/deploy/kubernetes-distributed/deploy.sh @@ -250,8 +250,18 @@ wait_for_daemonset () { # Wait until the DaemonSet is running on all nodes. if ! wait_for_daemonset default csi-hostpathplugin; then + echo echo "driver not ready" - kubectl describe daemonsets/csi-hostpathplugin + echo "Deployment:" + (set +e; set -x; kubectl describe all,role,clusterrole,rolebinding,clusterrolebinding,serviceaccount,storageclass,csidriver --all-namespaces -l app.kubernetes.io/instance=hostpath.csi.k8s.io) + echo + echo "Pod logs:" + kubectl get pods -l app.kubernetes.io/instance=hostpath.csi.k8s.io --all-namespaces -o=jsonpath='{range .items[*]}{.metadata.name}{" "}{range .spec.containers[*]}{.name}{" "}{end}{"\n"}{end}' | while read -r pod containers; do + for c in $containers; do + echo + (set +e; set -x; kubectl logs $pod $c) + done + done exit 1 fi diff --git a/deploy/kubernetes-distributed/hostpath/csi-hostpath-plugin.yaml b/deploy/kubernetes-distributed/hostpath/csi-hostpath-plugin.yaml index ed3d90dbe..1dac010f0 100644 --- a/deploy/kubernetes-distributed/hostpath/csi-hostpath-plugin.yaml +++ b/deploy/kubernetes-distributed/hostpath/csi-hostpath-plugin.yaml @@ -42,7 +42,7 @@ spec: fieldRef: apiVersion: v1 fieldPath: spec.nodeName - - name: POD_NAMESPACE + - name: NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace diff --git a/deploy/util/deploy-hostpath.sh b/deploy/util/deploy-hostpath.sh index e651f1bde..4c70b40ea 100755 --- a/deploy/util/deploy-hostpath.sh +++ b/deploy/util/deploy-hostpath.sh @@ -247,10 +247,19 @@ expected_running_pods=6 cnt=0 while [ $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) -lt ${expected_running_pods} ]; do if [ $cnt -gt 30 ]; then - echo "$(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) running pods:" - kubectl describe pods - - echo >&2 "ERROR: hostpath deployment not ready after over 5min" + echo "Expecting $expected_running_pods, have $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l)." + echo "Deployment:" + (set +e; set -x; kubectl describe all,role,clusterrole,rolebinding,clusterrolebinding,serviceaccount,storageclass,csidriver --all-namespaces -l app.kubernetes.io/instance=hostpath.csi.k8s.io) + echo + echo "Pod logs:" + kubectl get pods -l app.kubernetes.io/instance=hostpath.csi.k8s.io --all-namespaces -o=jsonpath='{range .items[*]}{.metadata.name}{" "}{range .spec.containers[*]}{.name}{" "}{end}{"\n"}{end}' | while read -r pod containers; do + for c in $containers; do + echo + (set +e; set -x; kubectl logs $pod $c) + done + done + echo + echo "ERROR: hostpath deployment not ready after over 5min" exit 1 fi echo $(date +%H:%M:%S) "waiting for hostpath deployment to complete, attempt #$cnt"