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

feat(helm): helm chart support extraVolumeMounts and extraVolumes

Done of https://github.com/emqx/emqx/issues/10116
Rory Z 2 лет назад
Родитель
Сommit
604ef774be

+ 3 - 0
changes/ce/feat-10139.en.md

@@ -0,0 +1,3 @@
+Add `extraVolumeMounts` to EMQX Helm Chart, it will have the ability to mount the user-own files into the EMQX instance, for example, ACL rule files as mentioned in [#9052](https://github.com/emqx/emqx/issues/9052)
+
+Done of [#10116](https://github.com/emqx/emqx/issues/10116)

+ 3 - 0
changes/ce/feat-10139.zh.md

@@ -0,0 +1,3 @@
+将 `extraVolumeMounts` 添加到 EMQX Helm Chart 中,它将能够挂载用户自己的文件到 EMQX 实例中,例如在 [#9052](https://github.com/emqx/emqx/issues/9052) 中提到的 ACL 规则文件。
+
+完成了 [#10116](https://github.com/emqx/emqx/issues/10116)

+ 2 - 0
deploy/charts/emqx-enterprise/README.md

@@ -57,6 +57,8 @@ The following table lists the configurable parameters of the emqx chart and thei
 | `persistence.size` | PVC Storage Request for EMQX volume | 20Mi |
 | `initContainers` | Containers that run before the creation of EMQX containers. They can contain utilities or setup scripts. | `{}` |
 | `resources` | CPU/Memory resource requests/limits | {} |
+| `extraVolumeMounts` | Additional volumeMounts to the default backend container. | [] |
+| `extraVolumes` | Additional volumes to the default backend pod.| [] |
 | `nodeSelector` | Node labels for pod assignment | `{}` |
 | `tolerations` | Toleration labels for pod assignment | `[]` |
 | `affinity` | Map of node/pod affinities | `{}` |

+ 7 - 1
deploy/charts/emqx-enterprise/templates/StatefulSet.yaml

@@ -74,12 +74,15 @@ spec:
         secret:
           secretName: {{ .Values.emqxLicenseSecretName }}
       {{- end }}
+      {{- if .Values.extraVolumes }}
+        {{- toYaml .Values.extraVolumes | nindent 8 }}
+      {{- end }}
       {{- if .Values.podSecurityContext.enabled }}
       securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
       {{- end }}
       {{- if .Values.initContainers }}
       initContainers:
-{{ toYaml .Values.initContainers | indent 8 }}
+        {{- toYaml .Values.initContainers | nindent 8 }}
       {{- end }}
       {{- if .Values.image.pullSecrets }}
       imagePullSecrets:
@@ -138,6 +141,9 @@ spec:
             subPath: "emqx.lic"
             readOnly: true
           {{- end }}
+          {{- if .Values.extraVolumeMounts }}
+            {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
+          {{- end }}
           readinessProbe:
             httpGet:
               path: /status

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

@@ -62,6 +62,17 @@ resources: {}
   #   cpu: 500m
   #   memory: 512Mi
 
+extraVolumeMounts: []
+## Additional volumeMounts to the default backend container.
+#  - name: my-owner-acl
+#    mountPath: /opt/emqx/etc/acl.conf
+#    subPath: acl.conf
+
+extraVolumes: []
+## Additional volumes to the default backend pod.
+#  - name: my-owner-acl
+#    secret:  fake-acl-conf
+
 # Containers that run before the creation of EMQX containers. They can contain utilities or setup scripts.
 initContainers: {}
   # - name: sysctl

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

@@ -57,6 +57,8 @@ The following table lists the configurable parameters of the emqx chart and thei
 | `persistence.size` | PVC Storage Request for EMQX volume | 20Mi |
 | `initContainers` | Containers that run before the creation of EMQX containers. They can contain utilities or setup scripts. | `{}` |
 | `resources` | CPU/Memory resource requests/limits | {} |
+| `extraVolumeMounts` | Additional volumeMounts to the default backend container. | [] |
+| `extraVolumes` | Additional volumes to the default backend pod.| [] |
 | `nodeSelector` | Node labels for pod assignment | `{}` |
 | `tolerations` | Toleration labels for pod assignment | `[]` |
 | `affinity` | Map of node/pod affinities | `{}` |

+ 7 - 1
deploy/charts/emqx/templates/StatefulSet.yaml

@@ -74,12 +74,15 @@ spec:
         secret:
           secretName: {{ .Values.emqxLicenseSecretName }}
       {{- end }}
+      {{- if .Values.extraVolumes }}
+        {{- toYaml .Values.extraVolumes | nindent 8 }}
+      {{- end }}
       {{- if .Values.podSecurityContext.enabled }}
       securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
       {{- end }}
       {{- if .Values.initContainers }}
       initContainers:
-{{ toYaml .Values.initContainers | indent 8 }}
+        {{- toYaml .Values.initContainers | nindent 8 }}
       {{- end }}
       {{- if .Values.image.pullSecrets }}
       imagePullSecrets:
@@ -138,6 +141,9 @@ spec:
             subPath: "emqx.lic"
             readOnly: true
           {{- end }}
+          {{- if .Values.extraVolumeMounts }}
+            {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
+          {{- end }}
           readinessProbe:
             httpGet:
               path: /status

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

@@ -62,6 +62,17 @@ resources: {}
   #   cpu: 500m
   #   memory: 512Mi
 
+extraVolumeMounts: []
+## Additional volumeMounts to the default backend container.
+#  - name: my-owner-acl
+#    mountPath: /opt/emqx/etc/acl.conf
+#    subPath: acl.conf
+
+extraVolumes: []
+## Additional volumes to the default backend pod.
+#  - name: my-owner-acl
+#    secret:  fake-acl-conf
+
 # Containers that run before the creation of EMQX containers. They can contain utilities or setup scripts.
 initContainers: {}
   # - name: sysctl