From 0e9e681ed53a51f63428d94f3a759747d23d725e Mon Sep 17 00:00:00 2001 From: Martyn Ranyard Date: Tue, 14 Nov 2023 15:22:11 +0100 Subject: [PATCH] Mosquitto Signed-off-by: Martyn Ranyard --- apps-kustomized/mosquitto/configmap.yaml | 15 ++++++ apps-kustomized/mosquitto/deploy.yaml | 69 ++++++++++++++++++++++++ apps-kustomized/mosquitto/sa.yaml | 7 +++ apps-kustomized/mosquitto/service.yaml | 20 +++++++ everything-app/mosquitto.yaml | 17 ++++++ 5 files changed, 128 insertions(+) create mode 100644 apps-kustomized/mosquitto/configmap.yaml create mode 100644 apps-kustomized/mosquitto/deploy.yaml create mode 100644 apps-kustomized/mosquitto/sa.yaml create mode 100644 apps-kustomized/mosquitto/service.yaml create mode 100644 everything-app/mosquitto.yaml diff --git a/apps-kustomized/mosquitto/configmap.yaml b/apps-kustomized/mosquitto/configmap.yaml new file mode 100644 index 0000000..5ed67c8 --- /dev/null +++ b/apps-kustomized/mosquitto/configmap.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +data: + mosquitto.conf: | + persistence true + persistence_location /mosquitto/data/ + log_dest stdout + listener 1883 + listener 9090 + protocol websockets +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/name: mosquitto + name: mosquitto + namespace: mosquitto diff --git a/apps-kustomized/mosquitto/deploy.yaml b/apps-kustomized/mosquitto/deploy.yaml new file mode 100644 index 0000000..f54a9d0 --- /dev/null +++ b/apps-kustomized/mosquitto/deploy.yaml @@ -0,0 +1,69 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/name: mosquitto + name: mosquitto + namespace: mosquitto +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/name: mosquitto + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + app.kubernetes.io/name: mosquitto + spec: + containers: + - image: eclipse-mosquitto:1.6.12 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 5 + periodSeconds: 1 + successThreshold: 1 + tcpSocket: + port: websocket + timeoutSeconds: 1 + name: mosquitto + ports: + - containerPort: 1883 + name: mqtt + protocol: TCP + - containerPort: 9090 + name: websocket + protocol: TCP + readinessProbe: + failureThreshold: 3 + initialDelaySeconds: 3 + periodSeconds: 3 + successThreshold: 1 + tcpSocket: + port: websocket + timeoutSeconds: 1 + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /mosquitto/config/mosquitto.conf + name: config + subPath: mosquitto.conf + - mountPath: /mosquitto/data + name: data + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccount: mosquitto + serviceAccountName: mosquitto + terminationGracePeriodSeconds: 30 + volumes: + - configMap: + defaultMode: 420 + name: mosquitto + name: config + - name: data diff --git a/apps-kustomized/mosquitto/sa.yaml b/apps-kustomized/mosquitto/sa.yaml new file mode 100644 index 0000000..de41592 --- /dev/null +++ b/apps-kustomized/mosquitto/sa.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/name: mosquitto + name: mosquitto + namespace: mosquitto diff --git a/apps-kustomized/mosquitto/service.yaml b/apps-kustomized/mosquitto/service.yaml new file mode 100644 index 0000000..2884f10 --- /dev/null +++ b/apps-kustomized/mosquitto/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/name: mosquitto + annotations: + external-dns.alpha.kubernetes.io/hostname: mosquitto.martyn.berlin + name: mosquitto + namespace: mosquitto +spec: + ports: + - name: mqtt + port: 1883 + targetPort: mqtt + - name: websocket + port: 9090 + targetPort: websocket + selector: + app.kubernetes.io/name: mosquitto + type: LoadBalancer diff --git a/everything-app/mosquitto.yaml b/everything-app/mosquitto.yaml new file mode 100644 index 0000000..c9de96a --- /dev/null +++ b/everything-app/mosquitto.yaml @@ -0,0 +1,17 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: mosquitto + namespace: argocd +spec: + destination: + namespace: mosquitto + server: https://kubernetes.default.svc + project: apps + source: + path: apps-kustomized/mosquitto + repoURL: https://git.martyn.berlin/martyn/infra4talos + targetRevision: HEAD + syncPolicy: + automated: + selfHeal: true