亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

“if and (ne)”運算符在 helm 中是如何工作的?

“if and (ne)”運算符在 helm 中是如何工作的?

Go
尚方寶劍之說 2022-06-21 10:59:48
我正在使用一個開始時具有以下結構的圖表,但我很難理解何時評估為真的。{{- 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 或非值(請注意,這僅在實際定義父地圖時才有效!否則模板錯誤)


查看完整回答
反對 回復 2022-06-21
  • 1 回答
  • 0 關注
  • 260 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號