diff --git a/deploy/chart/devfile-registry/templates/_template.tpl b/deploy/chart/devfile-registry/templates/_template.tpl index 210cf98c2..17f79d955 100644 --- a/deploy/chart/devfile-registry/templates/_template.tpl +++ b/deploy/chart/devfile-registry/templates/_template.tpl @@ -17,6 +17,20 @@ {{- .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 -}} +{{- .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..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.hostname" . -}} . {{- .Values.global.ingress.domain }} + - host: {{ template "devfileregistry.ingressHostname" . }} http: paths: - path: /