diff --git a/deploy/kubernetes-distributed/deploy.sh b/deploy/kubernetes-distributed/deploy.sh index 6ece31017..b077576d9 100755 --- a/deploy/kubernetes-distributed/deploy.sh +++ b/deploy/kubernetes-distributed/deploy.sh @@ -16,6 +16,10 @@ BASE_DIR=$(dirname "$0") TEMP_DIR="$( mktemp -d )" trap 'rm -rf ${TEMP_DIR}' EXIT +# KUBELET_DATA_DIR can be set to replace the default /var/lib/kubelet. +# All nodes must use the same directory. +default_kubelet_data_dir=/var/lib/kubelet +: ${KUBELET_DATA_DIR:=${default_kubelet_data_dir}} # If set, the following env variables override image registry and/or tag for each of the images. # They are named after the image name, with hyphen replaced by underscore and in upper case. @@ -53,6 +57,7 @@ trap 'rm -rf ${TEMP_DIR}' EXIT # # As a special case, 'none' as registry removes the registry name. + # The default is to use the RBAC rules that match the image that is # being used, also in the case that the image gets overridden. This # way if there are breaking changes in the RBAC rules, the deployment @@ -187,7 +192,7 @@ echo "deploying with CSIStorageCapacity $csistoragecapacities_api: $have_csistor echo "deploying hostpath components" for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do echo " $i" - modified="$(cat "$i" | while IFS= read -r line; do + modified="$(cat "$i" | sed -e "s;${default_kubelet_data_dir}/;${KUBELET_DATA_DIR}/;" | while IFS= read -r line; do nocomments="$(echo "$line" | sed -e 's/ *#.*$//')" if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then # Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1' diff --git a/deploy/util/deploy-hostpath.sh b/deploy/util/deploy-hostpath.sh index 4c70b40ea..50a677e55 100755 --- a/deploy/util/deploy-hostpath.sh +++ b/deploy/util/deploy-hostpath.sh @@ -30,6 +30,10 @@ BASE_DIR="$( cd "$( dirname "$0" )" && pwd )" TEMP_DIR="$( mktemp -d )" trap 'rm -rf ${TEMP_DIR}' EXIT +# KUBELET_DATA_DIR can be set to replace the default /var/lib/kubelet. +# All nodes must use the same directory. +default_kubelet_data_dir=/var/lib/kubelet +: ${KUBELET_DATA_DIR:=${default_kubelet_data_dir}} # If set, the following env variables override image registry and/or tag for each of the images. # They are named after the image name, with hyphen replaced by underscore and in upper case. @@ -67,6 +71,7 @@ trap 'rm -rf ${TEMP_DIR}' EXIT # # As a special case, 'none' as registry removes the registry name. + # The default is to use the RBAC rules that match the image that is # being used, also in the case that the image gets overridden. This # way if there are breaking changes in the RBAC rules, the deployment @@ -196,7 +201,7 @@ done echo "deploying hostpath components" for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do echo " $i" - modified="$(cat "$i" | while IFS= read -r line; do + modified="$(cat "$i" | sed -e "s;${default_kubelet_data_dir}/;${KUBELET_DATA_DIR}/;" | while IFS= read -r line; do nocomments="$(echo "$line" | sed -e 's/ *#.*$//')" if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then # Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1'