From e460c4970b558968789f4a1d6872747d64c81edd Mon Sep 17 00:00:00 2001 From: pvannierop Date: Wed, 28 Feb 2024 15:38:28 +0100 Subject: [PATCH] Skip tls section when tls is disabled --- helmfile.d/00-init.yaml | 17 ++++++++++++++--- helmfile.d/10-base.yaml | 4 ++++ helmfile.d/20-grafana.yaml | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/helmfile.d/00-init.yaml b/helmfile.d/00-init.yaml index 76549c93..f999c884 100644 --- a/helmfile.d/00-init.yaml +++ b/helmfile.d/00-init.yaml @@ -45,10 +45,14 @@ releases: value: {{ .Values.maintainer_email }} - name: graylog.ingress.hosts values: [graylog.{{ .Values.server_name }}] + {{- $values := .Values.graylog }} + {{- $useTLS := or (not (hasKey $values ".ingress")) (not (kindIs "invalid" .Values.ingress.tls)) }} + {{- if $useTLS }} - name: graylog.ingress.tls[0].secretName value: radar-base-tls - name: graylog.ingress.tls[0].hosts values: ["graylog.{{ .Values.server_name }}"] + {{ end }} - name: fluent-bit namespace: graylog @@ -79,24 +83,31 @@ releases: value: {{ .Values.server_name }} - name: kube-prometheus-stack.prometheus.ingress.hosts values: ["prometheus.{{ .Values.server_name }}"] + - name: kube-prometheus-stack.grafana.ingress.hosts + values: ["grafana.{{ .Values.server_name }}"] + {{- $values := .Values.kube_prometheus_stack }} + {{- $useTLS := or (not (hasKey $values ".ingress")) (not (kindIs "invalid" .Values.ingress.tls)) }} + {{- if $useTLS }} - name: kube-prometheus-stack.prometheus.ingress.tls[0].secretName value: radar-base-tls-prometheus - name: kube-prometheus-stack.prometheus.ingress.tls[0].hosts values: ["prometheus.{{ .Values.server_name }}"] - - name: kube-prometheus-stack.alertmanager.ingress.hosts values: ["alertmanager.{{ .Values.server_name }}"] - name: kube-prometheus-stack.alertmanager.ingress.tls[0].secretName value: radar-base-tls-alertmanager - name: kube-prometheus-stack.alertmanager.ingress.tls[0].hosts values: ["alertmanager.{{ .Values.server_name }}"] + {{ end }} - - name: kube-prometheus-stack.grafana.ingress.hosts - values: ["grafana.{{ .Values.server_name }}"] + {{- $values := .Values.kube_prometheus_stack }} + {{- $useTLS := or (not (hasKey $values ".ingress")) (not (kindIs "invalid" .Values.ingress.tls)) }} + {{- if $useTLS }} - name: kube-prometheus-stack.grafana.ingress.tls[0].secretName value: radar-base-tls-grafana - name: kube-prometheus-stack.grafana.ingress.tls[0].hosts values: ["grafana.{{ .Values.server_name }}"] + {{ end }} - name: cert-manager namespace: cert-manager diff --git a/helmfile.d/10-base.yaml b/helmfile.d/10-base.yaml index 66cdb78f..689cbd53 100644 --- a/helmfile.d/10-base.yaml +++ b/helmfile.d/10-base.yaml @@ -57,10 +57,14 @@ releases: value: "{{ .Values.server_name }}" - name: ingress.hosts[0].paths values: ["/schema/?(.*)"] + {{- $values := .Values.cp_schema_registry }} + {{- $useTLS := or (not (hasKey $values ".ingress")) (not (kindIs "invalid" .Values.ingress.tls)) }} + {{- if $useTLS }} - name: ingress.tls[0].secretName value: radar-base-tls - name: ingress.tls[0].hosts values: ["{{ .Values.server_name }}"] + {{ end }} - name: catalog-server chart: radar/catalog-server diff --git a/helmfile.d/20-grafana.yaml b/helmfile.d/20-grafana.yaml index abc59601..ddaa8959 100644 --- a/helmfile.d/20-grafana.yaml +++ b/helmfile.d/20-grafana.yaml @@ -48,10 +48,14 @@ releases: values: ["dashboard.{{ .Values.server_name }}"] - name: "grafana\\.ini.server.root_url" value: "https://dashboard.{{ .Values.server_name }}/" + {{- $values := .Values.radar_grafana }} + {{- $useTLS := or (not (hasKey $values ".ingress")) (not (kindIs "invalid" .Values.ingress.tls)) }} + {{- if $useTLS }} - name: ingress.tls[0].secretName value: radar-base-tls-dashboard - name: ingress.tls[0].hosts values: ["dashboard.{{ .Values.server_name }}"] + {{- end }} - name: "grafana\\.ini.metrics.basic_auth_username" value: {{ .Values.grafana_metrics_username }} - name: "grafana\\.ini.metrics.basic_auth_password"