如果 .Release.Name 是 payment-wechat-api
,如何拆分为 payment-wechat
与 api
?
(splitList "-" .Release.Name) | initial | join "-"
得到 payment-wechat
(splitList "-" .Release.Name) | last
得到 api
模板代码如下:
subPath: {{ (splitList "-" .Release.Name) | initial | join "-" }}/{{ (splitList "-" .Release.Name) | last }}/
initial
的作用:
This compliments
last
by returning all but the last element.