Skip to content

Commit e1d4596

Browse files
authored
Merge pull request #379 from RaunakShah/add-flag-2
Provide option to enable volume mode conversion flag to HostPath driver deployment script
2 parents a1036e3 + 3a3feee commit e1d4596

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

deploy/kubernetes-1.22/hostpath/csi-hostpath-plugin.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ spec:
328328
- -v=5
329329
- --csi-address=/csi/csi.sock
330330
- --feature-gates=Topology=true
331+
# end csi-provisioner args
331332
securityContext:
332333
# This is necessary only for systems with SELinux, where
333334
# non-privileged sidecar containers cannot access unix domain socket

deploy/util/deploy-hostpath.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ default_kubelet_data_dir=/var/lib/kubelet
7070
# implies that refreshing that image has to be done manually.
7171
#
7272
# As a special case, 'none' as registry removes the registry name.
73-
73+
# Set VOLUME_MODE_CONVERSION_TESTS to "true" to enable the feature in external-provisioner.
7474

7575
# The default is to use the RBAC rules that match the image that is
7676
# being used, also in the case that the image gets overridden. This
@@ -138,6 +138,10 @@ function version_gt() {
138138
test "$(printf '%s' "$versions" | sort -V | head -n 1)" != "$greaterVersion"
139139
}
140140

141+
function volume_mode_conversion () {
142+
[ "${VOLUME_MODE_CONVERSION_TESTS}" == "true" ]
143+
}
144+
141145
# In addition, the RBAC rules can be overridden separately.
142146
# For snapshotter 2.0+, the directory has changed.
143147
SNAPSHOTTER_RBAC_RELATIVE_PATH="rbac.yaml"
@@ -210,6 +214,9 @@ done
210214
echo "deploying hostpath components"
211215
for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do
212216
echo " $i"
217+
if volume_mode_conversion; then
218+
sed -i -e 's/# end csi-provisioner args/- \"--prevent-volume-mode-conversion=true\"\n # end csi-provisioner args/' $i
219+
fi
213220
modified="$(cat "$i" | sed -e "s;${default_kubelet_data_dir}/;${KUBELET_DATA_DIR}/;" | while IFS= read -r line; do
214221
nocomments="$(echo "$line" | sed -e 's/ *#.*$//')"
215222
if echo "$nocomments" | grep -q '^[[:space:]]*image:[[:space:]]*'; then

0 commit comments

Comments
 (0)