下面是我的values.yaml的一部分 值.yaml
image:
tag: "${CI_COMMIT_SHORT_SHA}"
在 git CI 中运行安装时,我可以轻松地传递覆盖,如下所示。
helm install <release name> --set image.tag=${CI_COMMIT_SHORT_SHA} <chart name>
现在,我们已经编写了 argocd 应用程序清单来安装 helm。但不确定我们如何传递引用并传递提交 SHA id 作为图像标签覆盖。
argocd 清单文件如下。
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
namespace: argocd
spec:
destination:
namespace: my-app
server: 'https://destination-cluster'
project: default
syncPolicy:
automated:
prune: true
selfHeal: true
source:
repoURL: 'https://my-git-service/repo/my-app.git'
path: chart/my-app
targetRevision: main
helm:
image.tag: <Here-I-Need-SHA-Value>
任何帮助都会很棒!
在撰写本文时,您可以使用四种不同的方法:
spec.source.helm.parameters
source:
helm:
parameters:
- name: "image.tag"
value: "my-image-tag"
spec.source.helm.valueFiles
引用值文件:
source:
helm:
valueFiles:
- values-overide.yaml
spec.source.helm.valuesObject
用于在对象中提供它们:
source:
helm:
valuesObject:
image:
tag: "my-image-tag"
spec.source.helm.values
用于提供内联值:
source:
helm:
values: |
image:
tag: "my-image-tag"
完整的 Argo CD 头盔应用程序,使用
spec.source.helm.valuesObject
将 image.tag
传递到 bitnami 密封秘密头盔图表:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: sealed-secrets
namespace: argocd
spec:
project: default
destination:
server: "https://kubernetes.default.svc"
namespace: kubeseal
source:
chart: bitnamicharts/sealed-secrets
repoURL: oci://registry-1.docker.io
targetRevision: 1.5.3
helm:
releaseName: sealed-secrets
valuesObject:
image:
tag: "0.24.0-debian-11-r0"