Explorar el Código

Merge pull request #10011 from id/feat-add-pdb-to-ee

Feat add pdb to ee
Ivan Dyachkov hace 2 años
padre
commit
4cc92c0368

+ 1 - 0
changes/ce/feat-9213.en.md

@@ -0,0 +1 @@
+Add pod disruption budget to helm chart

+ 1 - 0
changes/ce/feat-9213.zh.md

@@ -0,0 +1 @@
+在舵手图中添加吊舱干扰预算。

+ 1 - 0
changes/ee/feat-10011.en.md

@@ -0,0 +1 @@
+Add pod disruption budget to helm chart

+ 1 - 0
changes/ee/feat-10011.zh.md

@@ -0,0 +1 @@
+在舵手图中添加吊舱干扰预算。

+ 3 - 0
deploy/charts/README.md

@@ -0,0 +1,3 @@
+# Sync changes to emqx-enterprise
+
+When making changes in charts, please update `emqx` charts and run `./sync-enterprise.sh`.

+ 18 - 0
deploy/charts/emqx-enterprise/templates/pdb.yaml

@@ -0,0 +1,18 @@
+{{- if and (.Values.pdb.enabled) (.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget") }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: {{ include "emqx.fullname" . }}-pdb
+  namespace: {{ .Release.Namespace }}
+  labels:
+    app.kubernetes.io/name: {{ include "emqx.name" . }}
+    helm.sh/chart: {{ include "emqx.chart" . }}
+    app.kubernetes.io/instance: {{ .Release.Name }}
+    app.kubernetes.io/managed-by: {{ .Release.Service }}
+spec:
+  maxUnavailable: {{ .Values.pdb.maxUnavailable }}
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: {{ include "emqx.name" . }}
+      app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}

+ 1 - 1
deploy/charts/emqx-enterprise/templates/service.yaml

@@ -121,7 +121,7 @@ spec:
     port: {{ .Values.service.mqtt | default 1883 }}
     protocol: TCP
     targetPort: mqtt
-    {{- if not (empty .Values.emqxConfig.EMQX_LISTENERS__TCP__DEFAULT) }}
+    {{- if not (empty .Values.emqxConfig.EMQX_LISTENERS__TCP__INTERNAL__BIND) }}
   - name: internalmqtt
     port: {{ .Values.service.internalmqtt | default 11883 }}
     protocol: TCP

+ 8 - 1
deploy/charts/emqx-enterprise/values.yaml

@@ -102,7 +102,7 @@ initContainers: {}
   #       sysctl -w net.netfilter.nf_conntrack_max=1000000
   #       sysctl -w net.netfilter.nf_conntrack_tcp_timeout_time_wait=30
 
-## EMQX configuration item, see the documentation (https://hub.docker.com/r/emqx/emqx)
+## EMQX configuration item, see the documentation (https://hub.docker.com/r/emqx/emqx-enterprise)
 emqxConfig:
   EMQX_CLUSTER__DISCOVERY_STRATEGY: "dns"
   EMQX_DASHBOARD__DEFAULT_USERNAME: "admin"
@@ -229,3 +229,10 @@ ssl:
   issuer:
     name: letsencrypt-dns
     kind: ClusterIssuer
+
+## Setting PodDisruptionBudget.
+## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb
+##
+pdb:
+  enabled: false
+  maxUnavailable: 1

+ 1 - 1
deploy/charts/emqx/templates/service.yaml

@@ -38,7 +38,7 @@ spec:
     {{- else if eq .Values.service.type "ClusterIP" }}
     nodePort: null
     {{- end }}
-    {{- if not (empty .Values.emqxConfig.EMQX_LISTENERS__TCP__DEFAULT) }}
+    {{- if not (empty .Values.emqxConfig.EMQX_LISTENERS__TCP__INTERNAL__BIND) }}
   - name: internalmqtt
     port: {{ .Values.service.internalmqtt | default 11883 }}
     protocol: TCP

+ 6 - 0
deploy/charts/sync-enterprise.sh

@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+sed 's|emqx/emqx|emqx/emqx-enterprise|' < emqx/values.yaml > emqx-enterprise/values.yaml
+cp emqx/templates/* emqx-enterprise/templates