Skip to content

Commit 88f8127

Browse files
committed
deploy: replace /var/lib/kubelet on-the-fly
This is useful for clusters where kubelet is installed differently. KinD cluster testing might be done with a non-default location to recognize and cleanup loop devices that were set up by the driver.
1 parent 5443144 commit 88f8127

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

deploy/kubernetes-distributed/deploy.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ trap 'rm -rf ${TEMP_DIR}' EXIT
5252
# implies that refreshing that image has to be done manually.
5353
#
5454
# As a special case, 'none' as registry removes the registry name.
55+
#
56+
# KUBELET_DATA_DIR can be set to replace the default /var/lib/kubelet.
57+
# All nodes must use the same directory.
5558

5659
# The default is to use the RBAC rules that match the image that is
5760
# being used, also in the case that the image gets overridden. This
@@ -187,7 +190,7 @@ echo "deploying with CSIStorageCapacity $csistoragecapacities_api: $have_csistor
187190
echo "deploying hostpath components"
188191
for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do
189192
echo " $i"
190-
modified="$(cat "$i" | while IFS= read -r line; do
193+
modified="$(cat "$i" | sed -e "s;/var/lib/kubelet/;${KUBELET_DATA_DIR:-/var/lib/kubelet}/;" | while IFS= read -r line; do
191194
nocomments="$(echo "$line" | sed -e 's/ *#.*$//')"
192195
if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then
193196
# Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1'

deploy/util/deploy-hostpath.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ BASE_DIR="$( cd "$( dirname "$0" )" && pwd )"
3030
TEMP_DIR="$( mktemp -d )"
3131
trap 'rm -rf ${TEMP_DIR}' EXIT
3232

33+
# KUBELET_DATA_DIR can be set to replace the default /var/lib/kubelet.
34+
# All nodes must use the same directory.
35+
default_kubelet_data_dir=/var/lib/kubelet
36+
: ${KUBELET_DATA_DIR:=${default_kubelet_data_dir}}
3337

3438
# If set, the following env variables override image registry and/or tag for each of the images.
3539
# 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
6771
#
6872
# As a special case, 'none' as registry removes the registry name.
6973

74+
7075
# The default is to use the RBAC rules that match the image that is
7176
# being used, also in the case that the image gets overridden. This
7277
# way if there are breaking changes in the RBAC rules, the deployment
@@ -196,7 +201,7 @@ done
196201
echo "deploying hostpath components"
197202
for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do
198203
echo " $i"
199-
modified="$(cat "$i" | while IFS= read -r line; do
204+
modified="$(cat "$i" | sed -e "s;${default_kubelet_data_dir}/;${KUBELET_DATA_DIR}/;" | while IFS= read -r line; do
200205
nocomments="$(echo "$line" | sed -e 's/ *#.*$//')"
201206
if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then
202207
# Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1'

0 commit comments

Comments
 (0)