add helm charts
This commit is contained in:
21
backing-services/emqx/Chart.yaml
Normal file
21
backing-services/emqx/Chart.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
apiVersion: v2
|
||||
name: emqx
|
||||
icon: https://github.com/emqx.png
|
||||
description: A Helm chart for EMQX
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
version: 5.8.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application.
|
||||
appVersion: 5.8.0
|
||||
144
backing-services/emqx/README.md
Normal file
144
backing-services/emqx/README.md
Normal file
@@ -0,0 +1,144 @@
|
||||
# Introduction
|
||||
|
||||
This chart bootstraps an emqx deployment on a Kubernetes cluster using the Helm package manager.
|
||||
|
||||
# Prerequisites
|
||||
|
||||
+ Kubernetes 1.6+
|
||||
+ Helm
|
||||
|
||||
# Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-emqx`:
|
||||
|
||||
+ From Github
|
||||
```
|
||||
$ git clone https://github.com/emqx/emqx.git
|
||||
$ cd emqx/deploy/charts/emqx
|
||||
$ helm install my-emqx .
|
||||
```
|
||||
|
||||
+ From chart Repos
|
||||
```
|
||||
helm repo add emqx https://repos.emqx.io/charts
|
||||
helm install my-emqx emqx/emqx
|
||||
```
|
||||
> If you want to install an unstable version, you need to add `--devel` when you execute the `helm install` command.
|
||||
|
||||
# Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-emqx` deployment:
|
||||
|
||||
```
|
||||
$ helm del my-emqx
|
||||
```
|
||||
|
||||
# Configuration
|
||||
|
||||
The following table lists the configurable parameters of the emqx chart and their default values.
|
||||
|
||||
| Parameter | Description | Default Value |
|
||||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
|
||||
| `replicaCount` | It is recommended to have odd number of nodes in a cluster, otherwise the emqx cluster cannot be automatically healed in case of net-split. | 3 |
|
||||
| `image.repository` | EMQX Image name | emqx/emqx |
|
||||
| `image.pullPolicy` | The image pull policy | IfNotPresent |
|
||||
| `image.pullSecrets ` | The image pull secrets | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `serviceAccount.create` | If `true`, create a new service account | `true` |
|
||||
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the full-name template | |
|
||||
| `serviceAccount.annotations` | Annotations to add to the service account | |
|
||||
| `envFromSecret` | The name pull a secret in the same Kubernetes namespace which contains values that will be added to the environment | nil |
|
||||
| `recreatePods` | Forces the recreation of pods during upgrades, which can be useful to always apply the most recent configuration. | false |
|
||||
| `podAnnotations ` | Annotations for pod | `{}` |
|
||||
| `podManagementPolicy` | To redeploy a chart with existing PVC(s), the value must be set to Parallel to avoid deadlock | `Parallel` |
|
||||
| `persistence.enabled` | Enable EMQX persistence using PVC | false |
|
||||
| `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) |
|
||||
| `persistence.existingClaim` | EMQX data Persistent Volume existing claim name, evaluated as a template | "" |
|
||||
| `persistence.accessMode` | PVC Access Mode for EMQX volume | ReadWriteOnce |
|
||||
| `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 | `{}` |
|
||||
| `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 |
|
||||
| `service.ws` | Port for WebSocket/HTTP. | 8083 |
|
||||
| `service.wss` | Port for WSS/HTTPS. | 8084 |
|
||||
| `service.dashboard` | Port for dashboard and API. | 18083 |
|
||||
| `service.nodePorts.mqtt` | Kubernetes node port for MQTT. | nil |
|
||||
| `service.nodePorts.mqttssl` | Kubernetes node port for MQTT(SSL). | nil |
|
||||
| `service.nodePorts.ws` | Kubernetes node port for WebSocket/HTTP. | nil |
|
||||
| `service.nodePorts.wss` | Kubernetes node port for WSS/HTTPS. | nil |
|
||||
| `service.nodePorts.dashboard` | Kubernetes node port for dashboard. | nil |
|
||||
| `service.loadBalancerClass` | The load balancer implementation this Service belongs to | |
|
||||
| `service.loadBalancerIP` | loadBalancerIP for Service | nil |
|
||||
| `service.loadBalancerSourceRanges` | Address(es) that are allowed when service is LoadBalancer | [] |
|
||||
| `service.externalIPs` | ExternalIPs for the service | [] |
|
||||
| `service.externalTrafficPolicy` | External Traffic Policy for the service | `Cluster` |
|
||||
| `service.annotations` | Service/ServiceMonitor annotations | {}(evaluated as a template) |
|
||||
| `service.labels` | Service/ServiceMonitor labels | {}(evaluated as a template) |
|
||||
| `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 Dashboard | dashboard.emqx.local |
|
||||
| `ingress.dashboard.tls` | Ingress tls for EMQX Dashboard | [] |
|
||||
| `ingress.dashboard.annotations` | Ingress annotations for EMQX Dashboard | {} |
|
||||
| `ingress.dashboard.ingressClassName` | Set the ingress class for EMQX Dashboard | |
|
||||
| `ingress.mqtt.enabled` | Enable ingress for MQTT | false |
|
||||
| `ingress.mqtt.ingressClassName` | Set the ingress class for MQTT | |
|
||||
| `ingress.mqtt.path` | Ingress path for MQTT | / |
|
||||
| `ingress.mqtt.pathType` | Ingress pathType for MQTT | `ImplementationSpecific` |
|
||||
| `ingress.mqtt.hosts` | Ingress hosts for MQTT | mqtt.emqx.local |
|
||||
| `ingress.mqtt.tls` | Ingress tls for MQTT | [] |
|
||||
| `ingress.mqtt.annotations` | Ingress annotations for MQTT | {} |
|
||||
| `ingress.mqtt.ingressClassName` | Set the ingress class for MQTT | |
|
||||
| `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" |
|
||||
| `ssl.enabled` | Enable SSL support | false |
|
||||
| `ssl.useExisting` | Use existing certificate or let cert-manager generate one | false |
|
||||
| `ssl.existingName` | Name of existing certificate | emqx-tls |
|
||||
| `ssl.commonName` | Common name for or certificate to be generated | |
|
||||
| `ssl.dnsnames` | DNS name(s) for certificate to be generated | {} |
|
||||
| `ssl.issuer.name` | Issuer name for certificate generation | letsencrypt-dns |
|
||||
| `ssl.issuer.kind` | Issuer kind for certificate generation | ClusterIssuer |
|
||||
|
||||
## 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/v5.0/admin/cfg.html) items | |
|
||||
| expressed as [environment variables](https://www.emqx.io/docs/en/v5.0/admin/cfg.html#environment-variables) (prefix `EMQX_` can be omitted) or using the configuration | | |
|
||||
| files [namespaced dotted notation](https://www.emqx.io/docs/en/v5.0/admin/cfg.html#syntax) | `nil` | |
|
||||
| `emqxLicenseSecretName` | Name of the secret that holds the license information | `nil` |
|
||||
|
||||
## SSL settings
|
||||
`cert-manager` generates secrets with certificate data using the keys `tls.crt` and `tls.key`. The helm chart always mounts those keys as files to `/tmp/ssl/`
|
||||
which needs to explicitly configured by either changing the emqx config file or by passing the following environment variables:
|
||||
|
||||
```
|
||||
EMQX_LISTENERS__SSL__DEFAULT__SSL_OPTIONS__CERTFILE: /tmp/ssl/tls.crt
|
||||
EMQX_LISTENERS__SSL__DEFAULT__SSL_OPTIONS__KEYFILE: /tmp/ssl/tls.key
|
||||
```
|
||||
|
||||
If you chose to use an existing certificate, make sure, you update the filenames accordingly.
|
||||
|
||||
## Tips
|
||||
Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed behind HAProxy or Nginx.
|
||||
In order to preserve the original client's IP address, you could change the emqx config by passing the following environment variable:
|
||||
|
||||
```
|
||||
EMQX_LISTENERS__TCP__DEFAULT__PROXY_PROTOCOL: "true"
|
||||
```
|
||||
|
||||
With HAProxy you'd also need the following ingress annotation:
|
||||
|
||||
```
|
||||
haproxy-ingress.github.io/proxy-protocol: "v2"
|
||||
```
|
||||
15
backing-services/emqx/schoobus-onsite.values.yaml
Normal file
15
backing-services/emqx/schoobus-onsite.values.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
replicaCount: 3
|
||||
|
||||
service:
|
||||
## Service type
|
||||
##
|
||||
type: NodePort
|
||||
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
29
backing-services/emqx/school-stage-eks.values.yaml
Normal file
29
backing-services/emqx/school-stage-eks.values.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
replicaCount: 3
|
||||
|
||||
service:
|
||||
type: LoadBalancer
|
||||
annotations:
|
||||
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
|
||||
service.beta.kubernetes.io/aws-load-balancer-type: external
|
||||
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
|
||||
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: instance
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 20Mi
|
||||
storageClassName: "efs-sc"
|
||||
accessMode: ReadWriteOnce
|
||||
|
||||
serviceAccount:
|
||||
create: true
|
||||
name: "emqxservcieaccount"
|
||||
annotations:
|
||||
eks.amazonaws.com/role-arn: "arn:aws:iam::889565812003:role/schoolbuses-cluster-20241110104436981500000002"
|
||||
55
backing-services/emqx/school-stage-tavana.values.yaml
Normal file
55
backing-services/emqx/school-stage-tavana.values.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: 172.16.16.1:30516/emqx/emqx
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
service:
|
||||
## Service type
|
||||
##
|
||||
type: NodePort
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 1000m
|
||||
memory: 512Mi
|
||||
|
||||
|
||||
ingress:
|
||||
## ingress for EMQX Dashboard
|
||||
dashboard:
|
||||
enabled: true
|
||||
ingressClassName: nginx
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- dashbaordemqx.tavanasys.app
|
||||
tls: []
|
||||
## ingress for MQTT
|
||||
mqtt:
|
||||
enabled: true
|
||||
ingressClassName: nginx
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- mqtt.tavanasys.app
|
||||
tls: []
|
||||
ws:
|
||||
enabled: true
|
||||
ingressClassName: nginx
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
path: /mqtt
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- ws.tavanasys.app
|
||||
tls: []
|
||||
55
backing-services/emqx/schoolbus-demo.values.yaml
Normal file
55
backing-services/emqx/schoolbus-demo.values.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: 172.16.16.2:30516/emqx/emqx
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: "latest"
|
||||
|
||||
service:
|
||||
## Service type
|
||||
##
|
||||
type: NodePort
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 300m
|
||||
memory: 300Mi
|
||||
requests:
|
||||
cpu: 300m
|
||||
memory: 300Mi
|
||||
|
||||
|
||||
ingress:
|
||||
## ingress for EMQX Dashboard
|
||||
dashboard:
|
||||
enabled: true
|
||||
ingressClassName: traefik
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- emqxconsole.tavanasys.app
|
||||
tls: []
|
||||
## ingress for MQTT
|
||||
mqtt:
|
||||
enabled: true
|
||||
ingressClassName: traefik
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- mqtt.tavanasys.app
|
||||
tls: []
|
||||
ws:
|
||||
enabled: true
|
||||
ingressClassName: traefik
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
path: /mqtt
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- emqx.tavanasys.app
|
||||
tls: []
|
||||
206
backing-services/emqx/templates/StatefulSet.yaml
Normal file
206
backing-services/emqx/templates/StatefulSet.yaml
Normal file
@@ -0,0 +1,206 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "emqx.fullname" . }}
|
||||
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:
|
||||
serviceName: {{ include "emqx.fullname" . }}-headless
|
||||
podManagementPolicy: {{ .Values.podManagementPolicy }}
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: emqx-data
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "emqx.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
spec:
|
||||
{{- if .Values.persistence.storageClassName }}
|
||||
storageClassName: {{ .Values.persistence.storageClassName | quote }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- end }}
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
{{- if .Values.minReadySeconds }}
|
||||
minReadySeconds: {{ .Values.minReadySeconds }}
|
||||
{{- end }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "emqx.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
app: {{ include "emqx.name" . }}
|
||||
version: {{ .Chart.AppVersion }}
|
||||
app.kubernetes.io/name: {{ include "emqx.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.recreatePods }}
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "emqx.serviceAccountName" . }}
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: {{ .Values.priorityClassName }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.ssl.enabled }}
|
||||
- name: ssl-cert
|
||||
secret:
|
||||
secretName: {{ include "emqx.ssl.secretName" . }}
|
||||
{{- end }}
|
||||
{{- if not .Values.persistence.enabled }}
|
||||
- name: emqx-data
|
||||
emptyDir: {}
|
||||
{{- else if .Values.persistence.existingClaim }}
|
||||
- name: emqx-data
|
||||
persistentVolumeClaim:
|
||||
{{- with .Values.persistence.existingClaim }}
|
||||
claimName: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.emqxLicenseSecretName }}
|
||||
- name: emqx-license
|
||||
secret:
|
||||
secretName: {{ .Values.emqxLicenseSecretName }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumes }}
|
||||
{{- toYaml .Values.extraVolumes | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.podSecurityContext.enabled }}
|
||||
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.initContainers }}
|
||||
initContainers:
|
||||
{{- toYaml .Values.initContainers | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: emqx
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.containerSecurityContext.enabled }}
|
||||
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: mqtt
|
||||
containerPort: {{ splitList ":" ( .Values.emqxConfig.EMQX_LISTENERS__TCP__DEFAULT__BIND | default "1883" ) | last }}
|
||||
- name: mqttssl
|
||||
containerPort: {{ splitList ":" ( .Values.emqxConfig.EMQX_LISTENERS__SSL__DEFAULT__BIND | default "8883" ) | last }}
|
||||
- name: ws
|
||||
containerPort: {{ splitList ":" ( .Values.emqxConfig.EMQX_LISTENERS__WS__DEFAULT__BIND | default "8083" ) | last }}
|
||||
- name: wss
|
||||
containerPort: {{ splitList ":" ( .Values.emqxConfig.EMQX_LISTENERS__WSS__DEFAULT__BIND | default "8084" ) | last }}
|
||||
- name: dashboard
|
||||
containerPort: {{ splitList ":" ( .Values.emqxConfig.EMQX_DASHBOARD__LISTENERS__HTTP__BIND | default "18083" ) | last }}
|
||||
{{- if not (empty .Values.emqxConfig.EMQX_DASHBOARD__LISTENERS__HTTPS__BIND) }}
|
||||
- name: dashboardtls
|
||||
containerPort: {{ splitList ":" .Values.emqxConfig.EMQX_DASHBOARD__LISTENERS__HTTPS__BIND | last }}
|
||||
{{- end }}
|
||||
- name: ekka
|
||||
containerPort: 4370
|
||||
- name: genrpc-manual
|
||||
containerPort: 5369
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "emqx.fullname" . }}-env
|
||||
{{- if .Values.envFromSecret }}
|
||||
- secretRef:
|
||||
name: {{ .Values.envFromSecret }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: emqx-data
|
||||
mountPath: "/opt/emqx/data"
|
||||
{{- if .Values.ssl.enabled }}
|
||||
- name: ssl-cert
|
||||
mountPath: /tmp/ssl
|
||||
readOnly: true
|
||||
{{- end}}
|
||||
{{ if .Values.emqxLicenseSecretName }}
|
||||
- name: emqx-license
|
||||
mountPath: "/opt/emqx/etc/emqx.lic"
|
||||
subPath: "emqx.lic"
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{- toYaml .Values.extraVolumeMounts | nindent 10 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /status
|
||||
port: {{ splitList ":" ( .Values.emqxConfig.EMQX_DASHBOARD__LISTENERS__HTTP__BIND | default "18083" ) | last }}
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
failureThreshold: 30
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /status
|
||||
port: {{ splitList ":" ( .Values.emqxConfig.EMQX_DASHBOARD__LISTENERS__HTTP__BIND | default "18083" ) | last }}
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
failureThreshold: 10
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
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 }}
|
||||
{{- if .minDomains }}
|
||||
minDomains: {{ .minDomains }}
|
||||
{{- end }}
|
||||
{{- if .matchLabelKeys }}
|
||||
matchLabelKeys:
|
||||
{{- range .matchLabelKeys }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .nodeAffinityPolicy }}
|
||||
nodeAffinityPolicy: {{ .nodeAffinityPolicy }}
|
||||
{{- end }}
|
||||
{{- if .nodeTaintsPolicy }}
|
||||
nodeTaintsPolicy: {{ .nodeTaintsPolicy }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
55
backing-services/emqx/templates/_helpers.tpl
Normal file
55
backing-services/emqx/templates/_helpers.tpl
Normal file
@@ -0,0 +1,55 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "emqx.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "emqx.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "emqx.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Get ssl secret name .
|
||||
*/}}
|
||||
{{- define "emqx.ssl.secretName" -}}
|
||||
{{- if and .Values.ssl.useExisting .Values.ssl.existingName -}}
|
||||
{{ .Values.ssl.existingName }}
|
||||
{{- else -}}
|
||||
{{ include "emqx.fullname" . }}-tls
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "emqx.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "emqx.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
19
backing-services/emqx/templates/certificate.yaml
Normal file
19
backing-services/emqx/templates/certificate.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- if and (.Values.ssl.enabled) (not .Values.ssl.useExisting) -}}
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ include "emqx.fullname" . }}-tls
|
||||
spec:
|
||||
secretName: {{ include "emqx.fullname" . }}-tls
|
||||
issuerRef:
|
||||
name: {{ default "letsencrypt-staging" .Values.ssl.issuer.name }}
|
||||
kind: {{ default "ClusterIssuer" .Values.ssl.issuer.kind }}
|
||||
{{- if .Values.ssl.commonName }}
|
||||
commonName: {{ .Values.ssl.commonName }}
|
||||
{{- end }}
|
||||
dnsNames:
|
||||
{{- range .Values.ssl.dnsnames }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
34
backing-services/emqx/templates/configmap.yaml
Normal file
34
backing-services/emqx/templates/configmap.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- if .Values.emqxConfig }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "emqx.fullname" . }}-env
|
||||
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 }}
|
||||
data:
|
||||
EMQX_NAME: {{ .Release.Name }}
|
||||
{{- if eq (.Values.emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY) "k8s" }}
|
||||
EMQX_CLUSTER__K8S__APISERVER: "https://kubernetes.default.svc:443"
|
||||
EMQX_CLUSTER__K8S__SERVICE_NAME: {{ include "emqx.fullname" . }}-headless
|
||||
EMQX_CLUSTER__K8S__NAMESPACE: {{ .Release.Namespace }}
|
||||
EMQX_CLUSTER__K8S__ADDRESS_TYPE: "hostname"
|
||||
EMQX_CLUSTER__K8S__SUFFIX: "svc.{{ .Values.clusterDomain }}"
|
||||
{{- else if eq (.Values.emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY) "dns" }}
|
||||
EMQX_CLUSTER__DNS__NAME: "{{ include "emqx.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
EMQX_CLUSTER__DNS__RECORD_TYPE: "srv"
|
||||
{{- end -}}
|
||||
{{- range $index, $value := .Values.emqxConfig }}
|
||||
{{- if $value }}
|
||||
{{- $key := (regexReplaceAllLiteral "\\." (regexReplaceAllLiteral "EMQX[_\\.]" (upper (trimAll " " $index)) "") "__") }}
|
||||
{{- if or (kindIs "map" $value) (kindIs "slice" $value) }}
|
||||
{{ print "EMQX_" $key }}: {{ tpl (printf "%q" (toJson $value)) $ }}
|
||||
{{- else }}
|
||||
{{ print "EMQX_" $key }}: "{{ tpl (printf "%v" $value) $ }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
150
backing-services/emqx/templates/ingress.yaml
Normal file
150
backing-services/emqx/templates/ingress.yaml
Normal file
@@ -0,0 +1,150 @@
|
||||
{{- if .Values.ingress.dashboard.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" .) "dashboard" }}
|
||||
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.dashboard.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.ingress.dashboard.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.dashboard.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.dashboard.ingressClassName }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $host := .Values.ingress.dashboard.hosts }}
|
||||
- host: {{ $host }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $.Values.ingress.dashboard.path | default "/" }}
|
||||
{{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ $.Values.ingress.dashboard.pathType | default "ImplementationSpecific" }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ include "emqx.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.dashboard }}
|
||||
{{- else }}
|
||||
serviceName: {{ include "emqx.fullname" $ }}
|
||||
servicePort: {{ $.Values.service.dashboard }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if .Values.ingress.dashboard.tls }}
|
||||
tls:
|
||||
{{- toYaml .Values.ingress.dashboard.tls | nindent 4 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.mqtt.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" .) "mqtt" }}
|
||||
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.mqtt.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.ingress.mqtt.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.mqtt.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.mqtt.ingressClassName }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $host := .Values.ingress.mqtt.hosts }}
|
||||
- host: {{ $host }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $.Values.ingress.mqtt.path | default "/" }}
|
||||
{{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ $.Values.ingress.mqtt.pathType | default "ImplementationSpecific" }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ include "emqx.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.mqtt }}
|
||||
{{- else }}
|
||||
serviceName: {{ include "emqx.fullname" $ }}
|
||||
servicePort: {{ $.Values.service.mqtt }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if .Values.ingress.mqtt.tls }}
|
||||
tls:
|
||||
{{- toYaml .Values.ingress.mqtt.tls | nindent 4 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.ws.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" .) "ws" }}
|
||||
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.ws.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.ingress.ws.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and .Values.ingress.ws.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
|
||||
ingressClassName: {{ .Values.ingress.ws.ingressClassName }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $host := .Values.ingress.ws.hosts }}
|
||||
- host: {{ $host }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $.Values.ingress.ws.path | default "/mqtt" }}
|
||||
{{- if (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
|
||||
pathType: {{ $.Values.ingress.ws.pathType | default "ImplementationSpecific" }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ include "emqx.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.ws }}
|
||||
{{- else }}
|
||||
serviceName: {{ include "emqx.fullname" $ }}
|
||||
servicePort: {{ $.Values.service.ws }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if .Values.ingress.ws.tls }}
|
||||
tls:
|
||||
{{- toYaml .Values.ingress.ws.tls | nindent 4 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end }}
|
||||
18
backing-services/emqx/templates/pdb.yaml
Normal file
18
backing-services/emqx/templates/pdb.yaml
Normal file
@@ -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 }}
|
||||
63
backing-services/emqx/templates/rbac.yaml
Normal file
63
backing-services/emqx/templates/rbac.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "emqx.serviceAccountName" . }}
|
||||
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 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- if eq .Values.emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY "k8s" }}
|
||||
kind: Role
|
||||
{{- if semverCompare ">=1.17-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
{{- else }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
{{- end }}
|
||||
metadata:
|
||||
namespace: {{ .Release.Namespace }}
|
||||
name: {{ include "emqx.fullname" . }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- endpoints
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- list
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- if eq .Values.emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY "k8s" }}
|
||||
kind: RoleBinding
|
||||
{{- if semverCompare ">=1.17-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
{{- else }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
{{- end }}
|
||||
metadata:
|
||||
namespace: {{ .Release.Namespace }}
|
||||
name: {{ include "emqx.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "emqx.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: {{ include "emqx.fullname" . }}
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
11
backing-services/emqx/templates/secret.yaml
Normal file
11
backing-services/emqx/templates/secret.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- if .Values.metrics.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "emqx.fullname" . }}-basic-auth
|
||||
namespace: {{ .Release.Namespace }}
|
||||
type: kubernetes.io/basic-auth
|
||||
stringData:
|
||||
username: {{ .Values.emqxConfig.EMQX_DASHBOARD__DEFAULT_USERNAME | default "admin" }}
|
||||
password: {{ .Values.emqxConfig.EMQX_DASHBOARD__DEFAULT_PASSWORD | default "public" }}
|
||||
{{- end }}
|
||||
42
backing-services/emqx/templates/service-monitor.yaml
Normal file
42
backing-services/emqx/templates/service-monitor.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
{{- if and (.Values.metrics.enabled) (eq .Values.metrics.type "prometheus") }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "emqx.fullname" . }}
|
||||
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 }}
|
||||
{{- if .Values.service.labels }}
|
||||
{{- toYaml .Values.service.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.service.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- interval: 10s
|
||||
port: dashboard
|
||||
scheme: http
|
||||
path: /api/v5/prometheus/stats
|
||||
params:
|
||||
type:
|
||||
- prometheus
|
||||
basicAuth:
|
||||
password:
|
||||
name: {{ include "emqx.fullname" . }}-basic-auth
|
||||
key: password
|
||||
username:
|
||||
name: {{ include "emqx.fullname" . }}-basic-auth
|
||||
key: username
|
||||
jobLabel: {{ .Release.Name }}-scraping
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "emqx.name" . }}
|
||||
{{- end }}
|
||||
141
backing-services/emqx/templates/service.yaml
Normal file
141
backing-services/emqx/templates/service.yaml
Normal file
@@ -0,0 +1,141 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "emqx.fullname" . }}
|
||||
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 }}
|
||||
{{- if .Values.service.labels }}
|
||||
{{- toYaml .Values.service.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.annotations }}
|
||||
annotations:
|
||||
{{- toYaml .Values.service.annotations | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
|
||||
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | default "Cluster" }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.service.type "LoadBalancer" }}
|
||||
{{- if .Values.service.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.service.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges: {{- toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.externalIPs }}
|
||||
externalIPs: {{- toYaml .Values.service.externalIPs | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: mqtt
|
||||
port: {{ .Values.service.mqtt | default 1883 }}
|
||||
protocol: TCP
|
||||
targetPort: mqtt
|
||||
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.mqtt)) }}
|
||||
nodePort: {{ .Values.service.nodePorts.mqtt }}
|
||||
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
- name: mqttssl
|
||||
port: {{ .Values.service.mqttssl | default 8883 }}
|
||||
protocol: TCP
|
||||
targetPort: mqttssl
|
||||
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.mqttssl)) }}
|
||||
nodePort: {{ .Values.service.nodePorts.mqttssl }}
|
||||
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
- name: ws
|
||||
port: {{ .Values.service.ws | default 8083 }}
|
||||
protocol: TCP
|
||||
targetPort: ws
|
||||
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.ws)) }}
|
||||
nodePort: {{ .Values.service.nodePorts.ws }}
|
||||
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
- name: wss
|
||||
port: {{ .Values.service.wss | default 8084 }}
|
||||
protocol: TCP
|
||||
targetPort: wss
|
||||
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.wss)) }}
|
||||
nodePort: {{ .Values.service.nodePorts.wss }}
|
||||
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
- name: dashboard
|
||||
port: {{ .Values.service.dashboard | default 18083 }}
|
||||
protocol: TCP
|
||||
targetPort: dashboard
|
||||
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.dashboard)) }}
|
||||
nodePort: {{ .Values.service.nodePorts.dashboard }}
|
||||
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
{{- if not (empty .Values.service.dashboardtls) }}
|
||||
- name: dashboardtls
|
||||
port: {{ .Values.service.dashboardtls }}
|
||||
protocol: TCP
|
||||
targetPort: dashboardtls
|
||||
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.dashboardtls)) }}
|
||||
nodePort: {{ .Values.service.nodePorts.dashboardtls }}
|
||||
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "emqx.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "emqx.fullname" . }}-headless
|
||||
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:
|
||||
type: ClusterIP
|
||||
sessionAffinity: None
|
||||
clusterIP: {{ .Values.service.clusterIP | default "None" }}
|
||||
publishNotReadyAddresses: true
|
||||
ports:
|
||||
- name: mqtt
|
||||
port: {{ .Values.service.mqtt | default 1883 }}
|
||||
protocol: TCP
|
||||
targetPort: mqtt
|
||||
- name: mqttssl
|
||||
port: {{ .Values.service.mqttssl | default 8883 }}
|
||||
protocol: TCP
|
||||
targetPort: mqttssl
|
||||
- name: ws
|
||||
port: {{ .Values.service.ws | default 8083 }}
|
||||
protocol: TCP
|
||||
targetPort: ws
|
||||
- name: wss
|
||||
port: {{ .Values.service.wss | default 8084 }}
|
||||
protocol: TCP
|
||||
targetPort: wss
|
||||
- name: dashboard
|
||||
port: {{ .Values.service.dashboard | default 18083 }}
|
||||
protocol: TCP
|
||||
targetPort: dashboard
|
||||
- name: ekka
|
||||
port: 4370
|
||||
protocol: TCP
|
||||
targetPort: ekka
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "emqx.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
283
backing-services/emqx/values.yaml
Normal file
283
backing-services/emqx/values.yaml
Normal file
@@ -0,0 +1,283 @@
|
||||
## Default values for emqx.
|
||||
## This is a YAML-formatted file.
|
||||
## Declare variables to be passed into your templates.
|
||||
|
||||
## It is recommended to have odd number of nodes in a cluster, otherwise the emqx cluster cannot be automatically healed in case of net-split.
|
||||
replicaCount: 3
|
||||
image:
|
||||
repository: emqx/emqx
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
# If set false, means you need create service account by yourself
|
||||
create: true
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name: ""
|
||||
# Annotations to add to the service account
|
||||
annotations: {}
|
||||
|
||||
# The name of a secret in the same kubernetes namespace which contains values to
|
||||
# be added to the environment (must be manually created)
|
||||
# This can be useful for passwords and logins, etc.
|
||||
|
||||
# envFromSecret: "emqx-secrets"
|
||||
|
||||
## Forces the recreation of pods during helm upgrades. This can be useful to update configuration values even if the container image did not change.
|
||||
recreatePods: false
|
||||
|
||||
## Sets the minReadySeconds parameter on the stateful set. This can be used to add delay between restart / updates between the single pods.
|
||||
minReadySeconds:
|
||||
|
||||
## Sets the priorityClassName parameter on the pods. This can be used to run the pods with increased priority.
|
||||
priorityClassName:
|
||||
|
||||
clusterDomain: cluster.local
|
||||
|
||||
## Custom annotations to be added to the pods
|
||||
podAnnotations: {}
|
||||
|
||||
## Custom labels to be added to the pods
|
||||
podLabels: {}
|
||||
|
||||
# Pod deployment policy
|
||||
# value: OrderedReady | Parallel
|
||||
# To redeploy a chart with existing PVC(s), the value must be set to Parallel to avoid deadlock
|
||||
podManagementPolicy: Parallel
|
||||
|
||||
persistence:
|
||||
enabled: false
|
||||
size: 20Mi
|
||||
storageClassName: ""
|
||||
accessMode: ReadWriteOnce
|
||||
## Existing PersistentVolumeClaims
|
||||
## The value is evaluated as a template
|
||||
## So, for example, the name can depend on .Release or .Chart
|
||||
# existingClaim: ""
|
||||
|
||||
resources: {}
|
||||
# limits:
|
||||
# cpu: 500m
|
||||
# memory: 512Mi
|
||||
# requests:
|
||||
# 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
|
||||
# image: busybox
|
||||
# securityContext:
|
||||
# runAsUser: 0
|
||||
# runAsGroup: 0
|
||||
# capabilities:
|
||||
# add:
|
||||
# - SYS_ADMIN
|
||||
# drop:
|
||||
# - ALL
|
||||
# command:
|
||||
# - /bin/sh
|
||||
# - -c
|
||||
# - |
|
||||
# mount -o remount rw /proc/sys
|
||||
# sysctl -w net.core.somaxconn=65535
|
||||
# sysctl -w net.ipv4.ip_local_port_range="1024 65535"
|
||||
# sysctl -w kernel.core_uses_pid=0
|
||||
# sysctl -w net.ipv4.tcp_tw_reuse=1
|
||||
# sysctl -w fs.nr_open=1000000000
|
||||
# sysctl -w fs.file-max=1000000000
|
||||
# sysctl -w net.ipv4.ip_local_port_range='1025 65534'
|
||||
# sysctl -w net.ipv4.udp_mem='74583000 499445000 749166000'
|
||||
# sysctl -w net.ipv4.tcp_max_sync_backlog=163840
|
||||
# sysctl -w net.core.netdev_max_backlog=163840
|
||||
# sysctl -w net.core.optmem_max=16777216
|
||||
# sysctl -w net.ipv4.tcp_rmem='1024 4096 16777216'
|
||||
# sysctl -w net.ipv4.tcp_wmem='1024 4096 16777216'
|
||||
# sysctl -w net.ipv4.tcp_max_tw_buckets=1048576
|
||||
# sysctl -w net.ipv4.tcp_fin_timeout=15
|
||||
# sysctl -w net.core.rmem_default=262144000
|
||||
# sysctl -w net.core.wmem_default=262144000
|
||||
# sysctl -w net.core.rmem_max=262144000
|
||||
# sysctl -w net.core.wmem_max=262144000
|
||||
# sysctl -w net.ipv4.tcp_mem='378150000 504200000 756300000'
|
||||
# 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)
|
||||
emqxConfig:
|
||||
EMQX_CLUSTER__DISCOVERY_STRATEGY: "dns"
|
||||
EMQX_DASHBOARD__DEFAULT_USERNAME: "admin"
|
||||
EMQX_DASHBOARD__DEFAULT_PASSWORD: "public"
|
||||
|
||||
## EMQX Enterprise Edition requires manual creation of a Secret containing the licensed content. Write the name of Secret to the value of "emqxLicenseSecretName"
|
||||
## Example:
|
||||
## kubectl create secret generic emqx-license-secret-name --from-file=/path/to/emqx.lic
|
||||
emqxLicenseSecretName:
|
||||
|
||||
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
|
||||
## Port for MQTT(SSL)
|
||||
##
|
||||
mqttssl: 8883
|
||||
## Port for WebSocket/HTTP
|
||||
##
|
||||
ws: 8083
|
||||
## Port for WSS/HTTPS
|
||||
##
|
||||
wss: 8084
|
||||
## Port for dashboard and API
|
||||
##
|
||||
dashboard: 18083
|
||||
## Port for dashboard and API over HTTPS
|
||||
##
|
||||
# dashboardtls: 18084
|
||||
## Specify the nodePort(s) value for the LoadBalancer and NodePort service types.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
##
|
||||
nodePorts:
|
||||
mqtt:
|
||||
mqttssl:
|
||||
mgmt:
|
||||
ws:
|
||||
wss:
|
||||
dashboard:
|
||||
dashboardtls:
|
||||
## Specifies the load balancer implementation this Service belongs to.
|
||||
## Once set, it can not be changed.
|
||||
##
|
||||
# loadBalancerClass:
|
||||
## Set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
# loadBalancerIP:
|
||||
## Load Balancer sources
|
||||
## ref: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||
## Example:
|
||||
## loadBalancerSourceRanges:
|
||||
## - 10.10.10.0/24
|
||||
##
|
||||
loadBalancerSourceRanges: []
|
||||
## Set the ExternalIPs
|
||||
##
|
||||
externalIPs: []
|
||||
## Denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints.
|
||||
## There are two available options: Cluster (default) and Local.
|
||||
## Cluster obscures the client source IP and may cause a second hop to another node, but should have good overall load-spreading.
|
||||
## Local preserves the client source IP and avoids a second hop for LoadBalancer and NodePort type Services, but risks potentially imbalanced traffic spreading.
|
||||
##
|
||||
externalTrafficPolicy: "Cluster"
|
||||
## Provide any additional annotations which may be required. Evaluated as a template
|
||||
##
|
||||
annotations: {}
|
||||
labels: {}
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
topologySpreadConstraints: []
|
||||
|
||||
ingress:
|
||||
## ingress for EMQX Dashboard
|
||||
dashboard:
|
||||
enabled: false
|
||||
# ingressClassName: nginx
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- dashboard.emqx.local
|
||||
tls: []
|
||||
## ingress for MQTT
|
||||
mqtt:
|
||||
enabled: false
|
||||
# ingressClassName: haproxy
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: haproxy
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
# haproxy-ingress.github.io/tcp-service-port: "8883"
|
||||
# haproxy-ingress.github.io/proxy-protocol: "v2"
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- mqtt.emqx.local
|
||||
tls: []
|
||||
ws:
|
||||
enabled: false
|
||||
# ingressClassName: haproxy
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: haproxy
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
# haproxy-ingress.github.io/tcp-service-port: "8883"
|
||||
# haproxy-ingress.github.io/proxy-protocol: "v2"
|
||||
path: /mqtt
|
||||
pathType: ImplementationSpecific
|
||||
hosts:
|
||||
- mqtt.emqx.local
|
||||
tls: []
|
||||
|
||||
podSecurityContext:
|
||||
enabled: true
|
||||
fsGroup: 1000
|
||||
fsGroupChangePolicy: Always
|
||||
runAsUser: 1000
|
||||
supplementalGroups:
|
||||
- 1000
|
||||
|
||||
containerSecurityContext:
|
||||
enabled: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
|
||||
metrics:
|
||||
enabled: false
|
||||
type: prometheus
|
||||
|
||||
ssl:
|
||||
enabled: false
|
||||
useExisting: false
|
||||
existingName: emqx-tls
|
||||
dnsnames: []
|
||||
commonName:
|
||||
issuer:
|
||||
name: letsencrypt-dns
|
||||
kind: ClusterIssuer
|
||||
|
||||
## Setting PodDisruptionBudget.
|
||||
## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb
|
||||
##
|
||||
pdb:
|
||||
enabled: false
|
||||
maxUnavailable: 1
|
||||
Reference in New Issue
Block a user