feat(csi): make provider hostPaths configurable (#603)
* add configurable values for providersDir and kubeletRootDir Signed-off-by: Toni Tauro <toni.tauro@adfinis.com> Co-authored-by: Ben Ash <32777270+benashz@users.noreply.github.com>
This commit is contained in:
parent
8932c372b7
commit
23e0348842
4 changed files with 74 additions and 2 deletions
|
@ -70,10 +70,10 @@ spec:
|
||||||
volumes:
|
volumes:
|
||||||
- name: providervol
|
- name: providervol
|
||||||
hostPath:
|
hostPath:
|
||||||
path: "/etc/kubernetes/secrets-store-csi-providers"
|
path: {{ .Values.csi.daemonSet.providersDir }}
|
||||||
- name: mountpoint-dir
|
- name: mountpoint-dir
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /var/lib/kubelet/pods
|
path: {{ .Values.csi.daemonSet.kubeletRootDir }}/pods
|
||||||
{{- if .Values.csi.volumes }}
|
{{- if .Values.csi.volumes }}
|
||||||
{{- toYaml .Values.csi.volumes | nindent 8}}
|
{{- toYaml .Values.csi.volumes | nindent 8}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -315,6 +315,68 @@ load _helpers
|
||||||
[ "${actual}" = "{}" ]
|
[ "${actual}" = "{}" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "csi/daemonset: csi providersDir default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
|
||||||
|
# Test that it defines it
|
||||||
|
local object=$(helm template \
|
||||||
|
--show-only templates/csi-daemonset.yaml \
|
||||||
|
--set 'csi.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.volumes[] | select(.name == "providervol")' | tee /dev/stderr)
|
||||||
|
|
||||||
|
local actual=$(echo $object |
|
||||||
|
yq -r '.hostPath.path' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "/etc/kubernetes/secrets-store-csi-providers" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "csi/daemonset: csi kubeletRootDir default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
|
||||||
|
# Test that it defines it
|
||||||
|
local object=$(helm template \
|
||||||
|
--show-only templates/csi-daemonset.yaml \
|
||||||
|
--set 'csi.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.volumes[] | select(.name == "mountpoint-dir")' | tee /dev/stderr)
|
||||||
|
|
||||||
|
local actual=$(echo $object |
|
||||||
|
yq -r '.hostPath.path' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "/var/lib/kubelet/pods" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "csi/daemonset: csi providersDir override " {
|
||||||
|
cd `chart_dir`
|
||||||
|
|
||||||
|
# Test that it defines it
|
||||||
|
local object=$(helm template \
|
||||||
|
--show-only templates/csi-daemonset.yaml \
|
||||||
|
--set 'csi.enabled=true' \
|
||||||
|
--set 'csi.daemonSet.providersDir=/alt/csi-prov-dir' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.volumes[] | select(.name == "providervol")' | tee /dev/stderr)
|
||||||
|
|
||||||
|
local actual=$(echo $object |
|
||||||
|
yq -r '.hostPath.path' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "/alt/csi-prov-dir" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "csi/daemonset: csi kubeletRootDir override" {
|
||||||
|
cd `chart_dir`
|
||||||
|
|
||||||
|
# Test that it defines it
|
||||||
|
local object=$(helm template \
|
||||||
|
--show-only templates/csi-daemonset.yaml \
|
||||||
|
--set 'csi.enabled=true' \
|
||||||
|
--set 'csi.daemonSet.kubeletRootDir=/alt/kubelet-root' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.template.spec.volumes[] | select(.name == "mountpoint-dir")' | tee /dev/stderr)
|
||||||
|
|
||||||
|
local actual=$(echo $object |
|
||||||
|
yq -r '.hostPath.path' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "/alt/kubelet-root/pods" ]
|
||||||
|
}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# volumeMounts
|
# volumeMounts
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,12 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"providersDir": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"kubeletRootDir": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -754,6 +754,10 @@ csi:
|
||||||
# YAML-formatted multi-line templated string map of the annotations to apply
|
# YAML-formatted multi-line templated string map of the annotations to apply
|
||||||
# to the daemonSet.
|
# to the daemonSet.
|
||||||
annotations: {}
|
annotations: {}
|
||||||
|
# Provider host path (must match the CSI provider's path)
|
||||||
|
providersDir: "/etc/kubernetes/secrets-store-csi-providers"
|
||||||
|
# Kubelet host path
|
||||||
|
kubeletRootDir: "/var/lib/kubelet"
|
||||||
|
|
||||||
pod:
|
pod:
|
||||||
# Extra annotations for the provider pods. This can either be YAML or a
|
# Extra annotations for the provider pods. This can either be YAML or a
|
||||||
|
|
Loading…
Reference in a new issue