Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kubernetes): install mosquitto MQTT broker #211

Merged
merged 1 commit into from
Jan 9, 2024
Merged

Conversation

martinohmann
Copy link
Owner

No description provided.

@github-actions github-actions bot added the area/kubernetes Changes made in the kubernetes directory label Jan 9, 2024
Copy link

github-actions bot commented Jan 9, 2024

--- HelmRelease: default/mosquitto Service: default/mosquitto

+++ HelmRelease: default/mosquitto Service: default/mosquitto

@@ -0,0 +1,25 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: mosquitto
+  labels:
+    app.kubernetes.io/instance: mosquitto
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: mosquitto
+    app.kubernetes.io/service: mosquitto
+  annotations:
+    external-dns.alpha.kubernetes.io/hostname: mosquitto.18b.haus
+    io.cilium/lb-ipam-ips: 192.168.40.250
+spec:
+  type: LoadBalancer
+  ports:
+  - port: 1883
+    targetPort: 1883
+    protocol: TCP
+    name: http
+  selector:
+    app.kubernetes.io/component: main
+    app.kubernetes.io/instance: mosquitto
+    app.kubernetes.io/name: mosquitto
+
--- HelmRelease: default/mosquitto Deployment: default/mosquitto

+++ HelmRelease: default/mosquitto Deployment: default/mosquitto

