From 3a4532bd2c15d3ea22a953ab46a203cbbbee0071 Mon Sep 17 00:00:00 2001 From: Michael Valdron Date: Tue, 5 Mar 2024 12:16:30 -0500 Subject: [PATCH 1/2] fix devfile registry entry name and ingress url Signed-off-by: Michael Valdron --- deploy/chart/devfile-registry/templates/_template.tpl | 9 +++++++++ deploy/chart/devfile-registry/templates/deployment.yaml | 4 ++-- deploy/chart/devfile-registry/templates/ingress.yaml | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/deploy/chart/devfile-registry/templates/_template.tpl b/deploy/chart/devfile-registry/templates/_template.tpl index 210cf98c2..4eba850a1 100644 --- a/deploy/chart/devfile-registry/templates/_template.tpl +++ b/deploy/chart/devfile-registry/templates/_template.tpl @@ -17,6 +17,15 @@ {{- .Values.hostnameOverride | default (printf "devfile-registry-%s" .Release.Namespace) -}} {{- end -}} +{{- define "devfileregistry.ingressUrl" -}} +{{- $hostname := .Values.hostnameOverride | default (printf "devfile-registry-%s" .Release.Namespace) -}} +{{- if .Values.global.tlsEnabled -}} +{{- .Values.global.ingress.domain | printf "https://%s.%s" $hostname -}} +{{- else -}} +{{- .Values.global.ingress.domain | printf "http://%s.%s" $hostname -}} +{{- end -}} +{{- end -}} + {{- define "devfileregistry.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/deploy/chart/devfile-registry/templates/deployment.yaml b/deploy/chart/devfile-registry/templates/deployment.yaml index 3f33eb369..e022151c2 100644 --- a/deploy/chart/devfile-registry/templates/deployment.yaml +++ b/deploy/chart/devfile-registry/templates/deployment.yaml @@ -142,9 +142,9 @@ spec: value: | [ { - "name": "Community", + "name": "{{ template "devfileregistry.name" . }}", "url": "http://localhost:8080", - "fqdn": "http://{{ .Release.Name }}-{{ .Release.Namespace }}.{{ .Values.global.ingress.domain }}" + "fqdn": "{{ template "devfileregistry.ingressUrl" . }}" } ] volumeMounts: diff --git a/deploy/chart/devfile-registry/templates/ingress.yaml b/deploy/chart/devfile-registry/templates/ingress.yaml index b20565097..7c54900f2 100644 --- a/deploy/chart/devfile-registry/templates/ingress.yaml +++ b/deploy/chart/devfile-registry/templates/ingress.yaml @@ -26,7 +26,7 @@ metadata: kubernetes.io/ingress.class: {{ .Values.global.ingress.class }} spec: rules: - - host: {{ template "devfileregistry.hostname" . -}} . {{- .Values.global.ingress.domain }} + - host: {{ template "devfileregistry.ingressUrl" . }} http: paths: - path: / From aafd64e600117f5066141a9d127d89195e03cf28 Mon Sep 17 00:00:00 2001 From: Michael Valdron Date: Tue, 5 Mar 2024 15:48:56 -0500 Subject: [PATCH 2/2] add ingress hostname definition without protocol for ingress spec Signed-off-by: Michael Valdron --- deploy/chart/devfile-registry/templates/_template.tpl | 5 +++++ deploy/chart/devfile-registry/templates/ingress.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/deploy/chart/devfile-registry/templates/_template.tpl b/deploy/chart/devfile-registry/templates/_template.tpl index 4eba850a1..17f79d955 100644 --- a/deploy/chart/devfile-registry/templates/_template.tpl +++ b/deploy/chart/devfile-registry/templates/_template.tpl @@ -17,6 +17,11 @@ {{- .Values.hostnameOverride | default (printf "devfile-registry-%s" .Release.Namespace) -}} {{- end -}} +{{- define "devfileregistry.ingressHostname" -}} +{{- $hostname := .Values.hostnameOverride | default (printf "devfile-registry-%s" .Release.Namespace) -}} +{{- .Values.global.ingress.domain | printf "%s.%s" $hostname -}} +{{- end -}} + {{- define "devfileregistry.ingressUrl" -}} {{- $hostname := .Values.hostnameOverride | default (printf "devfile-registry-%s" .Release.Namespace) -}} {{- if .Values.global.tlsEnabled -}} diff --git a/deploy/chart/devfile-registry/templates/ingress.yaml b/deploy/chart/devfile-registry/templates/ingress.yaml index 7c54900f2..a42df4475 100644 --- a/deploy/chart/devfile-registry/templates/ingress.yaml +++ b/deploy/chart/devfile-registry/templates/ingress.yaml @@ -26,7 +26,7 @@ metadata: kubernetes.io/ingress.class: {{ .Values.global.ingress.class }} spec: rules: - - host: {{ template "devfileregistry.ingressUrl" . }} + - host: {{ template "devfileregistry.ingressHostname" . }} http: paths: - path: /