Просмотр исходного кода

feat(helm-chart): add support for topologySpreadConstraints

Thomas Schmid 2 лет назад
Родитель
Сommit
27a9731935

+ 12 - 0
deploy/charts/emqx-enterprise/templates/StatefulSet.yaml

@@ -170,3 +170,15 @@ spec:
       tolerations:
         {{- toYaml . | nindent 8 }}
     {{- end }}
+    {{- with .Values.topologySpreadConstraints }}
+      topologySpreadConstraints:
+        {{- range . }}
+        - maxSkew: {{ .maxSkew }}
+          topologyKey: {{ .topologyKey }}
+          whenUnsatisfiable: {{ .whenUnsatisfiable }}
+          labelSelector:
+            matchLabels:
+              app.kubernetes.io/name: {{ include "emqx.name" $ }}
+              app.kubernetes.io/instance: {{ $.Release.Name }}
+        {{- end }}
+    {{- end }}

+ 5 - 0
deploy/charts/emqx-enterprise/values.yaml

@@ -128,6 +128,9 @@ service:
   ## Service type
   ##
   type: ClusterIP
+  ## The cluster IP if one wants to customize it to a fixed value
+  ##
+  clusterIP: None
   ## Port for MQTT
   ##
   mqtt: 1883
@@ -187,6 +190,8 @@ tolerations: []
 
 affinity: {}
 
+topologySpreadConstraints: []
+
 ingress:
   ## ingress for EMQX Dashboard
   dashboard:

+ 1 - 0
deploy/charts/emqx/README.md

@@ -62,6 +62,7 @@ The following table lists the configurable parameters of the emqx chart and thei
 | `nodeSelector` | Node labels for pod assignment | `{}` |
 | `tolerations` | Toleration labels for pod assignment | `[]` |
 | `affinity` | Map of node/pod affinities | `{}` |
+| `topologySpreadConstraints` | List of topology spread constraints without labelSelector | `[]` |
 | `service.type` | Kubernetes Service type. | ClusterIP |
 | `service.mqtt` | Port for MQTT. | 1883 |
 | `service.mqttssl` | Port for MQTT(SSL). | 8883 |

+ 12 - 0
deploy/charts/emqx/templates/StatefulSet.yaml

@@ -170,3 +170,15 @@ spec:
       tolerations:
         {{- toYaml . | nindent 8 }}
     {{- end }}
+    {{- with .Values.topologySpreadConstraints }}
+      topologySpreadConstraints:
+        {{- range . }}
+        - maxSkew: {{ .maxSkew }}
+          topologyKey: {{ .topologyKey }}
+          whenUnsatisfiable: {{ .whenUnsatisfiable }}
+          labelSelector:
+            matchLabels:
+              app.kubernetes.io/name: {{ include "emqx.name" $ }}
+              app.kubernetes.io/instance: {{ $.Release.Name }}
+        {{- end }}
+    {{- end }}

+ 2 - 0
deploy/charts/emqx/values.yaml

@@ -190,6 +190,8 @@ tolerations: []
 
 affinity: {}
 
+topologySpreadConstraints: []
+
 ingress:
   ## ingress for EMQX Dashboard
   dashboard: