From daea8521e5f2aca8f8fbd05efb11de2a3d110341 Mon Sep 17 00:00:00 2001 From: Praveen M Date: Thu, 7 Sep 2023 09:44:08 +0530 Subject: [PATCH] helm: add option to enable read affinity for rbd This commit adds --enable-read-affinity flag to enable read affinity for rbd Signed-off-by: Praveen M --- charts/ceph-csi-rbd/README.md | 2 ++ .../templates/nodeplugin-daemonset.yaml | 4 ++++ charts/ceph-csi-rbd/values.yaml | 17 +++++++++++++++++ scripts/install-helm.sh | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/charts/ceph-csi-rbd/README.md b/charts/ceph-csi-rbd/README.md index 778adbcafcb1..a880530da6a1 100644 --- a/charts/ceph-csi-rbd/README.md +++ b/charts/ceph-csi-rbd/README.md @@ -176,6 +176,8 @@ charts and their default values. | `provisioner.podSecurityPolicy.enabled` | Specifies whether podSecurityPolicy is enabled | `false` | | `topology.enabled` | Specifies whether topology based provisioning support should be exposed by CSI | `false` | | `topology.domainLabels` | DomainLabels define which node labels to use as domains for CSI nodeplugins to advertise their domains | `{}` | +| `readAffinity.enabled` | Enable read affinity for RBD volumes. Recommended to set to true if running kernel 5.8 or newer. | `false` | +| `readAffinity.crushLocationLabels` | Define which node labels to use as CRUSH location. This should correspond to the values set in the CRUSH map. | labels listed [here](https://github.com/rook/rook/blob/master/Documentation/CRDs/Cluster/ceph-cluster-crd.md#osd-topology) | | `provisionerSocketFile` | The filename of the provisioner socket | `csi-provisioner.sock` | | `pluginSocketFile` | The filename of the plugin socket | `csi.sock` | | `kubeletDir` | kubelet working directory | `/var/lib/kubelet` | diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml index a1744a8954a9..66a8339bf765 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml @@ -86,6 +86,10 @@ spec: {{- end }} {{- if .Values.nodeplugin.profiling.enabled }} - "--enableprofiling={{ .Values.nodeplugin.profiling.enabled }}" +{{- end }} +{{- if .Values.readAffinity.enabled }} + - "--enable-read-affinity=true" + - "--crush-location-labels={{ .Values.readAffinity.crushLocationLabels | join "," }}" {{- end }} env: - name: POD_IP diff --git a/charts/ceph-csi-rbd/values.yaml b/charts/ceph-csi-rbd/values.yaml index b2635fc078e2..f5f530ef7e16 100644 --- a/charts/ceph-csi-rbd/values.yaml +++ b/charts/ceph-csi-rbd/values.yaml @@ -279,6 +279,23 @@ topology: - failure-domain/region - failure-domain/zone +readAffinity: + # Enable read affinity for RBD volumes. Recommended to + # set to true if running kernel 5.8 or newer. + enabled: false + # Define which node labels to use as CRUSH location. + # This should correspond to the values set in the CRUSH map. + crushLocationLabels: + - topology.kubernetes.io/region + - topology.kubernetes.io/zone + - topology.rook.io/datacenter + - topology.rook.io/room + - topology.rook.io/pod + - topology.rook.io/pdu + - topology.rook.io/row + - topology.rook.io/rack + - topology.rook.io/chassis + storageClass: # Specifies whether the storageclass should be created create: false diff --git a/scripts/install-helm.sh b/scripts/install-helm.sh index 41c18bd4539f..7116180ccdd9 100755 --- a/scripts/install-helm.sh +++ b/scripts/install-helm.sh @@ -179,7 +179,7 @@ install_cephcsi_helm_charts() { kubectl_retry delete cm ceph-config --namespace "${NAMESPACE}" # shellcheck disable=SC2086 - "${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.replicaCount=1 --set-json='commonLabels={"app.kubernetes.io/name": "ceph-csi-rbd", "app.kubernetes.io/managed-by": "helm"}' ${SET_SC_TEMPLATE_VALUES} ${RBD_SECRET_TEMPLATE_VALUES} ${RBD_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-rbd --set topology.enabled=true --set topology.domainLabels="{${NODE_LABEL_REGION},${NODE_LABEL_ZONE}}" --set provisioner.maxSnapshotsOnImage=3 --set provisioner.minSnapshotsOnImage=2 + "${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.replicaCount=1 --set-json='commonLabels={"app.kubernetes.io/name": "ceph-csi-rbd", "app.kubernetes.io/managed-by": "helm"}' ${SET_SC_TEMPLATE_VALUES} ${RBD_SECRET_TEMPLATE_VALUES} ${RBD_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-rbd --set topology.enabled=true --set topology.domainLabels="{${NODE_LABEL_REGION},${NODE_LABEL_ZONE}}" --set provisioner.maxSnapshotsOnImage=3 --set provisioner.minSnapshotsOnImage=2 --set readAffinity.enabled=true check_deployment_status app=ceph-csi-rbd "${NAMESPACE}" check_daemonset_status app=ceph-csi-rbd "${NAMESPACE}"