我的秘密檔案看起來像:
apiVersion: v1
kind: Secret
metadata:
name: secret
type: Opaque
stringData:
"user.name": "user"
"user.password": "password"
我正在嘗試使用下一個代碼獲取值:
{{- $secret := lookup "v1" "Secret" .Release.Namespace "secret" -}}
{{- if $secret -}}
{{- print $secret.data.user.password}}
問題是“user.password”鍵包含一個點,我還沒有找到如何修復它。謝謝你的幫助!
uj5u.com熱心網友回復:
您可以使用該index函式訪問帶有點的地圖值,例如:
{{- print (index $secret.data "user.password")}}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/358279.html
標籤:走 Kubernetes kubernetes-helm 模板
上一篇:在字串中的單詞之間添加字符
下一篇:具有相同欄位的Sqlx連接表