@@ -0,0 +1,114 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: mosquitto
+  labels:
+    app.kubernetes.io/component: main
+    app.kubernetes.io/instance: mosquitto
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: mosquitto
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: main
+      app.kubernetes.io/name: mosquitto
+      app.kubernetes.io/instance: mosquitto
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: main
+        app.kubernetes.io/instance: mosquitto
+        app.kubernetes.io/name: mosquitto
+    spec:
+      enableServiceLinks: true
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      securityContext:
+        fsGroup: 568
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 568
+        runAsNonRoot: true
+        runAsUser: 568
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      initContainers:
+      - args:
+        - cp /tmp/secret/* /mosquitto/external_config/ && mosquitto_passwd -U /mosquitto/external_config/mosquitto_passwd
+        command:
+        - /bin/sh
+        - -c
+        image: docker.io/library/eclipse-mosquitto:2.0.18@sha256:8c49a0fab9a1ee9bf5d229061eec4e279f04484c07f60c85c13821788360ce4f
+        name: init-config
+        volumeMounts:
+        - mountPath: /data
+          name: config
+        - mountPath: /mosquitto/external_config
+          name: external-config
+        - mountPath: /tmp/secret
+          name: secret-file
+      containers:
+      - image: docker.io/library/eclipse-mosquitto:2.0.18@sha256:8c49a0fab9a1ee9bf5d229061eec4e279f04484c07f60c85c13821788360ce4f
+        livenessProbe:
+          failureThreshold: 3
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          tcpSocket:
+            port: 1883
+          timeoutSeconds: 1
+        name: main
+        readinessProbe:
+          failureThreshold: 3
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          tcpSocket:
+            port: 1883
+          timeoutSeconds: 1
+        resources:
+          limits:
+            memory: 20Mi
+          requests:
+            cpu: 10m
+            memory: 15Mi
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        startupProbe:
+          failureThreshold: 30
+          initialDelaySeconds: 0
+          periodSeconds: 5
+          tcpSocket:
+            port: 1883
+          timeoutSeconds: 1
+        volumeMounts:
+        - mountPath: /data
+          name: config
+        - mountPath: /mosquitto/config/mosquitto.conf
+          name: config-file
+          subPath: mosquitto.conf
+        - mountPath: /mosquitto/external_config
+          name: external-config
+      volumes:
+      - name: config
+        persistentVolumeClaim:
+          claimName: mosquitto
+      - configMap:
+          name: mosquitto
+        name: config-file
+      - emptyDir: {}
+        name: external-config
+      - name: secret-file
+        secret:
+          secretName: mosquitto
+

Copy link

github-actions bot commented Jan 9, 2024

--- kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/mosquitto

+++ kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/mosquitto

@@ -0,0 +1,34 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: mosquitto
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: mosquitto
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  interval: 30m
+  path: ./kubernetes/apps/default/mosquitto/app
+  postBuild:
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-settings
+    - kind: Secret
+      name: cluster-secrets
+  prune: true
+  retryInterval: 1m
+  sourceRef:
+    kind: GitRepository
+    name: home-kubernetes
+  targetNamespace: default
+  timeout: 5m
+  wait: false
+
--- kubernetes/apps/default/mosquitto/app Kustomization: flux-system/mosquitto PersistentVolumeClaim: default/mosquitto

+++ kubernetes/apps/default/mosquitto/app Kustomization: flux-system/mosquitto PersistentVolumeClaim: default/mosquitto

@@ -0,0 +1,18 @@

+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  labels:
+    app.kubernetes.io/name: mosquitto
+    kustomize.toolkit.fluxcd.io/name: mosquitto
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: mosquitto
+  namespace: default
+spec:
+  accessModes:
+  - ReadWriteMany
+  resources:
+    requests:
+      storage: 200Mi
+  storageClassName: longhorn
+
--- kubernetes/apps/default/mosquitto/app Kustomization: flux-system/mosquitto HelmRelease: default/mosquitto

+++ kubernetes/apps/default/mosquitto/app Kustomization: flux-system/mosquitto HelmRelease: default/mosquitto

@@ -0,0 +1,107 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2beta2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: mosquitto
+    kustomize.toolkit.fluxcd.io/name: mosquitto
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: mosquitto
+  namespace: default
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s
+        namespace: flux-system
+      version: 2.4.0
+  dependsOn:
+  - name: longhorn
+    namespace: longhorn-system
+  install:
+    remediation:
+      retries: 3
+  interval: 30m
+  uninstall:
+    keepHistory: false
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+  values:
+    controllers:
+      main:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          main:
+            image:
+              repository: docker.io/library/eclipse-mosquitto
+              tag: 2.0.18@sha256:8c49a0fab9a1ee9bf5d229061eec4e279f04484c07f60c85c13821788360ce4f
+            resources:
+              limits:
+                memory: 20Mi
+              requests:
+                cpu: 10m
+                memory: 15Mi
+            securityContext:
+              allowPrivilegeEscalation: false
+              capabilities:
+                drop:
+                - ALL
+              readOnlyRootFilesystem: true
+        initContainers:
+          init-config:
+            args:
+            - cp /tmp/secret/* /mosquitto/external_config/ && mosquitto_passwd -U
+              /mosquitto/external_config/mosquitto_passwd
+            command:
+            - /bin/sh
+            - -c
+            image:
+              repository: docker.io/library/eclipse-mosquitto
+              tag: 2.0.18@sha256:8c49a0fab9a1ee9bf5d229061eec4e279f04484c07f60c85c13821788360ce4f
+        pod:
+          securityContext:
+            fsGroup: 568
+            fsGroupChangePolicy: OnRootMismatch
+            runAsGroup: 568
+            runAsNonRoot: true
+            runAsUser: 568
+    persistence:
+      config:
+        enabled: true
+        existingClaim: mosquitto
+        globalMounts:
+        - path: /data
+      config-file:
+        advancedMounts:
+          main:
+            main:
+            - path: /mosquitto/config/mosquitto.conf
+              subPath: mosquitto.conf
+        name: mosquitto
+        type: configMap
+      external-config:
+        globalMounts:
+        - path: /mosquitto/external_config
+        type: emptyDir
+      secret-file:
+        advancedMounts:
+          main:
+            init-config:
+            - path: /tmp/secret
+        name: mosquitto
+        type: secret
+    service:
+      main:
+        annotations:
+          external-dns.alpha.kubernetes.io/hostname: mosquitto.18b.haus
+          io.cilium/lb-ipam-ips: 192.168.40.250
+        ports:
+          http:
+            port: 1883
+        type: LoadBalancer
+
--- kubernetes/apps/default/mosquitto/app Kustomization: flux-system/mosquitto ConfigMap: default/mosquitto

+++ kubernetes/apps/default/mosquitto/app Kustomization: flux-system/mosquitto ConfigMap: default/mosquitto

@@ -0,0 +1,24 @@

+---
+apiVersion: v1
+data:
+  mosquitto.conf: |
+    per_listener_settings false
+    listener 1883
+    allow_anonymous false
+    persistence true
+    persistence_location /data
+    autosave_interval 1800
+    connection_messages false
+    autosave_interval 60
+    password_file /mosquitto/external_config/mosquitto_passwd
+kind: ConfigMap
+metadata:
+  annotations:
+    kustomize.toolkit.fluxcd.io/substitute: disabled
+  labels:
+    app.kubernetes.io/name: mosquitto
+    kustomize.toolkit.fluxcd.io/name: mosquitto
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: mosquitto
+  namespace: default
+

@martinohmann martinohmann merged commit 4c9b7da into main Jan 9, 2024
4 checks passed
@martinohmann martinohmann deleted the mosquitto branch January 9, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Changes made in the kubernetes directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant