mirror of
https://github.com/nikdoof/helm-charts.git
synced 2025-12-13 21:42:18 +00:00
Add aaisp2mqtt
This commit is contained in:
56
charts/aaisp2mqtt/templates/_helpers.tpl
Normal file
56
charts/aaisp2mqtt/templates/_helpers.tpl
Normal file
@@ -0,0 +1,56 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "aaisp2mqtt.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 "aaisp2mqtt.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 "aaisp2mqtt.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "aaisp2mqtt.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "aaisp2mqtt.name" . }}
|
||||
helm.sh/chart: {{ include "aaisp2mqtt.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 -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "aaisp2mqtt.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "aaisp2mqtt.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
97
charts/aaisp2mqtt/templates/cronjob.yaml
Normal file
97
charts/aaisp2mqtt/templates/cronjob.yaml
Normal file
@@ -0,0 +1,97 @@
|
||||
---
|
||||
apiVersion: batch/v1beta1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: {{ include "aaisp2mqtt.fullname" . }}-cronjob
|
||||
{{- if .Values.deploymentAnnotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.deploymentAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "aaisp2mqtt.name" . }}
|
||||
helm.sh/chart: {{ include "aaisp2mqtt.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ include "aaisp2mqtt.name" . }}
|
||||
spec:
|
||||
schedule: {{ .Values.cronjob.schedule | quote }}
|
||||
successfulJobsHistoryLimit: {{ .Values.cronjob.successfulJobsHistoryLimit }}
|
||||
failedJobsHistoryLimit: {{ .Values.cronjob.failedJobsHistoryLimit }}
|
||||
concurrencyPolicy: Forbid
|
||||
{{- if .Values.cronjob.startingDeadlineSeconds }}
|
||||
startingDeadlineSeconds: {{ .Values.cronjob.startingDeadlineSeconds }}
|
||||
{{- end }}
|
||||
jobTemplate:
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "aaisp2mqtt.name" . }}
|
||||
helm.sh/chart: {{ include "aaisp2mqtt.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ include "aaisp2mqtt.name" . }}
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 16 }}
|
||||
env:
|
||||
- name: AAISP_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ default "aaisp2mqtt-secret" .Values.existingSecretName }}
|
||||
key: aaisp.username
|
||||
- name: AAISP_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ default "aaisp2mqtt-secret" .Values.existingSecretName }}
|
||||
key: aaisp.password
|
||||
- name: MQTT_BROKER
|
||||
value: {{ .Values.mqtt.broker }}
|
||||
- name: MQTT_PORT
|
||||
value: "{{ default 1883 .Values.mqtt.port }}"
|
||||
{{- if .Values.mqtt.authenticated }}
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ default "aaisp2mqtt-secret" .Values.existingSecretName }}
|
||||
key: mqtt.username
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ default "aaisp2mqtt-secret" .Values.existingSecretName }}
|
||||
key: mqtt.password
|
||||
{{- end }}
|
||||
- name: MQTT_TOPIC_PREFIX
|
||||
value: {{ default "aaisp" .Values.mqtt.topicPrefix }}
|
||||
{{- if .Values.homeassistant.enabled }}
|
||||
- name: HOMEASSISTANT_ENABLED
|
||||
value: '{{ .Values.homeassistant.enabled }}'
|
||||
{{- if .Values.homeassistant.discoveryPrefix }}
|
||||
- name: HOMEASSISTANT_DISCOVERY_PREFIX
|
||||
value: {{ .Values.homeassistant.discoveryPrefix }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 12 }}:
|
||||
{{- end }}
|
||||
20
charts/aaisp2mqtt/templates/secrets.yaml
Normal file
20
charts/aaisp2mqtt/templates/secrets.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
{{- if not (.Values.existingSecretName) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: aaisp2mqtt-secret
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "aaisp2mqtt.name" . }}
|
||||
helm.sh/chart: {{ include "aaisp2mqtt.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ include "aaisp2mqtt.name" . }}
|
||||
type: Opaque
|
||||
data:
|
||||
aaisp.username: {{ .Values.aaisp.username | b64enc }}
|
||||
aaisp.password: {{ .Values.aaisp.password | b64enc }}
|
||||
{{- if .Values.mqtt.authenticated }}
|
||||
mqtt.username: {{ .Values.mqtt.username | b64enc }}
|
||||
mqtt.password: {{ .Values.mqtt.password | b64enc }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user