简体   繁体   English

在依赖关系图中覆盖 values.yaml - MongoDb

[英]Override values.yaml in a dependency chart - MongoDb

I have a requirements.yaml file:我有一个 requirements.yaml 文件:

dependencies:
  - name: mongodb-replicaset
    # Can be found with "helm search <chart>"
    version: 3.13.0
    # This is the binaries repository, as documented in the GitHub repo
    repository: https://kubernetes-charts.storage.googleapis.com/

And i want to modify the values.yaml file of the mongodb-replicaset chart , espacialy this section:我想修改 mongodb-replicaset 图表的 values.yaml 文件,尤其是这部分:

auth:

  enabled: false
  existingKeySecret: ""
  existingAdminSecret: ""
  existingMetricsSecret: ""
  # adminUser: username
  # adminPassword: password
  # metricsUser: metrics
  # metricsPassword: password
  # key: keycontent

How can i override the values.yaml file on initialization in a dependency chart?如何在依赖关系图中的初始化时覆盖 values.yaml 文件?

You put the values under a key matching the name of the upstream chart so您将值放在与上游图表名称匹配的键下,以便

mongodb-replicaset:
  auth:
    enabled: true
    etc etc

I would say workflow can be next:我会说工作流程可以是下一个:

1) download everything locally using helm dependency update - When helm dependency update retrieves charts, it will store them as chart archives in the charts/ directory. 1) 使用helm 依赖更新在本地下载所有内容 - 当 helm 依赖更新检索图表时,它会将它们作为图表存档存储在 charts/ 目录中。

Example from official documentation来自官方文档的示例

$ helm dep up foochart
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "local" chart repository
...Successfully got an update from the "stable" chart repository
...Successfully got an update from the "example" chart repository
...Successfully got an update from the "another" chart repository
Update Complete.
Saving 2 charts
Downloading apache from repo http://example.com/charts
Downloading mysql from repo http://another.example.com/charts

2) change values.yaml under mongodb-replicaset chart as was suggested by @coderanger 2) 按照@coderanger 的建议更改 mongodb-replicaset 图表下的 values.yaml

3)deploy helm chart using local downloded|\\modified files 3)使用本地下载|\\修改文件部署舵图

Another option is to check is: parent values.yaml charts config file.另一种选择是检查:父 values.yaml 图表配置文件。 As per Subcharts and Global Values :根据子图和全局值

-A subchart is considered “stand-alone”, which means a subchart can never explicitly depend on its parent chart. - 子图被认为是“独立的”,这意味着子图永远不能明确依赖其父图。

-For that reason, a subchart cannot access the values of its parent. - 因此,子图无法访问其父图的值。

-A parent chart can override values for subcharts. - 父图表可以覆盖子图表的值。

-Helm has a concept of global values that can be accessed by all charts. -Helm 有一个全局值的概念,所有图表都可以访问。

Please look into "Overriding Values from a Parent Chart" section of Subcharts and Global Values documentation - it has an example how to override subcharts values using global one.请查看子图表和全局值文档的“覆盖父图表中的值”部分 - 它有一个示例如何使用全局值覆盖子图表值。

Hope it helps希望能帮助到你

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

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