别名图表依赖项的通用值

6rvt4ljy  于 2022-09-20  发布在  Kubernetes
关注(0)|答案(2)|浏览(133)

我已将Chart.yaml作为:

dependencies:
    - name: mysql
      version: "5.0.9"
      repository: "https://charts.bitnami.com/bitnami"
      alias: a
    - name: mysql
      version: "5.0.9"
      repository: "https://charts.bitnami.com/bitnami"
      alias: b

values.yaml AS

mysql:
  somename: Overriden
  somename2: NotOverriden
a:
  somename: A
b:
  somename: B

但舵机只读取a:b:的值。我希望mysql:中的值同时应用于a:b:,并在需要时被覆盖。

这有可能吗,或者有其他方法吗?

bnl4lu3b

bnl4lu3b1#

也许我没有回答这个问题,但您可以使用全局值:

Https://helm.sh/docs/chart_template_guide/subcharts_and_globals/#global-chart-values

values.yaml

global:
  somename: A
  somename2: B

顺便说一句,在您的示例中,不能有两次相同的依赖项,Helm将删除第一个:

❯ helm dependency build
Getting updates for unmanaged Helm repositories...
...Successfully got an update from the "https://charts.bitnami.com/bitnami" chart repository
Saving 2 charts
Downloading mysql from repo https://charts.bitnami.com/bitnami
Already downloaded mysql from repo https://charts.bitnami.com/bitnami
Deleting outdated charts
qqrboqgw

qqrboqgw2#

您可以使用YAML锚和别名。

mysql: &mysql
      somename: Overriden
      somename2: NotOverriden
    a:
      <<: *mysql
      somename: A
    b:
      <<: *mysql
      somename: B

相关问题