且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何根据values.yaml中的输入使头盔释放失败

更新时间:2023-10-25 17:44:40

我能够通过以下更改实现用例. 在_helpers.tpl

I was able to achieve the use case with below changes. Added the following code in _helpers.tpl

{{- define "actionValidate" -}}
  {{ $action := .Values.actions }}
  {{- if or (eq $action "action1") (eq $action "action2") (eq $action "action3") -}}
    true
  {{- end -}}
{{- end -}}

从.tpl文件中调用此函数,如下所示:-

Invoked this function from a .tpl file like this:-

{{ include "actionValidate" .  | required "Action value is incorrect. The valid values are 'action1', 'action2', 'action3' " }}