From 9821596ca8345a22cd554ca58b6bb937fa57b4b1 Mon Sep 17 00:00:00 2001 From: Rory Z Date: Fri, 22 Apr 2022 09:57:39 +0800 Subject: [PATCH] feat(helm): the pathType of ingress can be made configurable via values --- deploy/charts/emqx/README.md | 9 +++- deploy/charts/emqx/templates/ingress.yaml | 52 +---------------------- deploy/charts/emqx/values.yaml | 13 +----- 3 files changed, 10 insertions(+), 64 deletions(-) diff --git a/deploy/charts/emqx/README.md b/deploy/charts/emqx/README.md index af96c4124..2c12c2296 100644 --- a/deploy/charts/emqx/README.md +++ b/deploy/charts/emqx/README.md @@ -69,6 +69,7 @@ The following table lists the configurable parameters of the emqx chart and thei | `ingress.dashboard.enabled` | Enable ingress for EMQX Dashboard | false | | `ingress.dashboard.ingressClassName` | Set the ingress class for EMQX Dashboard | | | `ingress.dashboard.path` | Ingress path for EMQX Dashboard | / | +| `ingress.dashboard.pathType` | Ingress pathType for EMQX Dashboard | `ImplementationSpecific` | `ingress.dashboard.hosts` | Ingress hosts for EMQX Mgmt API | dashboard.emqx.local | | `ingress.dashboard.tls` | Ingress tls for EMQX Mgmt API | [] | | `ingress.dashboard.annotations` | Ingress annotations for EMQX Mgmt API | {} | @@ -80,4 +81,10 @@ The following table lists the configurable parameters of the emqx chart and thei | `ingress.mgmt.annotations` | Ingress annotations for EMQX Mgmt API | {} | | `metrics.enable` | If set to true, [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) needs to be installed, and emqx_prometheus needs to enable | false | | `metrics.type` | Now we only supported "prometheus" | "prometheus" | -| `emqxConfig` | Emqx configuration item, see the [documentation](https://hub.docker.com/r/emqx/emqx) | | + +## EMQX specific settings +The following table lists the configurable [EMQX](https://www.emqx.io/)-specific parameters of the chart and their default values. +Parameter | Description | Default Value +--- | --- | --- +`emqxConfig` | Map of [configuration](https://www.emqx.io/docs/en/latest/configuration/configuration.html) items expressed as [environment variables](https://www.emqx.io/docs/en/v4.3/configuration/environment-variable.html) (prefix can be omitted) or using the configuration files [namespaced dotted notation](https://www.emqx.io/docs/en/latest/configuration/configuration.html) | `nil` +`emqxLicenseSecretName` | Name of the secret that holds the license information | `nil` diff --git a/deploy/charts/emqx/templates/ingress.yaml b/deploy/charts/emqx/templates/ingress.yaml index a69ee06f8..f1ee30ae8 100644 --- a/deploy/charts/emqx/templates/ingress.yaml +++ b/deploy/charts/emqx/templates/ingress.yaml @@ -29,7 +29,7 @@ spec: paths: - path: / {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: ImplementationSpecific + pathType: {{ .Values.ingress.dashboard.pathType | default "ImplementationSpecific" }} {{- end }} backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} @@ -48,53 +48,3 @@ spec: {{- end }} --- {{- end }} -{{- if .Values.ingress.mgmt.enabled -}} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ printf "%s-%s" (include "emqx.fullname" .) "mgmt" }} - 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 }} - {{- if .Values.ingress.mgmt.annotations }} - annotations: - {{- toYaml .Values.ingress.mgmt.annotations | nindent 4 }} - {{- end }} -spec: -{{- if and .Values.ingress.mgmt.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.mgmt.ingressClassName }} -{{- end }} - rules: - {{- range $host := .Values.ingress.mgmt.hosts }} - - host: {{ $host }} - http: - paths: - - path: / - {{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: ImplementationSpecific - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ include "emqx.fullname" $ }} - port: - number: {{ $.Values.service.mgmt }} - {{- else }} - serviceName: {{ include "emqx.fullname" $ }} - servicePort: {{ $.Values.service.mgmt }} - {{- end }} - {{- end -}} - {{- if .Values.ingress.mgmt.tls }} - tls: - {{- toYaml .Values.ingress.mgmt.tls | nindent 4 }} - {{- end }} ---- -{{- end }} diff --git a/deploy/charts/emqx/values.yaml b/deploy/charts/emqx/values.yaml index 70b75ea5f..72c98c3fd 100644 --- a/deploy/charts/emqx/values.yaml +++ b/deploy/charts/emqx/values.yaml @@ -174,22 +174,11 @@ ingress: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" path: / + pathType: ImplementationSpecific hosts: - dashboard.emqx.local tls: [] - ## ingress for EMQX Mgmt API - mgmt: - enabled: false - # ingressClassName: nginx - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - path: / - hosts: - - api.emqx.local - tls: [] - podSecurityContext: enabled: true fsGroup: 1000