From a2e23c1a71fac80e832d554acf544a8bb22522fb Mon Sep 17 00:00:00 2001 From: pingrulkin <37694417+dmitrytretyakov@users.noreply.github.com> Date: Tue, 20 Sep 2022 02:47:22 +0200 Subject: [PATCH] vsphere-csi: add nodeAffinity to daemonset (#9293) --- roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml | 2 ++ .../csi_driver/vsphere/templates/vsphere-csi-node.yml.j2 | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml b/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml index 62d49cfcb..088779fda 100644 --- a/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml +++ b/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml @@ -24,6 +24,8 @@ vsphere_csi_aggressive_node_drain: False vsphere_csi_aggressive_node_unreachable_timeout: 300 vsphere_csi_aggressive_node_not_ready_timeout: 300 +vsphere_csi_node_affinity: {} + # If this is true, debug information will be displayed but # may contain some private data, so it is recommended to set it to false # in the production environment. diff --git a/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-node.yml.j2 b/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-node.yml.j2 index fa5620e22..1a8370ddd 100644 --- a/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-node.yml.j2 +++ b/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-node.yml.j2 @@ -19,6 +19,10 @@ spec: spec: nodeSelector: kubernetes.io/os: linux +{% if vsphere_csi_node_affinity %} + affinity: + {{ vsphere_csi_node_affinity | to_nice_yaml | indent(width=8) }} +{% endif %} serviceAccountName: vsphere-csi-node hostNetwork: true dnsPolicy: "ClusterFirstWithHostNet"