helm chart函数

Elasticsearch 报错 error At least one unigram is required but all tokens were ngrams 【代码】Elasticsearch 报错 error At least one unigram is required but all tokens were ngrams。 阅读详情

 欢迎关注我的公众号:

 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:

istio多集群探秘,部署了50次多集群后我得出的结论

istio多集群链路追踪,附实操视频

istio防故障利器,你知道几个,istio新手不要读,太难!

istio业务权限控制,原来可以这么玩

istio实现非侵入压缩,微服务之间如何实现压缩

不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限

不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs

不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了

不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization

不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs

不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs

不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr

不懂envoyfilter也敢说精通istio系列-08-连接池和断路器

不懂envoyfilter也敢说精通istio系列-09-http-route filter

不懂envoyfilter也敢说精通istio系列-network filter-redis proxy

不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager

不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册

 


————————————————

_helper.tpl:

[root@master01 test]# cat templates/_helpers.tpl 
{{- define "mychart.labels" }}
  labels:
    generator: helm
    date: {{ now | htmlDate }}
{{- end }}
{{- define "mychart.app" -}}
app_name: {{ .Chart.Name }}
app_version: "{{.Chart.Version}}+{{now|htmlDate}}"
{{- end -}}
{{- define "namespace" -}}
    namespace: {{.Release.Namespace}}
{{- end -}}

{{- define "harbor.tplValue" -}}
    {{- if typeIs "string" .value -}}
        {{- tpl .value .context -}}
    {{- else -}}
        {{- tpl (.value | toYaml) .context -}}
    {{- end -}}
{{- end -}}

values.yaml

[root@master01 test]# cat values.yaml 
favorite:
  food: rice
  drink: coffee
  fruit:  
pizzaToppings:
  - mushrooms
  - cheese
  - peppers
  - onions 
global:
  salad: caesar
resources:
  resources:
    limits:
      cpu: 100m
      memory: 128Mi
    requests:
      cpu: 100m
hostPorts:
  http: 10
  https: 11
containerPort:
  http: 80
  https: 81
minReplicas: "1"
maxReplicas: 5
rules:
- rule1: aa
- rule2: bb
tcp: "{{.Values.maxReplicas}}"
template: "{{ .Values.name }}"
name: "Tom"
password: http://a.com/?id=123456
tag: 1.10.0-debiansha256:sss
tag2: 1.10.0-debian-9-r30
url: http://www.baidu.com
debug: true
snake: sharedBuffers
path: /etc/fstable/aa
json:
  aa: bb
  cc: dd
testYaml: | 
  containers:
    name: a
    image: b
jsonTemp: |
  {"aa":"bb","cc":"dd"}
html: |
    段落
camel: my_name_is_mark 
shuffle: mynameismark
[root@master01 test]# cat templates/if.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  myvalue: "Hello World"
  {{- if eq .Values.favorite.drink "coffee"}}
  mug: true
  {{- end}}

[root@master01 test]# helm template . --show-only templates/if.yaml
---
# Source: test/templates/if.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  myvalue: "Hello World"
  mug: true
[root@master01 test]# cat templates/ifelse.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  myvalue: "Hello World"
  {{- if eq .Values.favorite.drink "tea"}}
  mug: true
  {{- else}}
  mug: false
  {{- end}}

[root@master01 test]# helm template . --show-only templates/ifelse.yaml
---
# Source: test/templates/ifelse.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  myvalue: "Hello World"
  mug: false
[root@master01 test]# cat templates/with.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  myvalue: "Hello World"
  {{- with .Values.favorite }}
  drink: {{ .drink | default "tea" | quote }}
  food: {{ .food | upper | quote }}
  {{- end }}

[root@master01 test]# helm template . --show-only templates/with.yaml
---
# Source: test/templates/with.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  myvalue: "Hello World"
  drink: "coffee"
  food: "RICE"
[root@master01 test]# cat templates/range.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  myvalue: "Hello World"
  toppings: |-
    {{- range .Values.pizzaToppings }}
    - {{ . }}
    {{- end }}
    {{- range $key, $val := .Values.favorite }}
    {{ $key }}: {{ $val | quote }}
    {{- end}}

[root@master01 test]# helm template . --show-only templates/range.yaml
---
# Source: test/templates/range.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  myvalue: "Hello World"
  toppings: |-
    - mushrooms
    - cheese
    - peppers
    - onions
    drink: "coffee"
    food: "rice"
    fruit:
[root@master01 test]# cat templates/and.yaml 
{{- if and (gt 5 1)  (lt 3 10)}}
and: true
{{- end}}

[root@master01 test]# helm template . --show-only templates/and.yaml
---
# Source: test/templates/and.yaml
and: true
[root@master01 test]# cat templates/html.yaml 
html: |
  {{html "<html><head><title>title</title></head></html>"}}
[root@master01 test]# helm template . --show-only templates/html.yaml
---
# Source: test/templates/html.yaml
html: |
  &lt;html&gt;&lt;head&gt;&lt;title&gt;title&lt;/title&gt;&lt;/head&gt;&lt;/html&gt;
[root@master01 test]# cat templates/index.yaml 
{{- $hostPorts:=.Values.hostPorts -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Release.Name}}-configmap
data:
  {{- range $name,$value := .Values.containerPort }}
  {{$name}}: {{index $hostPorts $name|default $value}}
  {{- end}}
[root@master01 test]# helm template . --show-only templates/index.yaml
---
# Source: test/templates/index.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  http: 10
  https: 11
[root@master01 test]# cat templates/slice.yaml 
{{$li:=list 1 2 4}}
slice: {{slice $li 0 1}}
[root@master01 test]# helm template . --show-only templates/slice.yaml
---
# Source: test/templates/slice.yaml
slice: [1]
[root@master01 test]# cat templates/js.yaml 
js: {{js "<script>var a=1;var b=a+1;</script>"}}
[root@master01 test]# helm template . --show-only templates/js.yaml
---
# Source: test/templates/js.yaml
js: \x3Cscript\x3Evar a=1;var b=a+1;\x3C/script\x3E
[root@master01 test]# cat templates/len.yaml 
len: {{len .Values.name}}
[root@master01 test]# helm template . --show-only templates/len.yaml
---
# Source: test/templates/len.yaml
len: 3
[root@master01 test]# cat templates/not.yaml 
{{- if not (gt 1 2)}}
not: true
{{- end}}
[root@master01 test]# helm template . --show-only templates/not.yaml
---
# Source: test/templates/not.yaml
not: true
[root@master01 test]# cat templates/or.yaml 
{{- if or (gt 1 2) (lt 1 2)}}
or: true
{{- end}}
[root@master01 test]# helm template . --show-only templates/or.yaml
---
# Source: test/templates/or.yaml
or: true
[root@master01 test]# cat templates/print.yaml 
apiVersion: v1
kind: ConfigMap
matadata:
  name: {{.Release.Name}}-configMap
data:
  {{- $name:=.Release.Name}}
  name: {{- print $name| trimSuffix "-" -}}
[root@master01 test]# helm template . --show-only templates/print.yaml
---
# Source: test/templates/print.yaml
apiVersion: v1
kind: ConfigMap
matadata:
  name: RELEASE-NAME-configMap
data:
  name:RELEASE-NAME
[root@master01 test]# cat templates/printf.yaml 
apiVersion: v1
kind: ConfigMap
matadata:
  name: {{.Release.Name}}-configmap
data:
  food: {{- printf "%s-%s" .Release.Name .Values.favorite.food|indent 1}}
[root@master01 test]# helm template . --show-only templates/printf.yaml
---
# Source: test/templates/printf.yaml
apiVersion: v1
kind: ConfigMap
matadata:
  name: RELEASE-NAME-configmap
data:
  food: RELEASE-NAME-rice
[root@master01 test]# cat templates/println.yaml 
println: |
  {{println "aaa"}}
bb: cc
[root@master01 test]# helm template . --show-only templates/println.yaml
---
# Source: test/templates/println.yaml
println: |
  aaa

bb: cc
[root@master01 test]# cat templates/urlquery.yaml 
apiVersion: v1
kind: ConfigMap
matadata: 
  name: {{.Release.Name}}-configmap
data:
  password: {{.Values.password|urlquery}}
[root@master01 test]# helm template . --show-only templates/urlquery.yaml
---
# Source: test/templates/urlquery.yaml
apiVersion: v1
kind: ConfigMap
matadata: 
  name: RELEASE-NAME-configmap
data:
  password: http%3A%2F%2Fa.com%2F%3Fid%3D123456
[root@master01 test]# cat templates/eq.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Release.Name}}-configmap
data:
  {{- if eq .Values.favorite.food "rice"}}
  like:|
    i like rice.
  {{- end}}
[root@master01 test]# helm template . --show-only templates/eq.yaml
---
# Source: test/templates/eq.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  like:|
    i like rice.
