Disable leader elections for CSI components on AIO-SX

The rbd-provisioner and cephfs-provisioner pods use the K8s
API to conduct leadership elections, but these elections
should be disabled on AIO-SX, since they are not needed.

Test Plan:
- PASS: Build app package
- PASS: Update app package on AIO-SX and
	check csi containers logs
- PASS: Update app package on AIO-DX and
	check csi containers logs

Closes-Bug: 2080868

Change-Id: Ifd6f1b09aa9986e577335c34187668a8ca53b052
Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
This commit is contained in:
Erickson Silva de Oliveira 2024-09-16 11:00:44 -03:00
parent 162653536f
commit 673bbf711d
5 changed files with 152 additions and 0 deletions

View File

@ -0,0 +1,65 @@
From 1e4bf4f0457288c6619b0cfd75816a54b0bb2500 Mon Sep 17 00:00:00 2001
From: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
Date: Fri, 13 Sep 2024 17:46:04 -0300
Subject: [PATCH] cephfs: Add conditional to enable leader election
The rbd-provisioner and cephfs-provisioner pods use the K8s
API to conduct leadership elections, but these elections
should be disabled on AIO-SX, since they are not needed.
Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
---
.../ceph-csi-cephfs/templates/provisioner-deployment.yaml | 6 ++++++
charts/ceph-csi-cephfs/values.yaml | 3 +++
2 files changed, 9 insertions(+)
diff --git a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml
index 9c930d3..9b7febe 100644
--- a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml
+++ b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml
@@ -126,7 +126,9 @@ spec:
- "--csi-address=$(ADDRESS)"
- "--v={{ .Values.sidecarLogLevel }}"
- "--timeout={{ .Values.provisioner.timeout }}"
+{{- if .Values.provisioner.leaderElection.enabled }}
- "--leader-election=true"
+{{- end }}
- "--retry-interval-start=500ms"
- "--extra-create-metadata=true"
- "--feature-gates=HonorPVReclaimPolicy=true"
@@ -150,7 +152,9 @@ spec:
- "--csi-address=$(ADDRESS)"
- "--v={{ .Values.sidecarLogLevel }}"
- "--timeout={{ .Values.provisioner.timeout }}"
+{{- if .Values.provisioner.leaderElection.enabled }}
- "--leader-election=true"
+{{- end }}
- "--extra-create-metadata=false"
- "--enable-volume-group-snapshots={{.Values.provisioner.snapshotter.args.enableVolumeGroupSnapshots }}"
{{- range .Values.provisioner.snapshotter.extraArgs }}
@@ -173,7 +177,9 @@ spec:
- "--v={{ .Values.sidecarLogLevel }}"
- "--csi-address=$(ADDRESS)"
- "--timeout={{ .Values.provisioner.timeout }}"
+{{- if .Values.provisioner.leaderElection.enabled }}
- "--leader-election"
+{{- end }}
- "--retry-interval-start=500ms"
- "--handle-volume-inuse-error=false"
- "--feature-gates=RecoverVolumeExpansionFailure=true"
diff --git a/charts/ceph-csi-cephfs/values.yaml b/charts/ceph-csi-cephfs/values.yaml
index 8141d86..d6304c7 100644
--- a/charts/ceph-csi-cephfs/values.yaml
+++ b/charts/ceph-csi-cephfs/values.yaml
@@ -160,6 +160,9 @@ provisioner:
# useful for deployments where the podNetwork has no access to ceph
enableHostNetwork: false
+ leaderElection:
+ enabled: true
+
httpMetrics:
# Metrics only available for cephcsi/cephcsi => 1.2.0
# Specifies whether http metrics should be exposed
--
2.34.1

View File

