What is `printf` useful for in charts?
BeginnerConceptTemplating: Go Templates & Sprig
Answer
Building strings from parts with Go format verbs:
image: {{ printf "%s/%s:%s" .Values.image.registry .Values.image.repository (.Values.image.tag | default .Chart.AppVersion | toString) | quote }}
url: {{ printf "postgres://%s@%s-postgres:5432/%s" .Values.db.user .Release.Name .Values.db.name | quote }}
Mixing types breaks %s (a float renders as %!s(float64=1.1)), which is another reason to toString tags.
More on Templating: Go Templates & Sprig
What template language does Helm use?BeginnerWhat does the dot (`.`) mean in a Helm template?BeginnerWhat is `$` and when do you need it?IntermediateHow does whitespace control (`{{-` and `-}}`) work?BeginnerHow do `if`, `else if` and `else` evaluate truthiness?BeginnerWhat do `and`, `or`, `not`, `eq`, `ne`, `lt`, `gt` look like in Helm?Beginner