-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from JacekZubielik/mosquitto
chore(cleanup): code
- Loading branch information
Showing
10 changed files
with
403 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v2 | ||
appVersion: 2.0.18 | ||
description: Eclipse Mosquitto MQTT | ||
name: mosquitto | ||
version: 0.0.1 | ||
type: application | ||
keywords: | ||
- mqtt | ||
- mosquitto | ||
home: https://github.com/JacekZubielik/jz-helm-charts/tree/master/charts/eclipse-mosquitto | ||
icon: https://raw.githubusercontent.com/eclipse/mosquitto/master/logo/mosquitto-logo-min.svg | ||
sources: | ||
- https://github.com/eclipse/mosquitto | ||
maintainers: | ||
- name: jacekzubielik |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "eclipse-mosquitto.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 "eclipse-mosquitto.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 "eclipse-mosquitto.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "eclipse-mosquitto.labels" -}} | ||
app.kubernetes.io/name: {{ include "eclipse-mosquitto.name" . }} | ||
helm.sh/chart: {{ include "eclipse-mosquitto.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "eclipse-mosquitto.fullname" . }}-certs | ||
labels: | ||
{{ include "eclipse-mosquitto.labels" . | indent 4 }} | ||
data: | ||
ca.crt: |- | ||
{{- .Values.certs.ca.crt | nindent 4 }} | ||
server.crt: |- | ||
{{- .Values.certs.server.crt | nindent 4 }} | ||
server.key: |- | ||
{{- .Values.certs.server.key | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "eclipse-mosquitto.fullname" . }}-config | ||
labels: | ||
{{ include "eclipse-mosquitto.labels" . | indent 4 }} | ||
data: | ||
mosquitto.conf: |- | ||
{{- .Values.config | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "eclipse-mosquitto.fullname" . }} | ||
labels: | ||
{{ include "eclipse-mosquitto.labels" . | indent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "eclipse-mosquitto.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "eclipse-mosquitto.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.securityContext.enabled }} | ||
securityContext: | ||
fsGroup: {{ .Values.securityContext.fsGroup }} | ||
runAsUser: {{ .Values.securityContext.runAsUser }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: {{ .Values.container.ports.mqtt.name }} | ||
containerPort: {{ .Values.container.ports.mqtt.port }} | ||
protocol: TCP | ||
- name: {{ .Values.container.ports.mqtts.name }} | ||
containerPort: {{ .Values.container.ports.mqtts.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
tcpSocket: | ||
port: {{ .Values.container.ports.mqtt.port }} | ||
initialDelaySeconds: 5 | ||
periodSeconds: 15 | ||
readinessProbe: | ||
tcpSocket: | ||
port: {{ .Values.container.ports.mqtt.port }} | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
volumeMounts: | ||
- name: mosquitto-conf | ||
mountPath: /mosquitto/config/mosquitto.conf | ||
subPath: mosquitto.conf | ||
readOnly: true | ||
- name: mosquitto-ca-cert | ||
mountPath: /mosquitto/config/certs/ca.crt | ||
subPath: ca.crt | ||
readOnly: true | ||
- name: mosquitto-server-cert | ||
mountPath: /mosquitto/config/certs/server.crt | ||
subPath: server.crt | ||
readOnly: true | ||
- name: mosquitto-server-key | ||
mountPath: /mosquitto/config/certs/server.key | ||
subPath: server.key | ||
readOnly: true | ||
- name: mosquitto-data | ||
mountPath: /mosquitto/data | ||
subPath: mosquitto/data | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumes: | ||
- name: mosquitto-conf | ||
configMap: | ||
name: {{ include "eclipse-mosquitto.fullname" . }}-config | ||
- name: mosquitto-ca-cert | ||
configMap: | ||
name: {{ include "eclipse-mosquitto.fullname" . }}-certs | ||
items: | ||
- key: ca.crt | ||
path: ca.crt | ||
- name: mosquitto-server-cert | ||
configMap: | ||
name: {{ include "eclipse-mosquitto.fullname" . }}-certs | ||
items: | ||
- key: server.crt | ||
path: server.crt | ||
- name: mosquitto-server-key | ||
configMap: | ||
name: {{ include "eclipse-mosquitto.fullname" . }}-certs | ||
items: | ||
- key: server.key | ||
path: server.key | ||
- name: mosquitto-data | ||
{{- if .Values.persistence.enabled }} | ||
persistentVolumeClaim: | ||
claimName: {{ include "eclipse-mosquitto.fullname" . }}-pvc | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end -}} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "eclipse-mosquitto.fullname" . -}} | ||
{{- $portName := .Values.service.ports.mqtts.name -}} | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }}-mqtt | ||
labels: | ||
{{ include "eclipse-mosquitto.labels" . | indent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
{{- range .paths }} | ||
- path: {{ . }} | ||
backend: | ||
serviceName: {{ $fullName }} | ||
servicePort: {{ $portName }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ include "eclipse-mosquitto.fullname" . }}-pvc | ||
namespace: {{ .Release.Namespace }} | ||
{{- with .Values.persistence.annotations }} | ||
annotations: | ||
{{ toYaml . | indent 4 }} | ||
{{- end }} | ||
labels: | ||
{{ include "eclipse-mosquitto.labels" . | indent 4 }} | ||
spec: | ||
accessModes: | ||
- {{ .Values.persistence.accessMode | quote }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.persistence.size | quote }} | ||
{{- if .Values.persistence.storageClass }} | ||
{{- if (eq "-" .Values.persistence.storageClass) }} | ||
storageClassName: "" | ||
{{- else }} | ||
storageClassName: "{{ .Values.persistence.storageClass }}" | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "eclipse-mosquitto.fullname" . }} | ||
labels: | ||
{{ include "eclipse-mosquitto.labels" . | indent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.ports.mqtt.port }} | ||
targetPort: {{ .Values.container.ports.mqtt.name }} | ||
protocol: TCP | ||
name: {{ .Values.service.ports.mqtt.name }} | ||
- port: {{ .Values.service.ports.mqtts.port }} | ||
targetPort: {{ .Values.container.ports.mqtts.name }} | ||
protocol: TCP | ||
name: {{ .Values.service.ports.mqtts.name }} | ||
selector: | ||
app.kubernetes.io/name: {{ include "eclipse-mosquitto.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} |
15 changes: 15 additions & 0 deletions
15
charts/eclipse-mosquitto/templates/tests/test-connection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "eclipse-mosquitto.fullname" . }}-test-connection" | ||
labels: | ||
{{ include "eclipse-mosquitto.labels" . | indent 4 }} | ||
annotations: | ||
"helm.sh/hook": test-success | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include "eclipse-mosquitto.fullname" . }}:{{ .Values.service.port }}'] | ||
restartPolicy: Never |
Oops, something went wrong.