From f3c17361dafa9abc7de15c2eb273e26def5619ed Mon Sep 17 00:00:00 2001 From: Steven Reitsma Date: Tue, 4 Aug 2020 14:28:19 +0200 Subject: [PATCH] Create a PodDisruptionBudget for the Cinder CSI controllerplugin (#6385) --- .../csi_driver/cinder/tasks/main.yml | 1 + .../cinder-csi-poddisruptionbudget.yml.j2 | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-poddisruptionbudget.yml.j2 diff --git a/roles/kubernetes-apps/csi_driver/cinder/tasks/main.yml b/roles/kubernetes-apps/csi_driver/cinder/tasks/main.yml index aa5a1c6e8..b63912d2b 100644 --- a/roles/kubernetes-apps/csi_driver/cinder/tasks/main.yml +++ b/roles/kubernetes-apps/csi_driver/cinder/tasks/main.yml @@ -41,6 +41,7 @@ - {name: cinder-csi-controllerplugin, file: cinder-csi-controllerplugin.yml} - {name: cinder-csi-nodeplugin, file: cinder-csi-nodeplugin-rbac.yml} - {name: cinder-csi-nodeplugin, file: cinder-csi-nodeplugin.yml} + - {name: cinder-csi-poddisruptionbudget, file: cinder-csi-poddisruptionbudget.yml} register: cinder_csi_manifests when: inventory_hostname == groups['kube-master'][0] tags: cinder-csi-driver diff --git a/roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-poddisruptionbudget.yml.j2 b/roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-poddisruptionbudget.yml.j2 new file mode 100644 index 000000000..615721ff0 --- /dev/null +++ b/roles/kubernetes-apps/csi_driver/cinder/templates/cinder-csi-poddisruptionbudget.yml.j2 @@ -0,0 +1,14 @@ +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: cinder-csi-pdb + namespace: kube-system +spec: +{% if cinder_csi_controller_replicas is defined and cinder_csi_controller_replicas > 1 %} + minAvailable: 1 +{% else %} + minAvailable: 0 +{% endif %} + selector: + matchLabels: + app: csi-cinder-controllerplugin