mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
helm: add pod anti-affinity for provisioner deployments
When replication count is >1 of the provisioner, the added anti-affinity rules will prevent provisioner operators from scheduling on the same nodes. The kubernetes scheduler will spread the pods across nodes to improve availability during node failures. Signed-off-by: Nico Berlee <nico.berlee@on2it.net>
This commit is contained in:
parent
6a5f1380b0
commit
7b940df568
@ -25,6 +25,22 @@ spec:
|
|||||||
release: {{ .Release.Name }}
|
release: {{ .Release.Name }}
|
||||||
heritage: {{ .Release.Service }}
|
heritage: {{ .Release.Service }}
|
||||||
spec:
|
spec:
|
||||||
|
{{- if gt (int .Values.provisioner.replicaCount) 1 }}
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- {{ include "ceph-csi-cephfs.name" . }}
|
||||||
|
- key: component
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- {{ .Values.provisioner.name }}
|
||||||
|
topologyKey: "kubernetes.io/hostname"
|
||||||
|
{{- end }}
|
||||||
serviceAccountName: {{ include "ceph-csi-cephfs.serviceAccountName.provisioner" . }}
|
serviceAccountName: {{ include "ceph-csi-cephfs.serviceAccountName.provisioner" . }}
|
||||||
containers:
|
containers:
|
||||||
- name: csi-provisioner
|
- name: csi-provisioner
|
||||||
|
@ -25,6 +25,22 @@ spec:
|
|||||||
release: {{ .Release.Name }}
|
release: {{ .Release.Name }}
|
||||||
heritage: {{ .Release.Service }}
|
heritage: {{ .Release.Service }}
|
||||||
spec:
|
spec:
|
||||||
|
{{- if gt (int .Values.provisioner.replicaCount) 1 }}
|
||||||
|
affinity:
|
||||||
|
podAntiAffinity:
|
||||||
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||||||
|
- labelSelector:
|
||||||
|
matchExpressions:
|
||||||
|
- key: app
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- {{ include "ceph-csi-rbd.name" . }}
|
||||||
|
- key: component
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- {{ .Values.provisioner.name }}
|
||||||
|
topologyKey: "kubernetes.io/hostname"
|
||||||
|
{{- end }}
|
||||||
serviceAccountName: {{ include "ceph-csi-rbd.serviceAccountName.provisioner" . }}
|
serviceAccountName: {{ include "ceph-csi-rbd.serviceAccountName.provisioner" . }}
|
||||||
containers:
|
containers:
|
||||||
- name: csi-provisioner
|
- name: csi-provisioner
|
||||||
|
@ -117,7 +117,7 @@ install_cephcsi_helm_charts() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# install ceph-csi-cephfs and ceph-csi-rbd charts
|
# install ceph-csi-cephfs and ceph-csi-rbd charts
|
||||||
"${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-cephfsplugin-provisioner --set nodeplugin.fullnameOverride=csi-cephfsplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true ${CEPHFS_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-cephfs
|
"${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-cephfsplugin-provisioner --set nodeplugin.fullnameOverride=csi-cephfsplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true --set provisioner.replicaCount=1 ${CEPHFS_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-cephfs
|
||||||
|
|
||||||
check_deployment_status app=ceph-csi-cephfs ${NAMESPACE}
|
check_deployment_status app=ceph-csi-cephfs ${NAMESPACE}
|
||||||
check_daemonset_status app=ceph-csi-cephfs ${NAMESPACE}
|
check_daemonset_status app=ceph-csi-cephfs ${NAMESPACE}
|
||||||
@ -125,7 +125,7 @@ install_cephcsi_helm_charts() {
|
|||||||
# deleting configmap as a workaround to avoid configmap already present
|
# deleting configmap as a workaround to avoid configmap already present
|
||||||
# issue when installing ceph-csi-rbd
|
# issue when installing ceph-csi-rbd
|
||||||
kubectl delete cm ceph-csi-config --namespace ${NAMESPACE}
|
kubectl delete cm ceph-csi-config --namespace ${NAMESPACE}
|
||||||
"${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true ${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
|
"${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.podSecurityPolicy.enabled=true --set nodeplugin.podSecurityPolicy.enabled=true --set provisioner.replicaCount=1 ${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
|
||||||
|
|
||||||
check_deployment_status app=ceph-csi-rbd ${NAMESPACE}
|
check_deployment_status app=ceph-csi-rbd ${NAMESPACE}
|
||||||
check_daemonset_status app=ceph-csi-rbd ${NAMESPACE}
|
check_daemonset_status app=ceph-csi-rbd ${NAMESPACE}
|
||||||
|
Loading…
Reference in New Issue
Block a user