[root@master01 test]# cat templates/ge.yaml 
ge: {{ge 1 2}}
[root@master01 test]# helm template . --show-only templates/ge.yaml
---
# Source: test/templates/ge.yaml
ge: false
[root@master01 test]# cat templates/gt.yaml 
gt: {{gt 4 1}}
[root@master01 test]# helm template . --show-only templates/gt.yaml
---
# Source: test/templates/gt.yaml
gt: true
[root@master01 test]# cat templates/le.yaml 
le: {{le 1 3}}
[root@master01 test]# helm template . --show-only templates/le.yaml
---
# Source: test/templates/le.yaml
le: true
[root@master01 test]# cat templates/lt.yaml 
lt: {{lt  1 3}}
[root@master01 test]# helm template . --show-only templates/lt.yaml
---
# Source: test/templates/lt.yaml
lt: true
[root@master01 test]# cat templates/ne.yaml 
ne: {{ne 1 3}}
[root@master01 test]# helm template . --show-only templates/ne.yaml
---
# Source: test/templates/ne.yaml
ne: true
[root@master01 test]# cat templates/hello.yaml 
hello: {{hello}}
[root@master01 test]# helm template . --show-only templates/hello.yaml
---
# Source: test/templates/hello.yaml
hello: Hello!
[root@master01 test]# cat templates/ago.yaml 
ago: {{ago now}}
[root@master01 test]# helm template . --show-only templates/ago.yaml
---
# Source: test/templates/ago.yaml
ago: 0s
[root@master01 test]# cat templates/date.yaml 
date: {{date "2006-01-02 03:04:05Z" (now) }}
[root@master01 test]# helm template . --show-only templates/date.yaml
---
# Source: test/templates/date.yaml
date: 2020-04-06 11:58:38Z
[root@master01 test]# cat templates/dateInZone.yaml 
dateInZone: {{dateInZone "2006-01-02-03:04:05Z" (now) "UTC"| quote }}
[root@master01 test]# helm template . --show-only templates/dateInZone.yaml
---
# Source: test/templates/dateInZone.yaml
dateInZone: "2020-04-06-03:59:32Z"
[root@master01 test]# cat templates/dateModify.yaml 
dateModify: {{now | date_modify "-1.5h"}}
[root@master01 test]# helm template . --show-only templates/dateModify.yaml
---
# Source: test/templates/dateModify.yaml
dateModify: 2020-04-06 10:30:31.147844281 +0800 CST m=-5397.099595550
[root@master01 test]# cat templates/durationRound.yaml 
durationRound: {{durationRound "200s"}}
[root@master01 test]# helm template . --show-only templates/durationRound.yaml
---
# Source: test/templates/durationRound.yaml
durationRound: 3m
[root@master01 test]# cat templates/htmlDate.yaml 
htmlDate: {{now|htmlDate}}
[root@master01 test]# helm template . --show-only templates/htmlDate.yaml
---
# Source: test/templates/htmlDate.yaml
htmlDate: 2020-04-06
[root@master01 test]# cat templates/htmlDateInZone.yaml 
htmlDateInZone: {{htmlDateInZone now "UTC"}}
[root@master01 test]# helm template . --show-only templates/htmlDateInZone.yaml
---
# Source: test/templates/htmlDateInZone.yaml
htmlDateInZone: 2020-04-06
[root@master01 test]# cat templates/mustDateModify.yaml 
mustDateModify: {{mustDateModify "100s" now}}
[root@master01 test]# helm template . --show-only templates/mustDateModify.yaml
---
# Source: test/templates/mustDateModify.yaml
mustDateModify: 2020-04-06 12:05:50.552467524 +0800 CST m=+100.080912388
[root@master01 test]# cat templates/mustToDate.yaml 
mustToDate: {{mustToDate "2006-01-02 03:04:05" "2020-03-20 12:16:10" }}
[root@master01 test]# helm template . --show-only templates/mustToDate.yaml
---
# Source: test/templates/mustToDate.yaml
mustToDate: 2020-03-20 12:16:10 +0800 CST
[root@master01 test]# cat templates/now.yaml 
now: {{now}}
[root@master01 test]# helm template . --show-only templates/now.yaml
---
# Source: test/templates/now.yaml
now: 2020-04-06 12:06:25.914297532 +0800 CST m=+0.098940471
[root@master01 test]# cat templates/toDate.yaml 
toDate: {{toDate "2006-01-02 03:04:05" "2020-03-20 12:16:10" }}
[root@master01 test]# helm template . --show-only templates/toDate.yaml
---
# Source: test/templates/toDate.yaml
toDate: 2020-03-20 12:16:10 +0800 CST
[root@master01 test]# cat templates/unixEpoch.yaml 
unixEpoch: {{unixEpoch now}}
[root@master01 test]# helm template . --show-only templates/unixEpoch.yaml
---
# Source: test/templates/unixEpoch.yaml
unixEpoch: 1586146082
[root@master01 test]# cat templates/abbrev.yaml 
abbrev: {{"thisismark"|abbrev 5}}
[root@master01 test]# helm template . --show-only templates/abbrev.yaml
---
# Source: test/templates/abbrev.yaml
abbrev: th...
[root@master01 test]# cat templates/abbrevboth.yaml 
abbrevboth: {{"mynameismarkhimarkhowareyou"|abbrevboth 5 10}}
[root@master01 test]# helm template . --show-only templates/abbrevboth.yaml
---
# Source: test/templates/abbrevboth.yaml
abbrevboth: ...eism...
[root@master01 test]# cat templates/trunc.yaml 
apiVersion: v1
kind: ConfigMap
matadata:
  name: {{.Release.Name|trunc 2}}-configmap

[root@master01 test]# helm template . --show-only templates/trunc.yaml
---
# Source: test/templates/trunc.yaml
apiVersion: v1
kind: ConfigMap
matadata:
  name: RE-configmap
[root@master01 test]# cat templates/trim.yaml 
trim: {{"   a b c "|trim}}
[root@master01 test]# helm template . --show-only templates/trim.yaml
---
# Source: test/templates/trim.yaml
trim: a b c

[root@master01 test]# cat templates/upper.yaml 
name: {{.Values.name|upper}}
[root@master01 test]# helm template . --show-only templates/upper.yaml
---
# Source: test/templates/upper.yaml
name: TOM
[root@master01 test]# cat templates/lower.yaml 
lower: {{lower "ABC"}}
[root@master01 test]# helm template . --show-only templates/lower.yaml
---
# Source: test/templates/lower.yaml
lower: abc
[root@master01 test]# cat templates/title.yaml 
title: {{"my name is mark"|title}}
[root@master01 test]# helm template . --show-only templates/title.yaml
---
# Source: test/templates/title.yaml
title: My Name Is Mark
[root@master01 test]# cat templates/untitle.yaml 
untitle: {{"My Name is mark"|untitle}}
[root@master01 test]# helm template . --show-only templates/untitle.yaml
---
# Source: test/templates/untitle.yaml
untitle: my name is mark
[root@master01 test]# cat templates/substr.yaml 
substr: {{"thisisastring"|substr 1 10 }}
[root@master01 test]# helm template . --show-only templates/substr.yaml
---
# Source: test/templates/substr.yaml
substr: hisisastr
[root@master01 test]# cat templates/repeat.yaml 
repeat: {{"mark"|repeat 5}}
[root@master01 test]# helm template . --show-only templates/repeat.yaml
---
# Source: test/templates/repeat.yaml
repeat: markmarkmarkmarkmark
[root@master01 test]# cat templates/trimAll.yaml 
trimAll: {{"_markhuang_"|trimAll "_"}}
[root@master01 test]# helm template . --show-only templates/trimAll.yaml
---
# Source: test/templates/trimAll.yaml
trimAll: markhuang
[root@master01 test]# cat templates/trimSuffix.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Release.Name|trimSuffix "-"}}
[root@master01 test]# helm template . --show-only templates/trimSuffix.yaml
---
# Source: test/templates/trimSuffix.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME
[root@master01 test]# cat templates/trimPrefix.yaml 
trimPrefix: {{trimPrefix "-" "-abc"}}
[root@master01 test]# helm template . --show-only templates/trimPrefix.yaml
---
# Source: test/templates/trimPrefix.yaml
trimPrefix: abc
[root@master01 test]# cat templates/nospace.yaml 
nospace: {{" this is mark "|nospace}}
[root@master01 test]# helm template . --show-only templates/nospace.yaml
---
# Source: test/templates/nospace.yaml
nospace: thisismark
[root@master01 test]# cat templates/initials.yaml 
initials: {{"my name is mark"|initials}}
[root@master01 test]# helm template . --show-only templates/initials.yaml
---
# Source: test/templates/initials.yaml
initials: mnim
[root@master01 test]# cat templates/randAlphaNum.yaml 
password: {{ randAlphaNum 10}}
[root@master01 test]# helm template . --show-only templates/randAlphaNum.yaml
---
# Source: test/templates/randAlphaNum.yaml
password: X9tDGihZOB
[root@master01 test]# cat templates/randAlpha.yaml 
randAlpha: {{randAlpha 10}}
[root@master01 test]# helm template . --show-only templates/randAlpha.yaml
---
# Source: test/templates/randAlpha.yaml
randAlpha: gxiVFaeSwg
[root@master01 test]# cat templates/randAscii.yaml 
#randAscii: "{{randAscii 10}}"
[root@master01 test]# helm template . --show-only templates/randAscii.yaml
---
# Source: test/templates/randAscii.yaml
#randAscii: "Jjd.?@GS{e"
[root@master01 test]# cat templates/randNumeric.yaml 
randNumeric: {{randNumeric 10}}
[root@master01 test]# helm template . --show-only templates/randNumeric.yaml
---
# Source: test/templates/randNumeric.yaml
randNumeric: 2491395608
[root@master01 test]# cat templates/swapcase.yaml 
swapcase: {{swapcase "My Name is mark"}}
[root@master01 test]# helm template . --show-only templates/swapcase.yaml
---
# Source: test/templates/swapcase.yaml
swapcase: mY nAME IS MARK
[root@master01 test]# cat templates/shuffle.yaml 
shuffle: {{.Values.shuffle|shuffle}}
[root@master01 test]# helm template . --show-only templates/shuffle.yaml
---
# Source: test/templates/shuffle.yaml
shuffle: kmaimamrnsye
[root@master01 test]# cat templates/snakecase.yaml 
snake: {{.Values.snake|snakecase}}
[root@master01 test]# helm template . --show-only templates/snakecase.yaml
---
# Source: test/templates/snakecase.yaml
snake: shared_buffers
[root@master01 test]# cat templates/camelcase.yaml 
camel: {{.Values.camel|camelcase}}
[root@master01 test]# helm template . --show-only templates/camelcase.yaml
---
# Source: test/templates/camelcase.yaml
camel: MyNameIsMark
[root@master01 test]# cat templates/kebabcase.yaml 
kebabcase: {{kebabcase "MyNameIsMark"}}
[root@master01 test]# helm template . --show-only templates/kebabcase.yaml
---
# Source: test/templates/kebabcase.yaml
kebabcase: my-name-is-mark
[root@master01 test]# cat templates/wrap.yaml 
wrap: |
  {{wrap 5 "markhuang"}}
[root@master01 test]# helm template . --show-only templates/wrap.yaml
---
# Source: test/templates/wrap.yaml
wrap: |
  markhuang
[root@master01 test]# cat templates/wrapWith.yaml 
wrapWith: |
  {{"markhuang"|wrapWith 3 "p"}}
[root@master01 test]# helm template . --show-only templates/wrapWith.yaml
---
# Source: test/templates/wrapWith.yaml
wrapWith: |
  marpkhupang
[root@master01 test]# cat templates/contains.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  {{- $name:= .Release.Name  -}}
  {{- if contains $name "hxpmark"}}
  name: hxpmark
  {{- end}}
[root@master01 test]# helm template hxp . --show-only templates/contains.yaml
---
# Source: test/templates/contains.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: hxp-configmap
data:
  name: hxpmark
