最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

helmfile - Helm-chart template convert to uppercase - Stack Overflow

matteradmin4PV0评论

Is there a way to use the same _helper.tpl function and convert in to upper/lower whithin the helm-chart yaml files?

_helper.tpl:

{{- define "hostnameparts.name" -}}
  {{$hostnameparts := "hostname" -}}
  {{- $joinedHostname := join "-" $hostnameparts  -}}
  {{- printf "%s" $joinedHostname -}}
{{- end -}}

helm-chart yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "hostnameparts.name" . }}
  labels:
    host.upper: {{ template "hostnameparts.name" . }}
    host.lower: {{ template "hostnameparts.name" . }}

I tried to use without any luck:

{{ upper template "hostnameparts.name" . }}
{{ template "hostnameparts.name" . | upper }}

helm template . errors:

Error: parse error at (deployment.yaml:xx): unexpected <template> in operand
Error: parse error at (deployment.yaml:xx): unexpected <template> in parenthesized pipeline
Post a comment

comment list (0)

  1. No comments so far