Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions deploy/chart/devfile-registry/templates/_template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this format differ than the one from devfile/registry-operator#80? On the operator side the hostname is {hostName}.{ingressDomain} but here it looks like {ingressDomain}.{hostName}. Is this the case and if so does it matter or should they be identical in formatting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jdubrick The piping {{- .Values.global.ingress.domain | printf "%s.%s" $hostname -}} passes .Values.global.ingress.domain into the last argument of printf, so its still {hostName}.{ingressDomain}. I guess I could do {{- printf "%s.%s" $hostname .Values.global.ingress.domain -}} instead since the piping seems unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I was under the impression it was going first, in that case I think it's all good, the piping gets the job done I just misunderstood.

{{- 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 -}}
Expand Down
4 changes: 2 additions & 2 deletions deploy/chart/devfile-registry/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion deploy/chart/devfile-registry/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: /
Expand Down