【问题标题】:how to add regex condition in helm chart?如何在掌舵图中添加正则表达式条件?
【发布时间】:2021-08-03 06:45:26
【问题描述】:

有人能帮帮我吗,如何在舵图中添加不包含?

{{- 如果包含“sidecar”.name }}

使用上述条件不应该在条件中寻找sidecar,如何添加否定条件?

【问题讨论】:

    标签: kubernetes-helm go-templates


    【解决方案1】:

    在核心Go text/template language中,有一个not操作符(其实是一个普通函数)。

    {{- if not (contains "sidecar" .name) }}...{{ end }}
    

    您还可以为匹配的情况设置一个空块,并将需要输出的任何内容放在“else”块中。

    {{- if contains "sidecar" .name }}
    {{- else }}
    ... whatever needs to be output ...
    {{- end }}
    

    【讨论】:

      猜你喜欢
      • 2017-01-22
      • 2021-09-29
      • 2019-03-15
      • 2020-01-07
      • 2011-10-30
      • 1970-01-01
      • 2015-06-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多