Skip to content

Commit 7a25259

Browse files
authored
Merge pull request #286 from pohly/kubelet-data-dir
deploy: replace /var/lib/kubelet on-the-fly
2 parents cb8f3ca + 89ae426 commit 7a25259

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

deploy/kubernetes-distributed/deploy.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ BASE_DIR=$(dirname "$0")
1616
TEMP_DIR="$( mktemp -d )"
1717
trap 'rm -rf ${TEMP_DIR}' EXIT
1818

19+
# KUBELET_DATA_DIR can be set to replace the default /var/lib/kubelet.
20+
# All nodes must use the same directory.
21+
default_kubelet_data_dir=/var/lib/kubelet
22+
: ${KUBELET_DATA_DIR:=${default_kubelet_data_dir}}
1923

2024
# If set, the following env variables override image registry and/or tag for each of the images.
2125
# 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
5357
#
5458
# As a special case, 'none' as registry removes the registry name.
5559

60+
5661
# The default is to use the RBAC rules that match the image that is
5762
# being used, also in the case that the image gets overridden. This
5863
# way if there are breaking changes in the RBAC rules, the deployment
@@ -187,7 +192,7 @@ echo "deploying with CSIStorageCapacity $csistoragecapacities_api: $have_csistor
187192
echo "deploying hostpath components"
188193
for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do
189194
echo " $i"
190-
modified="$(cat "$i" | while IFS= read -r line; do
195+
modified="$(cat "$i" | sed -e "s;${default_kubelet_data_dir}/;${KUBELET_DATA_DIR}/;" | while IFS= read -r line; do
191196
nocomments="$(echo "$line" | sed -e 's/ *#.*$//')"
192197
if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then
193198
# 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
@@ -202,7 +207,7 @@ done
202207
echo "deploying hostpath components"
203208
for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do
204209
echo " $i"
205-
modified="$(cat "$i" | while IFS= read -r line; do
210+
modified="$(cat "$i" | sed -e "s;${default_kubelet_data_dir}/;${KUBELET_DATA_DIR}/;" | while IFS= read -r line; do
206211
nocomments="$(echo "$line" | sed -e 's/ *#.*$//')"
207212
if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then
208213
# Split 'image: quay.io/k8scsi/csi-attacher:v1.0.1'

0 commit comments

Comments
 (0)