From 5cbcec8968d8bd7d5aa1ca23c277653024ea2c18 Mon Sep 17 00:00:00 2001 From: Eugene Artemenko Date: Mon, 27 Feb 2023 12:36:20 +0200 Subject: [PATCH] Add resources section to all containers releated to Vsphere CSI driver (#9687) --- .../csi_driver/vsphere/defaults/main.yml | 14 +++++++++++ .../vsphere-csi-controller-deployment.yml.j2 | 24 +++++++++++++++++++ .../vsphere/templates/vsphere-csi-node.yml.j2 | 12 ++++++++++ 3 files changed, 50 insertions(+) diff --git a/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml b/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml index 549a88b46..ede7cb0b7 100644 --- a/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml +++ b/roles/kubernetes-apps/csi_driver/vsphere/defaults/main.yml @@ -38,3 +38,17 @@ vsphere_csi_block_volume_snapshot: false external_vsphere_user: "{{ lookup('env','VSPHERE_USER') }}" external_vsphere_password: "{{ lookup('env','VSPHERE_PASSWORD') }}" + +# Controller resources +vsphere_csi_snapshotter_resources: {} +vsphere_csi_provisioner_resources: {} +vsphere_syncer_resources: {} +vsphere_csi_liveness_probe_controller_resources: {} +vsphere_csi_resources: {} +vsphere_csi_resizer_resources: {} +vsphere_csi_attacher_resources: {} + +# DaemonSet node resources +vsphere_csi_node_driver_registrar_resources: {} +vsphere_csi_driver_resources: {} +vsphere_csi_liveness_probe_ds_resources: {} diff --git a/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-controller-deployment.yml.j2 b/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-controller-deployment.yml.j2 index 1c1de2f8f..8bda5145a 100644 --- a/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-controller-deployment.yml.j2 +++ b/roles/kubernetes-apps/csi_driver/vsphere/templates/vsphere-csi-controller-deployment.yml.j2 @@ -62,6 +62,10 @@ spec: - "--leader-election" - "--kube-api-qps=100" - "--kube-api-burst=100" +{% if vsphere_csi_attacher_resources | length > 0 %} + resources: + {{ vsphere_csi_attacher_resources | default({}) | to_nice_yaml | trim | indent(width=12) }} +{% endif %} env: - name: ADDRESS value: /csi/csi.sock @@ -79,6 +83,10 @@ spec: - "--kube-api-qps=100" - "--kube-api-burst=100" - "--leader-election" +{% if vsphere_csi_resizer_resources | length > 0 %} + resources: + {{ vsphere_csi_resizer_resources | default({}) | to_nice_yaml | trim | indent(width=12) }} +{% endif %} env: - name: ADDRESS value: /csi/csi.sock @@ -93,6 +101,10 @@ spec: - "--fss-namespace={{ vsphere_csi_namespace }}" - "--supervisor-fss-namespace={{ vsphere_csi_namespace }}" - "--use-gocsi=false" +{% if vsphere_csi_resources | length > 0 %} + resources: + {{ vsphere_csi_resources | default({}) | to_nice_yaml | trim | indent(width=12) }} +{% endif %} imagePullPolicy: {{ k8s_image_pull_policy }} env: - name: CSI_ENDPOINT @@ -139,6 +151,10 @@ spec: args: - "--v=4" - "--csi-address=$(ADDRESS)" +{% if vsphere_csi_liveness_probe_controller_resources | length > 0 %} + resources: + {{ vsphere_csi_liveness_probe_controller_resources | default({}) | to_nice_yaml | trim | indent(width=12) }} +{% endif %} env: - name: ADDRESS value: {{ csi_endpoint }}/csi.sock @@ -157,6 +173,10 @@ spec: - containerPort: 2113 name: prometheus protocol: TCP +{% if vsphere_syncer_resources | length > 0 %} + resources: + {{ vsphere_syncer_resources | default({}) | to_nice_yaml | trim | indent(width=12) }} +{% endif %} env: - name: FULL_SYNC_INTERVAL_MINUTES value: "30" @@ -189,6 +209,10 @@ spec: # needed only for topology aware setup #- "--feature-gates=Topology=true" #- "--strict-topology" +{% if vsphere_csi_provisioner_resources | length > 0 %} + resources: + {{ vsphere_csi_provisioner_resources | default({}) | to_nice_yaml | trim | indent(width=12) }} +{% endif %} env: - name: ADDRESS value: /csi/csi.sock 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 1a8370ddd..eedacf695 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 @@ -39,6 +39,10 @@ spec: - "--v=5" - "--csi-address=$(ADDRESS)" - "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" +{% if vsphere_csi_node_driver_registrar_resources | length > 0 %} + resources: + {{ vsphere_csi_node_driver_registrar_resources | default({}) | to_nice_yaml | trim | indent(width=10) }} +{% endif %} env: - name: ADDRESS value: /csi/csi.sock @@ -65,6 +69,10 @@ spec: - "--supervisor-fss-namespace={{ vsphere_csi_namespace }}" - "--use-gocsi=false" imagePullPolicy: "Always" +{% if vsphere_csi_driver_resources | length > 0 %} + resources: + {{ vsphere_csi_driver_resources | default({}) | to_nice_yaml | trim | indent(width=10) }} +{% endif %} env: - name: NODE_NAME valueFrom: @@ -123,6 +131,10 @@ spec: - "--v=4" {% endif %} - "--csi-address=/csi/csi.sock" +{% if vsphere_csi_liveness_probe_ds_resources | length > 0 %} + resources: + {{ vsphere_csi_liveness_probe_ds_resources | default({}) | to_nice_yaml | trim | indent(width=10) }} +{% endif %} volumeMounts: - name: plugin-dir mountPath: /csi