@ -0,0 +1,75 @@
From ae66484310a368998d44654bbe7a6e0b88b28dc5 Mon Sep 17 00:00:00 2001
From: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
Date: Fri, 13 Sep 2024 17:46:49 -0300
Subject: [PATCH] rbd: Add conditional to enable leader election
The rbd-provisioner and cephfs-provisioner pods use the K8s
API to conduct leadership elections, but these elections
should be disabled on AIO-SX, since they are not needed.
Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
---
charts/ceph-csi-rbd/templates/provisioner-deployment.yaml | 8 ++++++++
charts/ceph-csi-rbd/values.yaml | 3 +++
2 files changed, 11 insertions(+)
diff --git a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml
index 8f4e3b2..1bac6e8 100644
--- a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml
+++ b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml
@@ -141,7 +141,9 @@ spec:
- "--csi-address=$(ADDRESS)"
- "--v={{ .Values.sidecarLogLevel }}"
- "--timeout={{ .Values.provisioner.timeout }}"
+{{- if .Values.provisioner.leaderElection.enabled }}
- "--leader-election=true"
+{{- end }}
- "--retry-interval-start=500ms"
- "--default-fstype={{ .Values.provisioner.defaultFSType }}"
- "--extra-create-metadata=true"
@@ -169,7 +171,9 @@ spec:
- "--v={{ .Values.sidecarLogLevel }}"
- "--csi-address=$(ADDRESS)"
- "--timeout={{ .Values.provisioner.timeout }}"
+{{- if .Values.provisioner.leaderElection.enabled }}
- "--leader-election"
+{{- end }}
- "--retry-interval-start=500ms"
- "--handle-volume-inuse-error=false"
- "--feature-gates=RecoverVolumeExpansionFailure=true"
@@ -193,7 +197,9 @@ spec:
- "--csi-address=$(ADDRESS)"
- "--v={{ .Values.sidecarLogLevel }}"
- "--timeout={{ .Values.provisioner.timeout }}"
+{{- if .Values.provisioner.leaderElection.enabled }}
- "--leader-election=true"
+{{- end }}
- "--extra-create-metadata=true"
- "--enable-volume-group-snapshots={{.Values.provisioner.snapshotter.args.enableVolumeGroupSnapshots }}"
{{- range .Values.provisioner.snapshotter.extraArgs }}
@@ -215,7 +221,9 @@ spec:
args:
- "--v={{ .Values.sidecarLogLevel }}"
- "--csi-address=$(ADDRESS)"
+{{- if .Values.provisioner.leaderElection.enabled }}
- "--leader-election=true"
+{{- end }}
- "--retry-interval-start=500ms"
- "--default-fstype=ext4"
{{- range .Values.provisioner.attacher.extraArgs }}
diff --git a/charts/ceph-csi-rbd/values.yaml b/charts/ceph-csi-rbd/values.yaml
index 3087794..d1b002d 100644
--- a/charts/ceph-csi-rbd/values.yaml
+++ b/charts/ceph-csi-rbd/values.yaml
@@ -197,6 +197,9 @@ provisioner:
# useful for deployments where the podNetwork has no access to ceph
enableHostNetwork: false
+ leaderElection:
+ enabled: true
+
httpMetrics:
# Metrics only available for cephcsi/cephcsi => 1.2.0
# Specifies whether http metrics should be exposed
--
2.34.1

View File

@ -18,3 +18,5 @@
0018-Fix-chart-label-for-rbd-storage-init-Job.patch 0018-Fix-chart-label-for-rbd-storage-init-Job.patch
0019-ceph-csi-cephfs-add-conditional-for-csi-snapshotter-creation.patch 0019-ceph-csi-cephfs-add-conditional-for-csi-snapshotter-creation.patch
0020-ceph-csi-rbd-add-conditional-for-csi-snapshotter-creation.patch 0020-ceph-csi-rbd-add-conditional-for-csi-snapshotter-creation.patch
0021-ceph-csi-cephfs-add-conditional-to-enable-leader-election.patch
0022-ceph-csi-rbd-add-conditional-to-enable-leader-election.patch

View File

@ -9,6 +9,7 @@ from k8sapp_platform.common import utils as cutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import utils
from sysinv.helm import base from sysinv.helm import base
@ -147,6 +148,7 @@ class CephFSProvisionerHelm(base.FluxCDBaseHelm):
"adminSecretName": app_constants.K8S_CEPHFS_PROVISIONER_ADMIN_SECRET_NAME "adminSecretName": app_constants.K8S_CEPHFS_PROVISIONER_ADMIN_SECRET_NAME
} }
is_simplex = utils.is_aio_simplex_system(self.dbapi)
snapshot_support = cutils.check_snapshot_support(app_constants.HELM_CHART_CEPH_FS_PROVISIONER) snapshot_support = cutils.check_snapshot_support(app_constants.HELM_CHART_CEPH_FS_PROVISIONER)
# Get tier info. # Get tier info.
tiers = self.dbapi.storage_tier_get_list() tiers = self.dbapi.storage_tier_get_list()
@ -195,6 +197,9 @@ class CephFSProvisionerHelm(base.FluxCDBaseHelm):
"replicaCount": self._num_replicas_for_platform_app(), "replicaCount": self._num_replicas_for_platform_app(),
"snapshotter": { "snapshotter": {
"enabled": snapshot_support "enabled": snapshot_support
},
"leaderElection": {
"enabled": not is_simplex
} }
} }

View File

@ -9,6 +9,7 @@ from k8sapp_platform.common import utils as cutils
from sysinv.common import constants from sysinv.common import constants
from sysinv.common import exception from sysinv.common import exception
from sysinv.common import utils
from sysinv.common.storage_backend_conf import K8RbdProvisioner from sysinv.common.storage_backend_conf import K8RbdProvisioner
from sysinv.helm import base from sysinv.helm import base
@ -65,6 +66,7 @@ class RbdProvisionerHelm(base.FluxCDBaseHelm):
"storageClass": constants.K8S_RBD_PROV_STOR_CLASS_NAME "storageClass": constants.K8S_RBD_PROV_STOR_CLASS_NAME
} }
is_simplex = utils.is_aio_simplex_system(self.dbapi)
snapshot_support = cutils.check_snapshot_support(app_constants.HELM_CHART_RBD_PROVISIONER) snapshot_support = cutils.check_snapshot_support(app_constants.HELM_CHART_RBD_PROVISIONER)
# Get tier info. # Get tier info.
tiers = self.dbapi.storage_tier_get_list() tiers = self.dbapi.storage_tier_get_list()
@ -110,6 +112,9 @@ class RbdProvisionerHelm(base.FluxCDBaseHelm):
"replicaCount": self._num_replicas_for_platform_app(), "replicaCount": self._num_replicas_for_platform_app(),
"snapshotter": { "snapshotter": {
"enabled": snapshot_support "enabled": snapshot_support
},
"leaderElection": {
"enabled": not is_simplex
} }
} }