[root@master01 test]# cat templates/hasPrefix.yaml 
{{- if hasPrefix "http" .Values.url}}
url: {{.Values.url}}
{{- else}}
url: {{printf "%s://%s" "http" .Values.url}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/hasPrefix.yaml
---
# Source: test/templates/hasPrefix.yaml
url: http://www.baidu.com
[root@master01 test]# cat templates/hasSuffix.yaml 
{{- if hasSuffix "-" "mark-"}}
hasSuffix: mark-
{{- end}}
[root@master01 test]# helm template . --show-only templates/hasSuffix.yaml
---
# Source: test/templates/hasSuffix.yaml
hasSuffix: mark-
[root@master01 test]# cat  templates/quote.yaml 
quote: {{quote "mark"}}
[root@master01 test]# helm template . --show-only templates/quote.yaml
---
# Source: test/templates/quote.yaml
quote: "mark"
[root@master01 test]# cat templates/squote.yaml 
squote: {{"mark"|squote}}
[root@master01 test]# helm template . --show-only templates/squote.yaml
---
# Source: test/templates/squote.yaml
squote: 'mark'
[root@master01 test]# cat templates/cat.yaml 
cat: {{cat "my" "name" "is" "mark"}}
[root@master01 test]# helm template . --show-only templates/cat.yaml
---
# Source: test/templates/cat.yaml
cat: my name is mark
[root@master01 test]# cat templates/indent.yaml 
indent: {{"mark"|indent 2}}
[root@master01 test]# helm template . --show-only templates/indent.yaml
---
# Source: test/templates/indent.yaml
indent:   mark
[root@master01 test]# ^C
[root@master01 test]# cat templates/nindent.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Release.Name}}-configmap
data:
  rules:{{ toYaml .Values.rules|nindent 2}}
[root@master01 test]# helm template . --show-only templates/nindent.yaml
---
# Source: test/templates/nindent.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  rules:
  - rule1: aa
  - rule2: bb
[root@master01 test]# cat templates/replace.yaml 
apiVersion: v1
kind: ConfigMap
matadata:
  name: {{.Release.Name|replace "+" "_"}}
[root@master01 test]# helm template hxp+mark . --show-only templates/replace.yaml
---
# Source: test/templates/replace.yaml
apiVersion: v1
kind: ConfigMap
matadata:
  name: hxp_mark
[root@master01 test]# cat templates/plural.yaml 
plural: {{plural "sigle" "plural" 3}}
[root@master01 test]# helm template . --show-only templates/plural.yaml
---
# Source: test/templates/plural.yaml
plural: plural
[root@master01 test]# cat templates/sha1sum.yaml 
sha1sum: {{sha1sum "abc"}}
[root@master01 test]# helm template . --show-only templates/sha1sum.yaml
---
# Source: test/templates/sha1sum.yaml
sha1sum: a9993e364706816aba3e25717850c26c9cd0d89d
[root@master01 test]# cat templates/sha256sum.yaml 
sha256sum: {{sha256sum "abc"}}
[root@master01 test]# helm template . --show-only templates/sha256sum.yaml
---
# Source: test/templates/sha256sum.yaml
sha256sum: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
[root@master01 test]# cat templates/adler32sum.yaml 
adler32sum: {{adler32sum "mark"}}
[root@master01 test]# helm template . --show-only templates/adler32sum.yaml
---
# Source: test/templates/adler32sum.yaml
adler32sum: 69861804
[root@master01 test]# cat templates/toString.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Release.Name}}-configmap
data:
  toString: {{.Values.minReplicas|toString}}
[root@master01 test]# helm template . --show-only templates/toString.yaml
---
# Source: test/templates/toString.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  toString: 1
[root@master01 test]# cat templates/atoi.yaml 
atoi: {{atoi "ssss"}}
[root@master01 test]# helm template . --show-only templates/atoi.yaml
---
# Source: test/templates/atoi.yaml
atoi: 0
[root@master01 test]# cat templates/int64.yaml 
int64: {{int64 "65"}}
[root@master01 test]# helm template . --show-only templates/int64.yaml
---
# Source: test/templates/int64.yaml
int64: 65
[root@master01 test]# cat templates/int.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Release.Name}}-configmap
data:
{{- if (gt (.Values.minReplicas|int) 0)}}
  minReplicas: {{.Values.minReplicas|int}}
{{- end}}
{{- if (gt (.Values.maxReplicas|int) 0)}}
  maxReplicas: {{.Values.maxReplicas}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/int.yaml
---
# Source: test/templates/int.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  minReplicas: 1
  maxReplicas: 5
[root@master01 test]# cat templates/float64.yaml 
float64: {{float64 "3.14"}}
[root@master01 test]# helm template . --show-only templates/float64.yaml
---
# Source: test/templates/float64.yaml
float64: 3.14
[root@master01 test]# cat templates/toDecimal.yaml 
toDecimal: {{toDecimal 27}}
[root@master01 test]# helm template . --show-only templates/toDecimal.yaml
---
# Source: test/templates/toDecimal.yaml
toDecimal: 23
[root@master01 test]# cat templates/split.yaml 
{{$dic:=split "," "my,name,is,mark"}}
{{- range $key,$value:= $dic}}
{{$key}}: {{$value}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/split.yaml
---
# Source: test/templates/split.yaml
_0: my
_1: name
_2: is
_3: mark
[root@master01 test]# cat templates/splitList.yaml 
{{$list:=splitList "," "my,name,is,mark"}}
{{- range $list}}
name: {{.}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/splitList.yaml
---
# Source: test/templates/splitList.yaml
name: my
name: name
name: is
name: mark
[root@master01 test]# cat templates/splitn.yaml 
splitn: {{splitn "_" 2 "a_b_c_d" }}
[root@master01 test]# helm template . --show-only templates/splitn.yaml
---
# Source: test/templates/splitn.yaml
splitn: map[_0:a _1:b_c_d]
[root@master01 test]# cat templates/toStrings.yaml 
{{- $li:=list 1 2 3}}
toStrings: {{toStrings $li}}
[root@master01 test]# helm template . --show-only templates/toStrings.yaml
---
# Source: test/templates/toStrings.yaml
toStrings: [1 2 3]
[root@master01 test]# cat templates/until.yaml 
until: {{until 10}}
[root@master01 test]# helm template . --show-only templates/until.yaml
---
# Source: test/templates/until.yaml
until: [0 1 2 3 4 5 6 7 8 9]
[root@master01 test]# cat templates/untilStep.yaml 
untilStep: {{untilStep 1 10 2}}
[root@master01 test]# helm template . --show-only templates/untilStep.yaml
---
# Source: test/templates/untilStep.yaml
untilStep: [1 3 5 7 9]
[root@master01 test]# cat templates/add1.yaml 
add1: {{add1 1}}
[root@master01 test]# helm template . --show-only templates/add1.yaml
---
# Source: test/templates/add1.yaml
add1: 2
[root@master01 test]# cat templates/add.yaml 
{{$sum:=add 10 20}}
sum: {{$sum}}
[root@master01 test]# helm template . --show-only templates/add.yaml
---
# Source: test/templates/add.yaml
sum: 30
[root@master01 test]# cat templates/sub.yaml 
sub: {{sub 10 5}}
[root@master01 test]# helm template . --show-only templates/sub.yaml
---
# Source: test/templates/sub.yaml
sub: 5
[root@master01 test]# cat templates/div.yaml 
div: {{div 10 2}}
[root@master01 test]# helm template . --show-only templates/div.yaml
---
# Source: test/templates/div.yaml
div: 5
[root@master01 test]# cat templates/mod.yaml 
mod: {{mod 10 3}}
[root@master01 test]# helm template . --show-only templates/mod.yaml
---
# Source: test/templates/mod.yaml
mod: 1
[root@master01 test]# cat templates/mul.yaml 
mul: {{mul 3 3}}
[root@master01 test]# helm template . --show-only templates/mul.yaml
---
# Source: test/templates/mul.yaml
mul: 9
[root@master01 test]# cat templates/biggest.yaml 
biggest: {{biggest 1 3 10 4 }}
[root@master01 test]# helm template . --show-only templates/biggest.yaml
---
# Source: test/templates/biggest.yaml
biggest: 10
[root@master01 test]# cat templates/max.yaml 
max: {{max 1 31 99 2}}
[root@master01 test]# helm template . --show-only templates/max.yaml
---
# Source: test/templates/max.yaml
max: 99
[root@master01 test]# cat templates/min.yaml 
min: {{min 1 3 7 5}}
[root@master01 test]# helm template . --show-only templates/min.yaml
---
# Source: test/templates/min.yaml
min: 1
[root@master01 test]# cat templates/ceil.yaml 
ceil: {{ceil 3.932}}
[root@master01 test]# helm template . --show-only templates/ceil.yaml
---
# Source: test/templates/ceil.yaml
ceil: 4
[root@master01 test]# cat templates/floor.yaml 
floor: {{floor 3.91}}
[root@master01 test]# helm template . --show-only templates/floor.yaml
---
# Source: test/templates/floor.yaml
floor: 3
[root@master01 test]# cat templates/round.yaml 
round: {{round 3.6 0 }}
round2: {{round 3.2 0 }}
[root@master01 test]# helm template . --show-only templates/round.yaml
---
# Source: test/templates/round.yaml
round: 4
round2: 3
[root@master01 test]# cat templates/join.yaml 
{{- $li:=list 1 2 3}}
join: {{join "_"  $li }}
[root@master01 test]# helm template . --show-only templates/join.yaml
---
# Source: test/templates/join.yaml
join: 1_2_3
[root@master01 test]# cat templates/sortAlpha.yaml 
{{$list:=list}}
{{$list:=append $list "my"}}
{{$list:=append $list "name"}}
{{$list:=append $list "is"}}
{{$list:=append $list "mark"}}
{{$list:=sortAlpha $list}}
{{- range  $list}}
name: {{.}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/sortAlpha.yaml
---
# Source: test/templates/sortAlpha.yaml
name: is
name: mark
name: my
name: name
[root@master01 test]# cat templates/default.yaml 
default: {{default 100 ""}}
[root@master01 test]# helm template . --show-only templates/default.yaml
---
# Source: test/templates/default.yaml
default: 100
[root@master01 test]# cat templates/empty.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Release.Name}}-configmap
data:
  {{- if not (empty .Values.favorite.fruit) }}
  fruit: {{.Values.favorite.fruit}}
  {{- end}}
[root@master01 test]# helm template . --show-only templates/empty.yaml
---
# Source: test/templates/empty.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
[root@master01 test]# cat templates/coalesce.yaml 
coalesce: {{coalesce "" "" "1" "2"}}
[root@master01 test]# helm template . --show-only templates/coalesce.yaml
---
# Source: test/templates/coalesce.yaml
coalesce: 1
[root@master01 test]# cat templates/compact.yaml 
{{- $li:=list "1" ""  "2" "" "3"}}
compact: {{compact $li}}
[root@master01 test]# helm template . --show-only templates/compact.yaml
---
# Source: test/templates/compact.yaml
compact: [1 2 3]
[root@master01 test]# cat templates/mustCompact.yaml 
{{- $li:=list "1" ""  "2" "" "3"}}
mustCompact: {{mustCompact $li}}
[root@master01 test]# helm template . --show-only templates/mustCompact.yaml
---
# Source: test/templates/mustCompact.yaml
mustCompact: [1 2 3]
[root@master01 test]# cat templates/toJson.yaml 
json: {{.Values.json|toJson}}
[root@master01 test]# helm template . --show-only templates/toJson.yaml
---
# Source: test/templates/toJson.yaml
json: {"aa":"bb","cc":"dd"}
[root@master01 test]# cat templates/toPrettyJson.yaml 
json: {{.Values.json|toPrettyJson}}
[root@master01 test]# helm template . --show-only templates/toPrettyJson.yaml
---
# Source: test/templates/toPrettyJson.yaml
json: {
  "aa": "bb",
  "cc": "dd"
}
[root@master01 test]# cat templates/toRawJson.yaml 
json: {{.Values.json|toRawJson}}
[root@master01 test]# helm template . --show-only templates/toRawJson.yaml
---
# Source: test/templates/toRawJson.yaml
json: {"aa":"bb","cc":"dd"}
[root@master01 test]# cat templates/mustToJson.yaml 
json: {{.Values.json|mustToJson}}
[root@master01 test]# helm template . --show-only templates/mustToJson.yaml
---
# Source: test/templates/mustToJson.yaml
json: {"aa":"bb","cc":"dd"}
[root@master01 test]# cat templates/mustToPrettyJson.yaml 
json: {{.Values.json|mustToPrettyJson}}
[root@master01 test]# helm template . --show-only templates/mustToPrettyJson.yaml
---
# Source: test/templates/mustToPrettyJson.yaml
json: {
  "aa": "bb",
  "cc": "dd"
}
[root@master01 test]# cat templates/mustToRawJson.yaml 
json: {{.Values.json|mustToRawJson}}
[root@master01 test]# helm template . --show-only templates/mustToRawJson.yaml
---
# Source: test/templates/mustToRawJson.yaml
json: {"aa":"bb","cc":"dd"}
[root@master01 test]# cat templates/ternary.yaml 
value: {{ ternary "1" "0" .Values.debug | quote }}
[root@master01 test]# helm template . --show-only templates/ternary.yaml
---
# Source: test/templates/ternary.yaml
value: "1"
[root@master01 test]# cat templates/deepCopy.yaml 
{{- $li:=list 1 2 3}}
deepCopy: {{deepCopy $li}}
[root@master01 test]# helm template . --show-only templates/deepCopy.yaml
---
# Source: test/templates/deepCopy.yaml
deepCopy: [1 2 3]
[root@master01 test]# cat templates/mustDeepCopy.yaml 
{{- $li:=list 1 2 3}}
mustDeepCopy: {{mustDeepCopy $li}}

[root@master01 test]# helm template . --show-only templates/mustDeepCopy.yaml
---
# Source: test/templates/mustDeepCopy.yaml
mustDeepCopy: [1 2 3]
[root@master01 test]# cat templates/typeOf.yaml 
typeOf: {{typeOf 123}}
[root@master01 test]# helm template . --show-only templates/typeOf.yaml
---
# Source: test/templates/typeOf.yaml
typeOf: int

[root@master01 test]# cat templates/typeIs.yaml 
{{- if typeIs "int" 123}}
typeIs: int 123
{{- end}}
[root@master01 test]# helm template . --show-only templates/typeIs.yaml
---
# Source: test/templates/typeIs.yaml
typeIs: int 123
[root@master01 test]# cat templates/typeIsLike.yaml 
{{- if typeIsLike "int" 123}}
typeIsLike: int 123
{{- end}}
[root@master01 test]# helm template . --show-only templates/typeIsLike.yaml
---
# Source: test/templates/typeIsLike.yaml
typeIsLike: int 123
[root@master01 test]# cat templates/kindOf.yaml 
kindOf: {{kindOf 123}}
[root@master01 test]# helm template . --show-only templates/kindOf.yaml
---
# Source: test/templates/kindOf.yaml
kindOf: int
[root@master01 test]# cat templates/kindIs.yaml 
{{- if kindIs "int" 123}}
kindIs: int 123
{{- end}}
[root@master01 test]# helm template . --show-only templates/kindIs.yaml
---
# Source: test/templates/kindIs.yaml
kindIs: int 123
[root@master01 test]# cat templates/deepEqual.yaml 
{{- $li:=list 1 2 3}}
{{- $li2:=list 1 2 3}}
deepEqual: {{deepEqual $li $li2}}
[root@master01 test]# helm template . --show-only templates/deepEqual.yaml
---
# Source: test/templates/deepEqual.yaml
deepEqual: true
[root@master01 test]# cat templates/getHostByName.yaml 
getHostByName: {{getHostByName "www.baidu.com"}}
[root@master01 test]# helm template . --show-only templates/getHostByName.yaml
---
# Source: test/templates/getHostByName.yaml
getHostByName: 36.152.44.95
[root@master01 test]# cat templates/base.yaml 
base: {{base .Values.path}}
[root@master01 test]# helm template . --show-only templates/base.yaml
---
# Source: test/templates/base.yaml
base: aa
[root@master01 test]# cat templates/dir.yaml 
dir: {{dir "/etc/fstab"}}
[root@master01 test]# helm template . --show-only templates/dir.yaml
---
# Source: test/templates/dir.yaml
dir: /etc
[root@master01 test]# cat templates/clean.yaml 
clean: {{clean "/etc/systemd/system/"}}
[root@master01 test]# helm template . --show-only templates/clean.yaml
---
# Source: test/templates/clean.yaml
clean: /etc/systemd/system
[root@master01 test]# cat templates/ext.yaml 
ext: {{ ext "/a/b/c.yaml"}}
[root@master01 test]# helm template . --show-only templates/ext.yaml
---
# Source: test/templates/ext.yaml
ext: .yaml
[root@master01 test]# cat templates/isAbs.yaml 
{{- if isAbs "/etc/"}}
isAbs: /etc/
{{- end}}
[root@master01 test]# helm template . --show-only templates/isAbs.yaml
---
# Source: test/templates/isAbs.yaml
isAbs: /etc/
[root@master01 test]# cat templates/b64enc.yaml 
b64enc: {{b64enc "123"}}
[root@master01 test]# helm template . --show-only templates/b64enc.yaml
---
# Source: test/templates/b64enc.yaml
b64enc: MTIz
[root@master01 test]# cat templates/b64dec.yaml 
b64dec: {{"123"|b64enc|b64dec}}
[root@master01 test]# helm template . --show-only templates/b64dec.yaml
---
# Source: test/templates/b64dec.yaml
b64dec: 123
[root@master01 test]# cat templates/b32enc.yaml 
b32enc: {{b32enc "123"}}
[root@master01 test]# helm template . --show-only templates/b32enc.yaml
---
# Source: test/templates/b32enc.yaml
b32enc: GEZDG===
[root@master01 test]# cat templates/b32dec.yaml 
b32dec: {{b32enc "123"|b32dec}}
[root@master01 test]# helm template . --show-only templates/b32dec.yaml
---
# Source: test/templates/b32dec.yaml
b32dec: 123
[root@master01 test]# cat templates/tuple.yaml 
{{- $message:=tuple}}
{{- $message:=append $message "abc" }}
{{- $message:=append $message  "xyz"}}
{{- $message:=append $message  "xxx"}}
{{- $message:=without $message "xxx"}}
{{- $message:= join "$" $message}}
tuple: {{$message}}
[root@master01 test]# helm template . --show-only templates/tuple.yaml
---
# Source: test/templates/tuple.yaml
tuple: abc$xyz
[root@master01 test]# cat templates/list.yaml 
{{- $message:=list}}
{{- $message:=append $message "abc" }}
{{- $message:=append $message  "xyz"}}
{{- $message:=append $message  "xxx"}}
{{- $message:=without $message "xxx"}}
{{- $message:= join "$" $message}}
list: {{$message}}
[root@master01 test]# helm template . --show-only templates/list.yaml
---
# Source: test/templates/list.yaml
list: abc$xyz
[root@master01 test]# cat templates/dict.yaml 
name: {{ include "harbor.tplValue" ( dict "value" .Values.name "context" $) }}
[root@master01 test]# helm template . --show-only templates/dict.yaml
---
# Source: test/templates/dict.yaml
name: Tom
[root@master01 test]# cat templates/get.yaml 
{{- $di:=dict "aa" "av" "bb" "bv"}}
get: {{get $di "aa"}}
[root@master01 test]# helm template . --show-only templates/get.yaml
---
# Source: test/templates/get.yaml
get: av
[root@master01 test]# cat templates/set.yaml 
{{- $_ := set . "portal_path" "/*" -}}
{{- $_ := set . "api_path" "/api/*" -}}
{{- $_ := set . "service_path" "/service/*" -}}
{{- $_ := set . "v2_path" "/v2/*" -}}
{{- $_ := set . "chartrepo_path" "/chartrepo/*" -}}
{{- $_ := set . "controller_path" "/c/*" -}}
portal_path: {{.portal_path}}
api_path: {{.api_path}}
service_path: {{.service_path}}
v2_path: {{.v2_path}}
chartrepo_path: {{.chartrepo_path}}
controller_path: {{.controller_path}}
[root@master01 test]# ^C
[root@master01 test]# helm template . --show-only templates/set.yaml
---
# Source: test/templates/set.yaml
portal_path: /*
api_path: /api/*
service_path: /service/*
v2_path: /v2/*
chartrepo_path: /chartrepo/*
controller_path: /c/*
[root@master01 test]# cat templates/unset.yaml 
{{- $di:=dict "aa" "av" "bb" "bv" }}
dict: {{$di}}
dict: {{ unset $di "aa"}}
dict: {{$di}}
[root@master01 test]# helm template . --show-only templates/unset.yaml
---
# Source: test/templates/unset.yaml
dict: map[aa:av bb:bv]
dict: map[bb:bv]
dict: map[bb:bv]

[root@master01 test]# cat templates/hasKey.yaml 
{{- $di:=dict "aa" "av" "bb" "bv"}}
hasKey: {{hasKey $di "aa"}}
[root@master01 test]# helm template . --show-only templates/hasKey.yaml
---
# Source: test/templates/hasKey.yaml
hasKey: true
[root@master01 test]# cat templates/pluck.yaml 
{{- $d1:=dict "aa" "a1" "bb" "b1"}}
{{- $d2:=dict "aa" "a2" "bb" "b2"}}
pluck: {{pluck "aa" $d1 $d2}}
[root@master01 test]# helm template . --show-only templates/pluck.yaml
---
# Source: test/templates/pluck.yaml
pluck: [a1 a2]
[root@master01 test]# cat templates/keys.yaml 
{{- $d1:=dict "aa" "a1" "bb" "b1"}}
{{- $d2:=dict "a2" "a2" "b2" "b2"}}
keys: {{keys $d1 $d2}}
[root@master01 test]# helm template . --show-only templates/keys.yaml
---
# Source: test/templates/keys.yaml
keys: [aa bb a2 b2]
[root@master01 test]# cat templates/pick.yaml 
{{- $d1:=dict "aa" "a1" "bb" "b1" "cc" "c1"}}
pick: {{pick $d1 "aa" "cc"}}
[root@master01 test]# helm template . --show-only templates/pick.yaml
---
# Source: test/templates/pick.yaml
pick: map[aa:a1 cc:c1]
[root@master01 test]# cat templates/omit.yaml 
{{- $d1:=dict "aa" "a1" "bb" "b1"}}
omit: {{omit $d1 "aa"}}
[root@master01 test]# helm template . --show-only templates/omit.yaml
---
# Source: test/templates/omit.yaml
omit: map[bb:b1]
[root@master01 test]# cat templates/merge.yaml 
{{- $target:=dict}}
{{- $src1:=dict "a1" "a1" "b1" "b1"}}
{{- $src2:=dict "a2" "a2" "b2" "b2"}}
merge: {{merge $target $src1 $src2}}
[root@master01 test]# helm template . --show-only templates/merge.yaml
---
# Source: test/templates/merge.yaml
merge: map[a1:a1 a2:a2 b1:b1 b2:b2]
[root@master01 test]# cat templates/mergeOverwrite.yaml 
{{- $target:=dict}}
{{- $src1:=dict "a1" "a1" "b1" "b1"}}
{{- $src2:=dict "a1" "a2" "b2" "b2"}}
mergeOverwrite: {{mergeOverwrite $target $src1 $src2}}
[root@master01 test]# helm template . --show-only templates/mergeOverwrite.yaml
---
# Source: test/templates/mergeOverwrite.yaml
mergeOverwrite: map[a1:a2 b1:b1 b2:b2]
[root@master01 test]# cat templates/mustMerge.yaml 
{{- $target:=dict}}
{{- $src1:=dict "a1" "a1" "b1" "b1"}}
{{- $src2:=dict "a2" "a2" "b2" "b2"}}
mustMerge: {{mustMerge $target $src1 $src2}}
[root@master01 test]# helm template . --show-only templates/mustMerge.yaml
---
# Source: test/templates/mustMerge.yaml
mustMerge: map[a1:a1 a2:a2 b1:b1 b2:b2]

[root@master01 test]# cat templates/mustMergeOverwrite.yaml 
{{- $target:=dict}}
{{- $src1:=dict "a1" "a1" "b1" "b1"}}
{{- $src2:=dict "a1" "a2" "b2" "b2"}}
mustMergeOverwrite: {{mustMergeOverwrite $target $src1 $src2}}
[root@master01 test]# helm template . --show-only templates/mustMergeOverwrite.yaml
---
# Source: test/templates/mustMergeOverwrite.yaml
mustMergeOverwrite: map[a1:a2 b1:b1 b2:b2]

[root@master01 test]# cat templates/values.yaml 
{{- $di:=dict "aa" "av" "bb" "bv"}}
values: {{values $di}}
[root@master01 test]# helm template . --show-only templates/values.yaml
---
# Source: test/templates/values.yaml
values: [av bv]
[root@master01 test]# helm template . --show-only templates/values.yaml
---
# Source: test/templates/values.yaml
values: [av bv]
[root@master01 test]# ^C
[root@master01 test]# cat templates/listAndFunc.yaml 
{{$li:=list}}
{{$li:=append $li 1}}
{{$li:=append $li 2}}
{{$li:=prepend $li 3}}
{{$li:=prepend $li 4}}
all: {{$li}}
first: {{first $li}}
rest: {{rest $li}}
last: {{last $li}}
initial: {{initial $li}}
{{- $li:=reverse $li}}
all: {{$li}}
{{- $li:= append $li 1 }}
all: {{$li}}
{{- $li:=uniq $li }}
uniq: {{$li}}
{{- $li:= without $li 1}}
without: {{$li}}
{{- if (has 2 $li)}}
has: 2
{{- end}}
[root@master01 test]# helm template . --show-only templates/listAndFunc.yaml
---
# Source: test/templates/listAndFunc.yaml
all: [4 3 1 2]
first: 4
rest: [3 1 2]
last: 2
initial: [4 3 1]
all: [2 1 3 4]
all: [2 1 3 4 1]
uniq: [2 1 3 4]
without: [2 3 4]
has: 2
[root@master01 test]# cat templates/append.yaml 
{{$li:=list}}
{{$li:=append $li 1}}
{{$li:=append $li 2}}
all: {{$li}}
[root@master01 test]# helm template . --show-only templates/append.yaml
---
# Source: test/templates/append.yaml
all: [1 2]

[root@master01 test]# cat templates/push.yaml 
{{$li:=list}}
{{$li:=push $li 1}}
{{$li:=push $li 2}}
all: {{$li}}
[root@master01 test]# helm template . --show-only templates/push.yaml
---
# Source: test/templates/push.yaml
all: [1 2]
[root@master01 test]# cat templates/mustAppend.yaml 
{{$li:=list}}
{{$li:=mustAppend $li 1}}
{{$li:=mustAppend $li 2}}
all: {{$li}}
[root@master01 test]# helm template . --show-only templates/mustAppend.yaml
---
# Source: test/templates/mustAppend.yaml
all: [1 2]

[root@master01 test]# cat templates/mustPush.yaml 
{{$li:=list}}
{{$li:=mustPush $li 1}}
{{$li:=mustPush $li 2}}
all: {{$li}}
[root@master01 test]# helm template . --show-only templates/mustPush.yaml
---
# Source: test/templates/mustPush.yaml
all: [1 2]
[root@master01 test]# cat templates/prepend.yaml 
{{$li:=list}}
{{$li:=prepend $li 1}}
{{$li:=prepend $li 2}}
all: {{$li}}
[root@master01 test]# helm template . --show-only templates/prepend.yaml
---
# Source: test/templates/prepend.yaml
all: [2 1]
[root@master01 test]# cat templates/mustPrepend.yaml 
{{$li:=list}}
{{$li:=mustPrepend $li 1}}
{{$li:=mustPrepend $li 2}}
all: {{$li}}
[root@master01 test]# helm template . --show-only templates/mustPrepend.yaml
---
# Source: test/templates/mustPrepend.yaml
all: [2 1]
[root@master01 test]# cat templates/first.yaml 
{{$li:=list 1 2 4}}
first: {{first $li}}
[root@master01 test]# helm template . --show-only templates/first.yaml
---
# Source: test/templates/first.yaml
first: 1
[root@master01 test]# cat templates/mustFirst.yaml 
{{$li:=list 1 2 4}}
mustFirst: {{mustFirst $li}}
[root@master01 test]# helm template . --show-only templates/mustFirst.yaml
---
# Source: test/templates/mustFirst.yaml
mustFirst: 1
[root@master01 test]# cat templates/rest.yaml 
{{$li:=list 1 2 4}}
rest: {{rest $li}}
[root@master01 test]# helm template . --show-only templates/rest.yaml
---
# Source: test/templates/rest.yaml
rest: [2 4]
[root@master01 test]# cat templates/mustRest.yaml 
{{$li:=list 1 2 4}}
mustRest: {{mustRest $li}}
[root@master01 test]# helm template . --show-only templates/mustRest.yaml
---
# Source: test/templates/mustRest.yaml
mustRest: [2 4]
[root@master01 test]# cat templates/last.yaml 
{{$li:=list 1 2 4}}
last: {{last $li}}
[root@master01 test]# helm template . --show-only templates/last.yaml
---
# Source: test/templates/last.yaml
last: 4
[root@master01 test]# cat templates/mustLast.yaml 
{{$li:=list 1 2 4}}
mustLast: {{mustLast $li}}
[root@master01 test]# helm template . --show-only templates/mustLast.yaml
---
# Source: test/templates/mustLast.yaml
mustLast: 4
[root@master01 test]# cat templates/initial.yaml 
{{$li:=list 1 2 4}}
initial: {{initial $li}}
[root@master01 test]# helm template . --show-only templates/initial.yaml
---
# Source: test/templates/initial.yaml
initial: [1 2]
[root@master01 test]# cat templates/mustInitial.yaml 
{{$li:=list 1 2 4}}
mustInitial: {{mustInitial $li}}
[root@master01 test]# helm template . --show-only templates/mustInitial.yaml
---
# Source: test/templates/mustInitial.yaml
mustInitial: [1 2]
[root@master01 test]# cat templates/reverse.yaml 
{{$li:=list 1 2 3}}
{{- $li:=reverse $li}}
reverse: ${{$li}}
[root@master01 test]# helm template . --show-only templates/reverse.yaml
---
# Source: test/templates/reverse.yaml
reverse: $[3 2 1]
[root@master01 test]# cat templates/mustReverse.yaml 
{{$li:=list 1 2 3}}
{{- $li:=mustReverse $li}}
mustReverse: ${{$li}}
[root@master01 test]# helm template . --show-only templates/mustReverse.yaml
---
# Source: test/templates/mustReverse.yaml
mustReverse: $[3 2 1]
[root@master01 test]# cat templates/uniq.yaml 
{{$li:=list 1 2 4 1}}
all: {{$li}}
uniq: {{uniq $li}}
[root@master01 test]# helm template . --show-only templates/uniq.yaml
---
# Source: test/templates/uniq.yaml
all: [1 2 4 1]
uniq: [1 2 4]
root@master01 test]# cat templates/mustUniq.yaml 
{{$li:=list 1 2 4 1}}
all: {{$li}}
mustUniq: {{mustUniq $li}}
[root@master01 test]# helm template . --show-only templates/mustUniq.yaml
---
# Source: test/templates/mustUniq.yaml
all: [1 2 4 1]
mustUniq: [1 2 4]
[root@master01 test]# cat templates/without.yaml 
{{$li:=list 1 2 3}}
without: {{without $li 3}}
[root@master01 test]# helm template . --show-only templates/without.yaml
---
# Source: test/templates/without.yaml
without: [1 2]
[root@master01 test]# cat templates/mustWithout.yaml 
{{$li:=list 1 2 3}}
mustWithout: {{mustWithout $li 3}}
[root@master01 test]# helm template . --show-only templates/mustWithout.yaml
---
# Source: test/templates/mustWithout.yaml
mustWithout: [1 2]
[root@master01 test]# cat templates/list_has.yaml 
{{$li:=list 1 2 4}}
{{- if has 2 $li}}
has: 2
{{- end}}
[root@master01 test]# helm template . --show-only templates/list_has.yaml
---
# Source: test/templates/list_has.yaml
has: 2
[root@master01 test]# cat templates/mustHas.yaml 
{{$li:=list 1 2 4}}
{{- if mustHas 2 $li}}
mustHas: 2
{{- end}}
[root@master01 test]# helm template . --show-only templates/mustHas.yaml
---
# Source: test/templates/mustHas.yaml
mustHas: 2
[root@master01 test]# cat templates/slice.yaml 
{{$li:=list 1 2 4}}
slice: {{slice $li 0 1}}
[root@master01 test]# helm template . --show-only templates/slice.yaml
---
# Source: test/templates/slice.yaml
slice: [1]
[root@master01 test]# cat templates/mustSlice.yaml 
{{$li:=list 1 2 4}}
mustSlice: {{mustSlice $li 0 1}}
[root@master01 test]# helm template . --show-only templates/mustSlice.yaml
---
# Source: test/templates/mustSlice.yaml
mustSlice: [1]
[root@master01 test]# cat templates/concat.yaml 
{{$li:=list 1 2 4}}
{{$li2:=list 5 6 7}}
concat: {{concat $li $li2}}
[root@master01 test]# helm template . --show-only templates/concat.yaml
---
# Source: test/templates/concat.yaml
concat: [1 2 4 5 6 7]
[root@master01 test]# cat templates/genPrivateKey.yaml 
{{$key:=genPrivateKey "rsa"}}
len: {{len $key}}
key: {{replace "\n" "" $key }}
[root@master01 test]# helm template . --show-only templates/genPrivateKey.yaml
---
# Source: test/templates/genPrivateKey.yaml
len: 3243
key: -----BEGIN RSA PRIVATE KEY-----MIIJKAIBAAKCAgEA8PEoBhlG8etyJZp7oucUXfSZcSbGYz2Xdf3DkkiMIPWZXTqo5fObgV2IqPCj5CdjJjZOMMmxbeVGv/9dwgZn1RQTX7tWfJRv/4d1SkKUasog9IuixHYSyCqplclwAPM9Q67bwc5El3WNxn1n5FIZeT1oqcNQR9ZzQsq2ManUsrS9X9B9MiBuqqIfnytpeE5e3I6sMveRLivMLayg1JvjiOT2VvyZVrX7QsUFa9SlkpjoTmRd2XVn0rM9W9OCGSu4jZJylpP1AXO9VCG6kpvYo5wlp5d02skpAhuxNWvoPqSO9nfbQrAaSBAUDleUXlDYBRo7xUUba89N8r0yh8uNbUpYtptdapmWjjcYsgnGk5fVtZzhFFAgsi0sOsdhTaDWjRc/iTtdURlYKFYAYE4dOmeOBGFiUahwkS6zzcZFQEk/ObZYOx4LwTVW2jpt+2swGRLwzDDzqzyISzJyGIdn5iX8i5Z5vfPUaAFu2+aJxtoLx9j3V9H6VF/GPmA0IJ910JEV00LwBqju9TzN1UzndVvTcPIk9lCCLaNW4gjzXzoTo1h+prz/lX4Iz+ch4pMk/FaZ1tcvLN+f3VIoEfVyegDLb82j33qD4OLdTudmVcwDMuRzvhutSD/umC3sdif9dGoUqTlbHIJAUat84pa/ROtZIOJjdzKmYRmbpZbH5XkCAwEAAQKCAgEA8GuCx4sjerS4wwMCicvRS+uNzRW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ZBWVARzMuCghK5FQw8tgAY4dluQfAlV7qc/KNgUnG30+AaTPj0UN65foq6Hc4qk4uzlYHciHsF+CRrpxPcClE6OgVcSx3RZRj+COGPecjitKuIH1O4dAAB9gpnCbL/76qSYQ7jma5CzeQjSCL8wxj5fv4gpbVco6rVwLTe69mi8JKUCYrfC1qCMA5pXNTd3qzOK+dEppJ1rXkQ4N0NQSrV4r/M=-----END RSA PRIVATE KEY-----
[root@master01 test]# cat templates/derivePassword.yaml 
derivePassword: {{derivePassword 20 "medium" "123" "abc" "www.baidu.com"}}
[root@master01 test]# helm template . --show-only templates/derivePassword.yaml
---
# Source: test/templates/derivePassword.yaml
derivePassword: Rob0#Riw

[root@master01 test]# cat templates/genCA.yaml 
{{- $ca := genCA "harbor-ca" 365 }}
ca.crt: {{ $ca.Cert | b64enc | quote }}
[root@master01 test]# helm template . --show-only templates/genCA.yaml
---
# Source: test/templates/genCA.yaml
ca.crt: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM5RENDQWR5Z0F3SUJBZ0lRS0ptUjVXeVYzd01RRmFiOGV2enhxREFOQmdrcWhraUc5dzBCQVFzRkFEQVUKTVJJd0VBWURWUVFERXdsb1lYSmliM0l0WTJFd0hoY05NakF3TkRFd01ETTBNekl6V2hjTk1qRXdOREV3TURNMApNekl6V2pBVU1SSXdFQVlEVlFRREV3bG9ZWEppYjNJdFkyRXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRFhUVWlvcklrc1FidVJYeUF3blIvT1V6SkIvOGdVbUdZL2lkK25zWkwwTVN6T2wvUC8KQmp0UVlsSm1XSkEzOG95Vys3VXRUQ3I5bFpBLy9YekJKVHZSVXdmR2JNY0NjclB4b0c5eUJLcW1KS2JsSUVCdgpScTBqYnIwTWt4b1RiRkgyL09td29yZU03dm1qMDMyZXp5UzNFK2Z2SFNtTVVvY3duaTJoaGZMV05OVkxhNW5qCnZRYXVXNzJYY1hjbU5qVFFTWURZU2RMdnVFUHdmRDliMGJMWGhvVDZSWEJCVzJ2ZmlMOWhvbGdsTitlKzFqcXAKNUFFZWRGSkhDSnNNd2w4aUZWYmdSSmx6U1FWNm1IckRYcHlTUTE2cENrYTN5VFZidkRnb0tpK3p3RHFIb1BSYQpvVklqTHo5QnlETm5VdHIxTzI2M25yNWF5RmY5ZXdWL0Y5SXZBZ01CQUFHalFqQkFNQTRHQTFVZER3RUIvd1FFCkF3SUNwREFkQmdOVkhTVUVGakFVQmdnckJnRUZCUWNEQVFZSUt3WUJCUVVIQXdJd0R3WURWUjBUQVFIL0JBVXcKQXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFSaVFITmxTc3hQWXBVNnZ6cTE4YXYvc2YxUDZQVCt1MwpnNXN1RGcyZDVaRnYrdW5tY0pScS9IMnhxalJhS3NoK3Z6NWxpRjFpdmFiSkdHZDdiVCtjL09WY1h2TmpibE0vClQ5dVRHN3ZwZGJ0NW5uU3Vzd0lBT1dQMEhVWWFwZGxJSzE5cVJZNVNjY0hUL1BzelpQZFdCMjdLS3hPUWo3YloKa1pMNVZNQ3ZDcjlxS284S3VCc0crZ2FsaGRyNC8xS3pER3g4SjY2UElHKzdMazBKSlQ1T3RvOWJDTFMxYnk1Vwpuc3lKdlFZbjZBNFRkK3dseVJTS1RLZDZFZ2dpdUxLWTU4d3hiRDB5enU4V3JzVklIR0Uyemp5VHV1NGJqYUlkCncxUWE0TUhJZWN6c0p3U0w3Rkg2QjhSa0Z3QmlVSDlXaWVVSzByWW5rZGhYTDVnVkk2cjVrZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"
[root@master01 test]# cat templates/genSignedCert.yaml 
{{- $ca := genCA "harbor-ca" 365 }}
{{- $cert := genSignedCert "www.baidu.com" nil (list "www.baidu.com" "www.google.com") 365 $ca }}
tls.crt: {{ $cert.Cert | b64enc | quote }}
tls.key: {{ $cert.Key | b64enc | quote }}
[root@master01 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T1V4Lzc2UVRsa2VoMVB1N0NCdlc2VnF5SU43a2FLb21PYTB0LwpDd0lYQnFjMmNRQUhIQTBVaEU2ZDQ3TWlqOUlDZm50dTJ6STU1Wmg4NURIbGlZdEVMako5RFVwMnBWRnBETkZnCm1EMzI0Kys5WHpwbHY3VDhFSE94RFFLQmdBbkRPdlRKb3VFOCtCMzEzb3ZCY3RIWElsV2V1SldyLzNHTzNCdVcKU2MvMW5Tdno1MTBpUjJEQ25ucHlGN2x0UWVaQ3kycmZoTTNiVDJOY3E3ZFo0Z1dSV1B2SzVuYjBmdWVlVnBETwp4cnNXcnJQN21sZEl5ZFBYZTI4RzZ6OWh5OXVoNXlYWU1ORm40dzZmcDVpaXRwbFVWU25xWE8wRDlibDU1V3pmCnlEY0JBb0dBTS9jNDVWaXp4RHJwdDByMWx3OVlMakxPYk9DMmpIclBFUkovcnBBZmY5L3RIcnZ1bElHNEVMUVcKczNNc0t1VUFIUUZhdGJhRWN6SUhsZUdkTGJCT2JUVUNWQW1RWTdOZXhxUTA2QzdzVE9qRUNsOG1LSUVYQms4cQpoZmpVS1NDOG40UW9UbHA2dmZFbEJTSm12R2VJcnpNalp4MWtCT0Q0UmwvV0Z1aU5sbGs9Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg=="

[root@master01 test]# cat templates/encryptAES.yaml 
encryptAES: {{encryptAES "123" "dddd"}}
[root@master01 test]# helm template . --show-only templates/encryptAES.yaml
---
# Source: test/templates/encryptAES.yaml
encryptAES: BgbJivGXDX+qhEz55aEergLaRX1SLg+Buv2SD7puDr4=

[root@master01 test]# cat templates/decryptAES.yaml 
{{$data:=encryptAES "123" "dddd"}}
decryptAES: {{decryptAES "123" $data}}
[root@master01 test]# helm template . --show-only templates/decryptAES.yaml
---
# Source: test/templates/decryptAES.yaml
decryptAES: dddd
[root@master01 test]# cat templates/uuidv4.yaml 
uuidv4: {{uuidv4}}
[root@master01 test]# helm template . --show-only templates/uuidv4.yaml
---
# Source: test/templates/uuidv4.yaml
uuidv4: 184129b3-bc65-4f55-b3cc-5fa53b45fa48
[root@master01 test]# cat templates/semver.yaml 
semver: {{semver "1.2.0"}}
[root@master01 test]# helm template . --show-only templates/semver.yaml
---
# Source: test/templates/semver.yaml
semver: 1.2.0
[root@master01 test]# cat templates/semverCompare.yaml 
{{- if semverCompare ">=1.9-0" .Capabilities.KubeVersion.GitVersion -}}
apiVesion: {{ "apps/v1"}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/semverCompare.yaml
---
# Source: test/templates/semverCompare.yaml
apiVesion: apps/v1
[root@master01 test]# cat templates/fail.yaml 
{{/*
{{- "this is a fail "| fail}}
*/}}
[root@master01 test]# cat templates/regexMatch.yaml 
{{- $cn:="192.168.198.145"}}
{{- if  (regexMatch `^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$` $cn) }}
url: {{$cn}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/regexMatch.yaml
---
# Source: test/templates/regexMatch.yaml
url: 192.168.198.145
[root@master01 test]# cat templates/mustRegexMatch.yaml 
{{- $cn:="192.168.198.145"}}
{{- if  (mustRegexMatch `^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$` $cn) }}
url: {{$cn}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/mustRegexMatch.yaml
---
# Source: test/templates/mustRegexMatch.yaml
url: 192.168.198.145
[root@master01 test]# cat templates/regixFind.yaml 
{{- if .Values.tag | toString | regexFind "-r\\d+$|sha256:"}}
aa: bb
{{- end}}
[root@master01 test]# helm template . --show-only templates/regixFind.yaml
---
# Source: test/templates/regixFind.yaml
aa: bb
[root@master01 test]# cat templates/regixFind2.yaml 
{{- if .Values.tag2 | toString | regexFind "-r\\d+$"}}
aa: bb
{{- end}}
[root@master01 test]# helm template . --show-only templates/regixFind2.yaml
---
# Source: test/templates/regixFind2.yaml
aa: bb
[root@master01 test]# cat templates/regexFindAll.yaml 
find: {{ regexFindAll "\\d+" "34343asfd112211" -1}}
[root@master01 test]# helm template . --show-only templates/regexFindAll.yaml
---
# Source: test/templates/regexFindAll.yaml
find: [34343 112211]
[root@master01 test]# cat templates/mustRegexFindAll.yaml 
mustRegexFindAll: {{ mustRegexFindAll "\\d+" "34343asfd112211" -1}}
[root@master01 test]# helm template . --show-only templates/mustRegexFindAll.yaml
---
# Source: test/templates/mustRegexFindAll.yaml
mustRegexFindAll: [34343 112211]

[root@master01 test]# cat templates/mustRegexFind.yaml 
find: {{ mustRegexFind "\\d+" "34343asfd112211" }}
[root@master01 test]# helm template . --show-only templates/mustRegexFind.yaml
---
# Source: test/templates/mustRegexFind.yaml
find: 34343
[root@master01 test]# cat templates/regexReplaceAll.yaml 
regexReplaceAll: {{ regexReplaceAll "\\d+" "34343asfd112211" "xxx"}}
[root@master01 test]# helm template . --show-only templates/regexReplaceAll.yaml
---
# Source: test/templates/regexReplaceAll.yaml
regexReplaceAll: xxxasfdxxx
[root@master01 test]# cat templates/mustRegexReplaceAll.yaml 
mustRegexReplaceAll: {{ mustRegexReplaceAll "\\d+" "34343asfd112211" "xxx"}}
[root@master01 test]# helm template . --show-only templates/mustRegexReplaceAll.yaml
---
# Source: test/templates/mustRegexReplaceAll.yaml
mustRegexReplaceAll: xxxasfdxxx
[root@master01 test]# cat templates/regexReplaceAllLiteral.yaml 
regexReplaceAllLiteral: {{ regexReplaceAllLiteral "(\\d+)" "34343asfd112211" "$1"}}
[root@master01 test]# helm template . --show-only templates/regexReplaceAllLiteral.yaml
---
# Source: test/templates/regexReplaceAllLiteral.yaml
regexReplaceAllLiteral: $1asfd$1
[root@master01 test]# cat templates/mustRegexReplaceAllLiteral.yaml 
mustRegexReplaceAllLiteral: {{mustRegexReplaceAllLiteral "(\\d+)" "34343asfd112211" "$1"}}
[root@master01 test]# helm template . --show-only templates/mustRegexReplaceAllLiteral.yaml
---
# Source: test/templates/mustRegexReplaceAllLiteral.yaml
mustRegexReplaceAllLiteral: $1asfd$1
[root@master01 test]# cat templates/regexSplit.yaml 
regexSplit: {{regexSplit "\\d+" "888ss8ff8dd" -1}}
[root@master01 test]# helm template . --show-only templates/regexSplit.yaml
---
# Source: test/templates/regexSplit.yaml
regexSplit: [ ss ff dd]
[root@master01 test]# cat templates/mustRegexSplit.yaml 
mustRegexSplit: {{mustRegexSplit "\\d+" "888ss8ff8dd" -1}}
[root@master01 test]# helm template . --show-only templates/mustRegexSplit.yaml
---
# Source: test/templates/mustRegexSplit.yaml
mustRegexSplit: [ ss ff dd]
[root@master01 test]# cat templates/urlParse.yaml 
urlParse: |
  {{urlParse "http://www.baidu.com"}}
[root@master01 test]# helm template . --show-only templates/urlParse.yaml
---
# Source: test/templates/urlParse.yaml
urlParse: |
  map[fragment: host:www.baidu.com hostname:www.baidu.com opaque: path: query: scheme:http userinfo:]
[root@master01 test]# cat templates/urlJoin.yaml 
{{- $di:=dict "scheme" "http" "host" "www.baidu.com" }}
url: {{urlJoin $di}}
[root@master01 test]# helm template . --show-only templates/urlJoin.yaml
---
# Source: test/templates/urlJoin.yaml
url: http://www.baidu.com
[root@master01 test]# cat templates/define.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
  {{- template "mychart.labels" }}
data:
  myvalue: "Hello World"
[root@master01 test]# helm template . --show-only templates/define.yaml
---
# Source: test/templates/define.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
  labels:
    generator: helm
    date: 2020-04-11
data:
  myvalue: "Hello World"
[root@master01 test]# cat templates/dictAndFunc.yaml 
{{- $di:=dict "aa" "av" "bb" "bv"}}
dict: {{$di}}
{{- $di:= set $di "aa" "avv"}}
{{- $di:=set $di "cc" "cv"}}
dict: {{$di}}
{{- $di:=unset $di "aa"}}
dict: {{$di}}
{{- if hasKey $di "cc"}}
dict: has cc
{{- end}}
{{- $dic2:=dict "cc" "cv" "dd" "dv"}}
pluck: {{pluck "cc" $di $dic2}}
{{- $di:=merge $di $dic2}}
di: {{$di}}
keys: {{keys $di}}
dd: {{pick $di "dd"}}
di: {{$di}}
{{- $di:=omit $di "dd"}}
di: {{$di}}
[root@master01 test]# helm template . --show-only templates/dictAndFunc.yaml
---
# Source: test/templates/dictAndFunc.yaml
dict: map[aa:av bb:bv]
dict: map[aa:avv bb:bv cc:cv]
dict: map[bb:bv cc:cv]
dict: has cc
pluck: [cv cv]
di: map[bb:bv cc:cv dd:dv]
keys: [dd bb cc]
dd: map[dd:dv]
di: map[bb:bv cc:cv dd:dv]
di: map[bb:bv cc:cv]
[root@master01 test]# cat templates/file.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  {{- $files := .Files }}
  {{- range tuple "config1.toml"  "config2.toml"  "config3.toml"  }}
  {{ . }}: |-
    {{ $files.Get . }}
  {{- end }}
[root@master01 test]# helm template . --show-only templates/file.yaml
---
# Source: test/templates/file.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  config1.toml: |-
    aa=bb

  config2.toml: |-
    aa=bb

  config3.toml: |-
    aa=bb
[root@master01 test]# cat templates/fromJson.yaml 
{{- $json:=(fromJson .Values.jsonTemp)}}
{{- range $key,$value:=$json}}
{{$key}}: {{$value}}
{{- end }}
[root@master01 test]# helm template . --show-only templates/fromJson.yaml
---
# Source: test/templates/fromJson.yaml
aa: bb
cc: dd
[root@master01 test]# cat templates/fromYaml.yaml 
{{- $v:= (fromYaml .Values.testYaml)}}
{{- range $key,$value:= $v.containers}}
{{$key}}: {{$value}}
{{- end}}
[root@master01 test]# helm template . --show-only templates/fromYaml.yaml
---
# Source: test/templates/fromYaml.yaml
image: b
name: a
[root@master01 test]# cat templates/global.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
data:
  salad: {{ .Values.global.salad }}
[root@master01 test]# helm template . --show-only templates/global.yaml
---
# Source: test/templates/global.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
data:
  salad: caesar
[root@master01 test]# cat templates/has.yaml 
{{- if .Capabilities.APIVersions.Has "batch/v1" }}
aa: bb
{{- end}}
[root@master01 test]# helm template . --show-only templates/has.yaml
---
# Source: test/templates/has.yaml
aa: bb
[root@master01 test]# cat templates/include.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configmap
  labels:
    {{- include "mychart.app" . | nindent 4 }}
data:
  myvalue: "Hello World"
  {{- range $key, $val := .Values.favorite }}
  {{ $key }}: {{ $val | quote }}
  {{- end }}
  {{- include "mychart.app" . | nindent 2 }}
[root@master01 test]# helm template . --show-only templates/include.yaml
---
# Source: test/templates/include.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: RELEASE-NAME-configmap
  labels:
    app_name: test
    app_version: "0.1.0+2020-04-11"
data:
  myvalue: "Hello World"
  drink: "coffee"
  food: "rice"
  fruit: 
  app_name: test
  app_version: "0.1.0+2020-04-11"
[root@master01 test]# cat templates/multifile.yaml 
apiVersion: v1
kind: ConfigMap
metadata:
  name: conf
data:
{{ (.Files.Glob "foo/*").AsConfig | indent 2 }}
---
apiVersion: v1
kind: Secret
metadata:
  name: very-secret
type: Opaque
data:
{{ (.Files.Glob "bar/*").AsSecrets | indent 2 }}
[root@master01 test]# helm template . --show-only templates/multifile.yaml
---
# Source: test/templates/multifile.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: conf
data:
  aa: |
    aa
  bb: |
    bb
---
# Source: test/templates/multifile.yaml
apiVersion: v1
kind: Secret
metadata:
  name: very-secret
type: Opaque
data:
  aa: YWEK
  bb: YmIK

[root@master01 test]# cat templates/Template.yaml 
data: {{ include (print $.Template.BasePath "/toYaml.yaml") .|b64enc }}
[root@master01 test]# helm template . --show-only templates/Template.yaml
---
# Source: test/templates/Template.yaml
data: YXBpVmVyc2lvbjogdjEKa2luZDogUG9kCm1lYXRkYXRhOgogIG5hbWU6IFJFTEVBU0UtTkFNRS1wb2QKc3BlYzoKICBjb250YWluZXJzOgogIC0gbmFtZTogbmdpbngKICAgIGltYWdlOiBuZ2lueAogICAgcmVzb3VyY2VzOgogICAgICBsaW1pdHM6CiAgICAgICAgY3B1OiAxMDBtCiAgICAgICAgbWVtb3J5OiAxMjhNaQogICAgICByZXF1ZXN0czoKICAgICAgICBjcHU6IDEwMG0K
[root@master01 test]# cat templates/toToml.yaml 
toml: |
{{toToml .Values.toml|indent 4 }}
[root@master01 test]# helm template . --show-only templates/toToml.yaml
---
# Source: test/templates/toToml.yaml
toml: |
    [test]
      aa = "bb"
      cc = "dd"
[root@master01 test]# cat templates/toYaml.yaml 
apiVersion: v1
kind: Pod
meatdata:
  name: {{.Release.Name}}-pod
spec:
  containers:
  - name: nginx
    image: nginx
{{toYaml .Values.resources|indent 4}}
[root@master01 test]# helm template . --show-only templates/toYaml.yaml
---
# Source: test/templates/toYaml.yaml
apiVersion: v1
kind: Pod
meatdata:
  name: RELEASE-NAME-pod
spec:
  containers:
  - name: nginx
    image: nginx
    resources:
      limits:
        cpu: 100m
        memory: 128Mi
      requests:
        cpu: 100m
[root@master01 test]# cat templates/tpl.yaml 
apiVersion: v1
kind: ConfigMap
matadata:
  name: {{.Release.Name}}-configmap
data:
  tcp: {{tpl .Values.tcp .}}
  name: {{ tpl .Values.template . }}
[root@master01 test]# helm template . --show-only templates/tpl.yaml
---
# Source: test/templates/tpl.yaml
apiVersion: v1
kind: ConfigMap
matadata:
  name: RELEASE-NAME-configmap
data:
  tcp: 5
  name: Tom
[root@master01 test]# cat templates/variableAssign.yaml 
ApiVersion: v1
Kind: ConfigMap
Metadata:
  name: {{ .Release.Name }}-configmap
Data:
  myvalue: "Hello World"
  # 由于下方的with语句引入相对命令空间,无法通过.Release引入,提前定义relname变量
  {{- $relname := .Release.Name -}}
  {{- with .Values.favorite }}
  food: {{ .food }}
  release: {{ $relname }}
  # 或者可以使用$符号,引入全局命名空间
  release: {{ $.Release.Name }}
  {{- end }}
[root@master01 test]# helm template . --show-only templates/variableAssign.yaml
---
# Source: test/templates/variableAssign.yaml
ApiVersion: v1
Kind: ConfigMap
Metadata:
  name: RELEASE-NAME-configmap
Data:
  myvalue: "Hello World"
  # 由于下方的with语句引入相对命令空间,无法通过.Release引入,提前定义relname变量
  food: rice
  release: RELEASE-NAME
  # 或者可以使用$符号,引入全局命名空间
  release: RELEASE-NAME

k8s use-context是什么 kubectl的命令用于在 Kubernetes 集群中切换上下文(context),从而方便地在多个集群或命名空间之间进行操作。一个上下文定义了kubectl使用的和的组合。 阅读详情

相关推荐

Helm Chart 模板进阶:5个Go模板函数与流程控制实战解析

本文深入解析Helm Chart模板进阶技巧,重点介绍5个核心Go模板函数(range、with、if/else、default、quote)及其在Kubernetes部署中的实战应用。通过动态资源配置案例,帮助开发者突破复杂配置模板化的瓶颈,提升Helm Chart开发效率与灵活性。

weixin_34080571的博客 424

k8s实战之kubectl

本课程将详细介绍k8s所有命令,以及命令的go源码分析,学习知其然,知其所以然

Kubernetes Kubectl top 命令

kubectl top命令可显⽰节点和Pod对象的资源使⽤信息,它依赖于集群中的资源指标API来收集各项指标数据。它包含有node和pod两个⼦命令,可分别⽤于显⽰Node对象和Pod对象的相关资源占⽤率。,例如下⾯显⽰所有节点的资源占⽤状况的结果中显⽰了各节点累计CPU资源占⽤时长及百分⽐,以及内容空间占⽤量及占⽤⽐例。⽽名称空间级别的Pod对象资源占⽤率的使⽤⽅式会略有不同,使⽤时,⼀般应该限定名称空间及使⽤标签选择器过滤出⽬标Pod对象。列出Node资源占⽤率命令的语法格式为。

专注基础架构领域 2551

helm源码分析之pull

发布一个k8s部署视频:https://edu.youkuaiyun.com/course/detail/26967 课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。 腾讯课堂连接地址https://ke.qq.com/course/478827?taid=4373109931462251&tuin=ba64518 第二个视频发布https://edu.youkuaiyun.com/c..

mark's technic world 1370

CST局部网格加密实战:从基础设置到Meshgroup高效管理

本文详细解析了CST电磁仿真软件中的局部网格加密技术,重点介绍Meshgroup功能的高效管理方法。通过平行板电容等实战案例,阐述从基础设置到多级加密策略的完整流程,帮助用户精准提升关键区域仿真精度,同时优化计算资源使用效率。

grafana6viz的博客 695

Label Studio 图像分割自动标注接入教程:从模型预测到一键上传 Predictions

这篇文章详细介绍了如何使用Label Studio进行图像分割任务的自动标注流程。主要内容包括: 环境准备:安装Label Studio和模型推理依赖 项目配置:启动Label Studio服务,创建项目并配置BrushLabels标注界面 数据准备:导入待标注图片,获取API访问凭证 模型推理:运行训练好的分割模型生成预测mask 结果上传:将预测结果转换为Label Studio格式并通过API上传为Predictions 文章提供了完整的操作指南,包括: 详细的命令行参数说明 推荐的项目目录结构 标注

. 452

Helm Chart 进阶:模板函数与条件判断

Helm Chart 的核心功能依赖于 Go 模板引擎,掌握模板函数和条件判断能显著提升模板的灵活性与复用性。通过组合函数与条件判断,可构建高度动态化的 Helm Chart,适应不同部署环境的需求。其中 $a$ 和 $b$ 满足 $a + b = \text{总副本数}$ 的逻辑关系。扩展函数库(200+ 函数),需通过。Go 模板原生函数(如。

2501_93878723的博客 362

Embarcadero Dev-C++ 6.3安装教程【保姆级】

Embarcadero Dev-C++ 6.3安装教程,保姆级教程~

Thebest_jack的博客 1万+

构建Helm chart和chart使用管道与函数简介

上一篇文章说到,我们可以通过helm将众多已经初步配置好的yaml文件下载来整合使用,甚至还可以自己定义好需要的安装参数用于下载完成后直接使用而不需要过多更改,现在仍然可以在这些功能上继续推进。

树下一少年的博客 985

Code Ocean 上传代码 手把手教程

对于一些学术期刊,录用前会让把代码上传到Code Ocean上,但上传过程可能会遇到一些问题,小编分享一下自己的上传经验。他们会进行验证,验证通过,将自动发布。点此运行即可,但是运行比较慢。

u014071947的博客 1万+

HFSS实战:手把手教你设计3.3-10.6GHz超宽带微带天线(附S11优化技巧)

本文提供了一份基于Ansys HFSS的超宽带微带天线实战设计指南,详细讲解了从3.3GHz到10.6GHz天线的建模、仿真与优化全流程。文章重点剖析了阻抗匹配的核心挑战,并分享了通过接地板开槽、参数化扫描及目标驱动优化等系统性技巧来优化S11曲线的实用方法,帮助射频工程师快速掌握超宽带天线设计的关键技能。

2y3u4i5o6p的博客 1081

Helm模板函数大全:高级Chart开发技巧

Helm作为Kubernetes的包管理器,其强大的模板功能是Chart开发的核心。模板函数让开发者能够动态生成Kubernetes清单文件,实现配置的灵活性和复用性。本文将深入解析Helm模板函数体系,帮助您掌握高级Chart开发技巧。 ## 模板函数体系概览 Helm模板函数基于Go模板语言,并集成了Sprig函数库和Helm特有的扩展函数。整个函数体系可以分为三大类: ```merma...

gitblog_00358的博客 1094

中兴交换机如何配置?有哪些常用的配置命令,本文值得收藏!

中兴交换机是一种常见的网络设备,用于构建和管理企业网络。它提供了丰富的功能和灵活的配置选项,使网络管理员能够根据特定需求进行定制化配置。本文将详细介绍中兴交换机的配置过程,包括登录、基本设置、VLAN配置、接口配置和安全配置等内容。

网络技术联盟站 1万+

《Helm Chart 进阶:模板函数与条件判断的使用》

Helm Chart 是 Kubernetes 应用包管理工具,其核心是模板引擎,用于动态生成 Kubernetes 清单文件。在进阶使用中,模板函数和条件判断能显著提升模板的灵活性和可维护性。通过合理使用模板函数和条件判断,您可以创建更智能、可配置的 Helm Chart,提升部署效率。如果有具体场景问题,欢迎提供更多细节,我将提供针对性指导。Helm 基于 Go 模板语言,内置了丰富的函数库,用于数据处理、字符串操作等。下面是一个完整示例,展示如何在 Helm Chart 中结合函数和条件判断。

2501_93893253的博客 412

uniapp - 解决报错 canvasToTempFilePath: fail canvas is empty 画布为空错误,生成海报相册、二维码、条码、裁剪/拼合操作图片报错,加了this还是报错

uni-app,h5移动端网页,微信小程序,支付宝小程序,Android安卓,苹果ios,app,nvue,canvasToTempFilePath:失败画布为空,报错,canvasToTempFilePath:failcanvasisempty,不支持2d,还是报错,this,加上this还是报错,vue3没有this怎么办?海报,保存到手机相册,生成二维码,显示条码,图像裁切,图片处理,canvas报错,无法解决,还是fail,依然报错,传了this也不好使,Uniapp小程序,如何解决这个问题

🏆 前端领域优质创作者 4715

【论文复现】——基于改进FPFH特征提取的点云模板匹配方法

基于改进FPFH特征提取的点云模板匹配方法 [J]. 应用激光, 2024, 44 (04): 196-204.

点云侠的博客 613

Helm chart 内置函数

文章目录1. 定义 chart2. 创建模板3. 添加一个简单的模板4. 调试5. 内置对象6. values 文件 1. 定义 chart Helm 的 github 上面有一个比较完整的文档,一个 chart 包就是一个文件夹的集合,文件夹名称就是 chart 包的名称,比如创建一个 mychart 的 chart 包: $ helm create mychart Creating mychart $ tree mychart/ mychart/ ├── charts ├── Chart.yaml ├

爱死亡机器人 1082

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Helm Chart 开发 :7个常用的Helm 函数

点击上方蓝字⭐️关注“DevOps云学堂”,接收最新技术实践今天是「DevOps云学堂」与你共同进步的第34天第⑦期DevOps实战训练营·招新中Helm是Kubernetes的包管理器。我们大部分时间花在使用现成的Chart上。但通常企业中应用部署的情况下,我们会具有开发创建Helm Chart的必要性。想要制作自己的 Helm Chart的原因有很多。也许最直接的就是打包您自己的应用程序。...

DevOps持续集成的博客 795

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

【Docker-Day 44】Helm 进阶:从 `values.yaml` 到模板函数,亲手打造可复用的高质量 Chart

Helm 的真正威力并不仅仅在于使用他人预先打包好的 Chart,更在于其强大的定制化能力。这种能力的核心便是其模板引擎。本文将深入 Helm Chart 的两大基石——**模板(Templates)**与**值(Values)**,详细拆解其工作原理、语法规则以及最佳实践。通过本文,你将学会如何阅读、修改甚至从零开始创建灵活、可复用且高度可配置的 Helm Chart,真正实现对 Kubernetes 应用部署的精细化掌控。

吴师兄大模型的博客 1284

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

helm-chart3,函数和管道

目录 一个简单的函数 管道 和几个函数 一个简单的函数 quote : 引入字符串,具体看示例: apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap data: myvalue: "Hell...

weixin_30501857的博客 337

Kubernetes Helm Chart模板语法:函数与管道

Helm template快速入门 Helm是Kubernetes的包管理工具,如果把比作操作系统,那么Helm就好比yum,apt-get,homebrew。使用Helm template可以方便我们部署和管理自己的应用。本篇将基于Helm3.0+带你快速入门Helm template。 Prerequisite 若需要执行本篇示例,需要准备: 安装Helm (Helm 3.0+) 一个Kubernetes集群 Quick Start 在开始之前,我们简单理解一下Helm temp..

小楼一夜听春雨,深巷明朝卖杏花 4834

【笔记ing】Helm-5 Chart模板指南-5 模板函数列表

如果不是,就返回值。Helm包括了需要逻辑和流控制函数,包括and,coalesce,default,empty,eq,fail,ge,gt,le,lt,ne,not,and or。如果给定的值被认为是空的,则empty函数返回true,否则返回false。如果第一参数小于等于第二参数,返回布尔真,否则返回假(比如,Arg1 <= Arg2)。如果第一参数大于第二参数,返回布尔真,否则返回假(比如,Arg1 >= Arg2)。如果第一参大于第二参数,返回布尔真,否则返回假(比如,Arg1 > Arg2)。

m0_46141283的博客 1194

Helm Chart 工程化:模板拆分后,维护和复用才真正落地

Helm Chart 工程化的核心是职责拆分和依赖组合。共享组件作为独立子 Chart 发布,业务服务通过别名引用,父 Chart 统一编排全局参数。别名机制支持同一子 Chart 部署多实例,参数在父 Chart 的 values.yaml 中按别名分组。共享模板函数放在,减少模板重复代码。简单部署场景用模板拆分即可,复杂平台用子 Chart 组合。子 Chart 版本通过 Chart.yaml 约束管理,CI 流水线自动更新依赖。

m0_50889382的博客 3301

【笔记】Helm-5 Chart模板指南-4 模板函数和流水线

模板函数和流水线仅用于本人学习。

m0_46141283的博客 565
上一篇: chart语法总体介绍
下一篇: 手写chart
hxpjava1
博客等级 码龄19年 1365粉丝 511原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hxpjava1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值