From 76ca2ca239c079301abf6abb58031eb910e0c3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anatol=20Karalko=C5=AD?= Date: Mon, 1 Apr 2024 16:09:42 +0200 Subject: [PATCH] Don't generate ingresses if .Values.ingress.url isn't provided --- charts/brokencrystals/Chart.yaml | 2 +- charts/brokencrystals/templates/ingress.yaml | 16 ++++++++++------ charts/brokencrystals/values.yaml | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/charts/brokencrystals/Chart.yaml b/charts/brokencrystals/Chart.yaml index 7c378036..1df27f55 100644 --- a/charts/brokencrystals/Chart.yaml +++ b/charts/brokencrystals/Chart.yaml @@ -4,7 +4,7 @@ description: | Benchmark application that uses modern technologies and implements a set of common security vulnerabilities type: application -version: 0.0.66 +version: 0.0.67 keywords: - brokencrystals - brkn diff --git a/charts/brokencrystals/templates/ingress.yaml b/charts/brokencrystals/templates/ingress.yaml index c73bf9cb..eca56389 100644 --- a/charts/brokencrystals/templates/ingress.yaml +++ b/charts/brokencrystals/templates/ingress.yaml @@ -1,3 +1,4 @@ +{{- if .Values.ingress.url }} --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -7,15 +8,15 @@ metadata: annotations: nginx.ingress.kubernetes.io/proxy-ssl-protocols: "TLSv1.1 TLSv1.2" nginx.ingress.kubernetes.io/ssl-redirect: "false" - {{ if eq .Values.ingress.cert "" }} + {{- if eq .Values.ingress.cert "" }} cert-manager.io/cluster-issuer: letsencrypt-cf-prod - {{ end }} + {{- end }} spec: ingressClassName: nginx tls: - hosts: - {{ .Values.ingress.url }} - secretName: {{ if eq .Values.ingress.cert "" }}{{ include "brokencrystals.fullname" . }}-brokencrystals-secret{{ else }}{{ .Values.ingress.cert }}{{ end }} + secretName: {{- if eq .Values.ingress.cert "" }}{{ include "brokencrystals.fullname" . }}-brokencrystals-secret{{ else }}{{ .Values.ingress.cert }}{{- end }} rules: - host: {{ .Values.ingress.url }} http: @@ -27,7 +28,9 @@ spec: name: {{ .Release.Name }} port: number: 80 +{{- end }} +{{- if .Values.ingress.url }} --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -37,15 +40,15 @@ metadata: annotations: nginx.ingress.kubernetes.io/ssl-redirect: "false" nginx.ingress.kubernetes.io/proxy-ssl-protocols: "TLSv1.1 TLSv1.2" - {{ if eq .Values.ingress.cert "" }} + {{- if eq .Values.ingress.cert "" }} cert-manager.io/cluster-issuer: letsencrypt-cf-prod - {{ end }} + {{- end }} spec: ingressClassName: nginx tls: - hosts: - auth{{ .Values.ingress.authlevel }}{{ .Values.ingress.url }} - secretName: {{ if eq .Values.ingress.cert "" }}{{ include "brokencrystals.fullname" . }}-brokencrystals-keycloak-secret{{ else }}{{ .Values.ingress.cert }}{{ end }} + secretName: {{- if eq .Values.ingress.cert "" }}{{ include "brokencrystals.fullname" . }}-brokencrystals-keycloak-secret{{ else }}{{ .Values.ingress.cert }}{{- end }} rules: - host: auth{{ .Values.ingress.authlevel }}{{ .Values.ingress.url }} http: @@ -57,3 +60,4 @@ spec: name: {{ .Release.Name }}-keycloak port: number: 8080 +{{- end }} diff --git a/charts/brokencrystals/values.yaml b/charts/brokencrystals/values.yaml index f38238c3..c1a852fa 100644 --- a/charts/brokencrystals/values.yaml +++ b/charts/brokencrystals/values.yaml @@ -1,5 +1,5 @@ ingress: - url: k3s.brokencrystals.nexploit.app + url: cert: "" authlevel: "." images: