deploy: remove the Flexvolume detection in the environment_check.sh
We have built-in auto detection now.
@@ -51,83 +51,11 @@ EOF
kubectl create -f $TEMP_DIR/environment_check.yaml
}
-create_pod() {
-cat <<EOF > $TEMP_DIR/detect-flexvol-dir.yaml
-apiVersion: v1
-kind: Pod
-metadata:
- name: detect-flexvol-dir
-spec:
- containers:
- - name: detect-flexvol-dir
- image: busybox
- command: ["/bin/sh"]
- args:
- - -c
- - |
- find_kubelet_proc() {
- for proc in \`find /proc -type d -maxdepth 1\`; do
- if [ ! -f \$proc/cmdline ]; then
- continue
- fi
- if [[ "\$(cat \$proc/cmdline | tr '\000' '\n' | head -n1 | tr '/' '\n' | tail -n1)" == "kubelet" ]]; then
- echo \$proc
- return
- fi
- done
- }
- get_flexvolume_path() {
- proc=\$(find_kubelet_proc)
- if [ "\$proc" != "" ]; then
- path=\$(cat \$proc/cmdline | tr '\000' '\n' | grep volume-plugin-dir | tr '=' '\n' | tail -n1)
- if [ "\$path" == "" ]; then
- echo '/usr/libexec/kubernetes/kubelet-plugins/volume/exec/'
- else
- echo \$path
- fi
- return
- fi
- echo 'no kubelet process found, dunno'
- }
- get_flexvolume_path
- securityContext:
- privileged: true
- hostPID: true
- restartPolicy: Never
-EOF
- kubectl create -f $TEMP_DIR/detect-flexvol-dir.yaml
-}
-
cleanup() {
- echo "cleaning up detection workloads..."
- kubectl delete -f $TEMP_DIR/environment_check.yaml &
- a=$!
- kubectl delete -f $TEMP_DIR/detect-flexvol-dir.yaml &
- b=$!
- wait $a
- wait $b
+ echo "cleaning up..."
+ kubectl delete -f $TEMP_DIR/environment_check.yaml
rm -rf $TEMP_DIR
- echo "clean up completed"
-}
-
-wait_pod_ready() {
- while true; do
- local pod=$(kubectl get po/detect-flexvol-dir -o json)
- local phase=$(echo $pod | jq -r .status.phase)
-
- if [ "$phase" == "Succeeded" ]; then
- echo "pod/detect-flexvol-dir completed"
- return
- fi
-
- echo "waiting for pod/detect-flexvol-dir to finish"
- sleep 3
- done
-}
-
-validate_pod() {
- flexvol_path=$(kubectl logs detect-flexvol-dir)
- echo -e "\n FLEXVOLUME_DIR=\"${flexvol_path}\"\n"
+ echo "clean up complete"
}
wait_ds_ready() {
@@ -175,10 +103,7 @@ validate_ds() {
dependencies kubectl jq mktemp
TEMP_DIR=$(mktemp -d)
trap cleanup EXIT
-create_pod
create_ds
-wait_pod_ready
wait_ds_ready
-validate_pod
validate_ds
exit 0
