Conversation
| {{- if .Values.service.name }} | ||
| name: {{ .Values.service.name }} | ||
| {{- else }} |
There was a problem hiding this comment.
Alternatively, I think this could be written as:
| {{- if .Values.service.name }} | |
| name: {{ .Values.service.name }} | |
| {{- else }} | |
| name: {{ .Values.service.name | default template "docker-registry.fullname" . }} |
There was a problem hiding this comment.
This works with include instead of template, and some extra parens:
| {{- if .Values.service.name }} | |
| name: {{ .Values.service.name }} | |
| {{- else }} | |
| name: {{ .Values.service.name | default (include "docker-registry.fullname" .) }} |
I found a nice reference about template vs. include here: https://stackoverflow.com/a/71091339
There was a problem hiding this comment.
@perangel Nice catch, this is a much needed feature! I left a suggestion that I've tested locally and confirmed works for me.
If that suggestion looks good to you, please apply it and we can get this merged in 👍
Edit: we do also need to make that change anywhere the service name is referenced, for example from the ingress resource.
| {{- if .Values.service.name }} | ||
| name: {{ .Values.service.name }} | ||
| {{- else }} |
There was a problem hiding this comment.
This works with include instead of template, and some extra parens:
| {{- if .Values.service.name }} | |
| name: {{ .Values.service.name }} | |
| {{- else }} | |
| name: {{ .Values.service.name | default (include "docker-registry.fullname" .) }} |
I found a nice reference about template vs. include here: https://stackoverflow.com/a/71091339
Problem
It would be useful to be able to specify the service name and not rely on the
fullname(which requires usingfullnameOverrideto set).While
service.nameis defined in thevalues.yaml, it is not referenced anywhere.Proposed Solution
service.nameto""and add anif/elseconditional in the service template that will allow you to specify the service name.