簡體   English   中英

如何將部署的全名傳遞給helm values.yaml中的變量?

[英]How to pass a deployment's full name to a variable in helm values.yaml?

如何將從屬圖表的fullname傳遞到values.yaml另一個圖表中?

我的values.yaml看起來像這樣:

##
## Prisma chart configuration
##
prisma:
  enabled: true
  image:
    pullPolicy: Always
  auth:
    enabled: true
    secret: scret
  database:
    host: {{ template "postgresql.fullname" . }}
    port: 5432
    password: dbpass


##
## Postgreqsl chart configuration
##
postgresql:
  enabled: true
  imagePullPolicy: Always
  postgresqlUsername: prisma
  postgresqlPassword: dbpass
  persistence:
    enabled: true
    storageClass: storage-0

在這里,我需要將postgresql實例的名稱傳遞給prisma

如果我嘗試安裝此程序,則會出現以下錯誤:

error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{"template \"postgresql.fullname\" .":interface {}(nil)}

如果您的圖表看起來像:

charts
--- prisma
----- templates
------- prisma.yaml
----- values.yaml
--- postgresql
----- templates
------- postgresql.yaml
----- values.yaml
requirements.yaml
values.yaml

在pyramida values.yaml中定義:

dbhost: defaultdbhost

然后,您可以在全局values.yaml中進行定義:

prisma:
  dbhost: mydbhost

並轉換為prisma.yaml,使用:

prisma:
  enabled: true
  image:
    pullPolicy: Always
  auth:
    enabled: true
    secret: scret
  database:
    host: {{ .Values.dbhost }}
    port: 5432
    password: dbpass

要了解覆蓋值,請閱讀本文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM