简体   繁体   English

如何将部署的全名传递给helm values.yaml中的变量?

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

How to pass the fullname of a dependant chart into another chart in the values.yaml ? 如何将从属图表的fullname传递到values.yaml另一个图表中?

My values.yaml looks like this: 我的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

In there, I need to pass the name of the postgresql instance to prisma . 在这里,我需要将postgresql实例的名称传递给prisma

If I try to install this, it gives me the following error: 如果我尝试安装此程序,则会出现以下错误:

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

If your charts looking as: 如果您的图表看起来像:

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

in prisma values.yaml define: 在pyramida values.yaml中定义:

dbhost: defaultdbhost

Then you can define in global values.yaml: 然后,您可以在全局values.yaml中进行定义:

prisma:
  dbhost: mydbhost

And into prisma.yaml use: 并转换为prisma.yaml,使用:

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

For understand overriding values read this document 要了解覆盖值,请阅读本文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM