-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(csi/providersDir): add configurable providersDir #603
feat(csi/providersDir): add configurable providersDir #603
Conversation
Signed-off-by: Toni Tauro <toni.tauro@adfinis.com>
@jasonodonnell Can you please review this PR? We can't upgrade the vault integration on a cluster due to it being using differente providersDir paths. |
Co-authored-by: Ben Ash <32777270+benashz@users.noreply.github.com>
Signed-off-by: Toni Tauro <toni.tauro@adfinis.com>
Signed-off-by: Toni Tauro <toni.tauro@adfinis.com>
Thanks for the review Please re-review @benashz |
Thanks @eyenx . I think all that is missing now are some unit tests. I think the following patch should suffice: diff --git a/test/unit/csi-daemonset.bats b/test/unit/csi-daemonset.bats
index c546d0a..5cfd8a7 100644
--- a/test/unit/csi-daemonset.bats
+++ b/test/unit/csi-daemonset.bats
@@ -315,6 +315,68 @@ load _helpers
[ "${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
|
Signed-off-by: Toni Tauro <toni.tauro@adfinis.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you for your contribution to HashiCorp!
My pleasure |
* 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>
Background: with kubernetes-sigs/secrets-store-csi-driver#409 the providersDir path has been made configurable for secrets-store-csi-driver, as not every single kubernetes distribution out there uses the same path.
This is why we should also allow vault-helm to set providersDir accordingly. Default will remain
/etc/kubernetes/secrets-store-csi-providers
Signed-off-by: Toni Tauro toni.tauro@adfinis.com