1

我的图表定义如下

 my-charts/
  |_  app1
       |
       |_Chart.yaml
       |_ values-dev.yaml
       |_ values.yaml
       |_ .helmignore
       |_ template/
             |_ app1-microservice1-deployment.yaml  (k8s deployment definition)
             |_ app1-microservice1-service-defintion.yaml   (k8s service definition)
             |_ app1-microservice2-deployment.yaml
             |_ app1-microservice2-service-defintion.yaml

假设我只想部署模板

  • app1-microservice1-deployment.yaml
  • app1-microservice1-service-defintion.yaml

有没有办法实现它。

  • 如果我.helmignore与其他app1-microservice2*.yaml文件一起使用会helm install/upgrade忽略这些文件的部署?
  • 这方面是否有任何最佳实践。

此外,在 helm3 中,Chart.yaml任何自定义字段/属性都可以包含在annotation每个文档中。

apiVersion: v2
description: application description
name: app1-microservices
version: 1.0.1

# Is the below possible in helm3
projectNames: microservice1,microservice2
imageRepo:
   microservice1: app1/microservice1
   microservice2: app1/microservice2

如果在 Chart.yaml 中包含自定义属性会发生什么。

我正在探索掌舵,如果问题不够清楚,请道歉。

4

2 回答 2

0

您需要在.helmignore文件中添加以下行。

templates/wapp1-microservice2-*

然后 helm 应该处理剩下的事情。

于 2022-02-14T15:58:26.020 回答
0
  • 在 helm3 Chart.yaml 中,任何自定义字段/属性都可以包含在文档的注释中。
    • 除文档中指定的任何值。
    • 下面在 helm 渲染时工作正常,但是这个 projectNames 不能被.Chart.projectNames.
apiVersion: v2
name: example2
description: A Helm chart for Kubernetes

type: application

version: 0.1.0

appVersion: "1.16.0"

projectNames: ["app1","app2"]

为了跳过在 helm 中呈现的特定部署,我们可以使用将 template.yaml 与 {{- if .Values.enabledForRelease }}...

于 2021-10-03T18:13:22.267 回答