diff --git a/charts/librenms/Chart.yaml b/charts/librenms/Chart.yaml index 8097ba3..c2d5f5c 100644 --- a/charts/librenms/Chart.yaml +++ b/charts/librenms/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: librenms description: LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system. type: application -version: 4.0.3 +version: 5.0.0 appVersion: "25.4.0" maintainers: - name: jacobw diff --git a/charts/librenms/files/env b/charts/librenms/files/env deleted file mode 100644 index 5797372..0000000 --- a/charts/librenms/files/env +++ /dev/null @@ -1 +0,0 @@ -APP_KEY={{.Values.librenms.appkey}} \ No newline at end of file diff --git a/charts/librenms/files/init.sh b/charts/librenms/files/init.sh index 61b744b..933ecb3 100644 --- a/charts/librenms/files/init.sh +++ b/charts/librenms/files/init.sh @@ -1,7 +1,7 @@ #!/bin/sh TARGET="/data/env-volume/env" echo "Target: $TARGET" -cp /data/files/env $TARGET -echo -e "\nNODE_ID=`hostname`" >> $TARGET +echo "APP_KEY=$(cat /data/key/appkey)" > $TARGET +echo "NODE_ID=$(hostname)" >> $TARGET cat $TARGET diff --git a/charts/librenms/templates/_helpers.tpl b/charts/librenms/templates/_helpers.tpl index 86a780f..ad25c6c 100644 --- a/charts/librenms/templates/_helpers.tpl +++ b/charts/librenms/templates/_helpers.tpl @@ -64,3 +64,14 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Create the name of the secret to use +*/}} +{{- define "librenms.secretName" -}} +{{- if .Values.librenms.existingSecret -}} +{{- .Values.librenms.existingSecret -}} +{{- else -}} +{{- .Release.Name -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/librenms/templates/librenms-configmap.yml b/charts/librenms/templates/librenms-configmap.yml index 3692d68..1f8964a 100644 --- a/charts/librenms/templates/librenms-configmap.yml +++ b/charts/librenms/templates/librenms-configmap.yml @@ -23,7 +23,5 @@ metadata: data: custom.php: |- {{ tpl (.Files.Get "files/custom.php") . | indent 4 }} - env: |- -{{ tpl (.Files.Get "files/env") . | indent 4 }} init.sh: |- -{{ tpl (.Files.Get "files/init.sh") . | indent 4 }} \ No newline at end of file +{{ .Files.Get "files/init.sh" | indent 4 }} \ No newline at end of file diff --git a/charts/librenms/templates/librenms-deployment.yml b/charts/librenms/templates/librenms-deployment.yml index 06d2ff3..e40f402 100644 --- a/charts/librenms/templates/librenms-deployment.yml +++ b/charts/librenms/templates/librenms-deployment.yml @@ -19,6 +19,9 @@ spec: volumes: - name: env-volume emptyDir: {} + - name: key + secret: + secretName: {{ include "librenms.secretName" . }} - name: files configMap: name: {{ .Release.Name }}-files @@ -33,6 +36,8 @@ spec: volumeMounts: - name: env-volume mountPath: /data/env-volume + - name: key + mountPath: /data/key - name: files mountPath: /data/files containers: diff --git a/charts/librenms/templates/librenms-poller-ss.yml b/charts/librenms/templates/librenms-poller-ss.yml index 0061d94..b6b0392 100644 --- a/charts/librenms/templates/librenms-poller-ss.yml +++ b/charts/librenms/templates/librenms-poller-ss.yml @@ -20,6 +20,9 @@ spec: volumes: - name: env-volume emptyDir: {} + - name: key + secret: + secretName: {{ include "librenms.secretName" . }} - name: files configMap: name: {{ .Release.Name }}-files @@ -33,6 +36,8 @@ spec: volumeMounts: - name: env-volume mountPath: /data/env-volume + - name: key + mountPath: /data/key - name: files mountPath: /data/files containers: diff --git a/charts/librenms/templates/librenms-secret.yml b/charts/librenms/templates/librenms-secret.yml new file mode 100644 index 0000000..cbfd2bc --- /dev/null +++ b/charts/librenms/templates/librenms-secret.yml @@ -0,0 +1,10 @@ +{{- if not .Values.librenms.existingSecret }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }} +type: Opaque +data: + appkey: {{ .Values.librenms.appkey | b64enc | quote }} +{{- end }} \ No newline at end of file diff --git a/charts/librenms/values.yaml b/charts/librenms/values.yaml index 665949f..93793d7 100644 --- a/charts/librenms/values.yaml +++ b/charts/librenms/values.yaml @@ -12,6 +12,10 @@ librenms: # required setting. See the README for more information appkey: + # -- Existing secret name to use for appkey + # Must have the key 'appkey' as above + existingSecret: false + # -- Timezone used by librenms for communication with RRD cached timezone: UTC