我正在使用一個開始時具有以下結構的圖表,但我很難理解何時評估為真的。{{- if and .Values.vpceIngress.enabled .Values.http.paths (ne .Values.vpceIngress.class "traefik2") }}我相信兩者都是enabled真實paths的,但ne在那之后讓我失望了。
1 回答

FFIVE
TA貢獻1797條經驗 獲得超6個贊
and并且ne是go templates中的函數。
and
Returns the boolean AND of its arguments by returning the
first empty argument or the last argument, that is,
"and x y" behaves as "if x then y else x". All the
arguments are evaluated.
ne
Returns the boolean truth of arg1 != arg2
所以模板行相當于一個更偽的 codish
if (
.Values.vpceIngress.enabled
&& .Values.http.paths
&& .Values.vpceIngress.class != "traefik2"
)
純文本的真實性.Value.key基本上是“此字段/鍵不是數據類型的零值。這也適用于映射,因為“此字段/鍵是否已定義”,因為映射沒有該路徑等于 nil 或非值(請注意,這僅在實際定義父地圖時才有效!否則模板錯誤)
- 1 回答
- 0 關注
- 260 瀏覽
添加回答
舉報
0/150
提交
取消