diff --git a/charts/librenms/templates/librenms-configmap.yml b/charts/librenms/templates/librenms-configmap.yml index 1f8964a..bff5c39 100644 --- a/charts/librenms/templates/librenms-configmap.yml +++ b/charts/librenms/templates/librenms-configmap.yml @@ -6,15 +6,19 @@ metadata: data: TZ: {{ .Values.librenms.timezone}} DB_TIMEOUT: "60" + RRDCACHED_SERVER: "{{ .Release.Name }}-rrdcached:42217" + {{- if .Values.redis.enabled }} REDIS_HOST: {{ .Release.Name }}-redis-master REDIS_PORT: "6379" REDIS_DB: "0" - RRDCACHED_SERVER: "{{ .Release.Name }}-rrdcached:42217" CACHE_DRIVER: redis SESSION_DRIVER: redis + {{- end }} + {{- if .Values.mysql.enabled }} DB_HOST: {{ .Release.Name }}-mysql DB_USERNAME: {{.Values.mysql.auth.username}} DB_DATABASE: {{.Values.mysql.auth.database}} + {{- end }} --- kind: ConfigMap apiVersion: v1 diff --git a/charts/librenms/templates/librenms-deployment.yml b/charts/librenms/templates/librenms-deployment.yml index e40f402..bb0f6d8 100644 --- a/charts/librenms/templates/librenms-deployment.yml +++ b/charts/librenms/templates/librenms-deployment.yml @@ -25,10 +25,12 @@ spec: - name: files configMap: name: {{ .Release.Name }}-files + {{- if .Values.mysql.enabled }} - name: mysql secret: secretName: {{ .Release.Name }}-mysql - optional: false + optional: false + {{- end }} initContainers: - name: init image: busybox:1.28 @@ -48,11 +50,13 @@ spec: - configMapRef: name: {{ .Release.Name }} env: + {{- if .Values.mysql.enabled }} - name: DB_PASSWORD valueFrom: secretKeyRef: name: {{ .Release.Name }}-mysql key: mysql-password + {{- end }} {{- with .Values.librenms.extraEnvs }} {{- toYaml . | nindent 8 }} {{- end }} @@ -63,8 +67,10 @@ spec: mountPath: /data/config/custom.php subPath: custom.php readOnly: true + {{- if .Values.mysql.enabled }} - name: mysql mountPath: "/opt/secrets/mysql/" + {{- end }} - name: env-volume mountPath: /data/.env subPath: env diff --git a/charts/librenms/templates/librenms-poller-ss.yml b/charts/librenms/templates/librenms-poller-ss.yml index b6b0392..4cb7f19 100644 --- a/charts/librenms/templates/librenms-poller-ss.yml +++ b/charts/librenms/templates/librenms-poller-ss.yml @@ -26,9 +26,11 @@ spec: - name: files configMap: name: {{ .Release.Name }}-files + {{- if .Values.mysql.enabled }} - name: mysql secret: secretName: {{ .Release.Name }}-mysql + {{- end }} initContainers: - name: init image: busybox:1.28 @@ -47,11 +49,13 @@ spec: env: - name: SIDECAR_DISPATCHER value: "1" + {{- if .Values.mysql.enabled }} - name: DB_PASSWORD valueFrom: secretKeyRef: name: {{ .Release.Name }}-mysql key: mysql-password + {{- end }} {{- with .Values.librenms.poller.extraEnvs }} {{- toYaml . | nindent 8 }} {{- end }} @@ -66,15 +70,18 @@ spec: - name: env-volume mountPath: /data/.env subPath: env + {{- if .Values.mysql.enabled }} - name: mysql mountPath: "/opt/secrets/mysql/" readOnly: true {{- if .Values.librenms.poller.resources }} resources: {{ toYaml .Values.librenms.poller.resources | nindent 10 }} {{- end }} + {{- if .Values.mysql.enabled }} readinessProbe: exec: command: ["nc", "-z", "-v", "-w1", "{{ .Release.Name }}-mysql", "3306"] initialDelaySeconds: 0 periodSeconds: 1 - failureThreshold: 3 \ No newline at end of file + failureThreshold: 3 + {{- end }} \ No newline at end of file diff --git a/charts/librenms/templates/rrdcached-deployment.yml b/charts/librenms/templates/rrdcached-deployment.yml index ba843e2..bfa4e32 100644 --- a/charts/librenms/templates/rrdcached-deployment.yml +++ b/charts/librenms/templates/rrdcached-deployment.yml @@ -27,10 +27,12 @@ spec: persistentVolumeClaim: claimName: {{ .Release.Name }}-rrdcached-journal {{end}} + {{- if .Values.mysql.enabled }} - name: mysql secret: secretName: {{ .Release.Name }}-mysql optional: false # default setting; "mysecret" must exist + {{- end }} containers: - name: rrdcached @@ -42,9 +44,11 @@ spec: mountPath: /data/db - name: journal mountPath: /data/journal + {{- if .Values.mysql.enabled }} - name: mysql mountPath: "/opt/mysql/" readOnly: true + {{- end }} {{end}} env: {{- with .Values.librenms.rrdcached.envs }}