Helm,有没有办法将 kubernetes 标签添加到 values.yaml(不使用模板和 _helpers.tpl)

Fre*_*igo 2 kubernetes kubernetes-helm helmfile

所以就像标题一样,我想为我已经运行的应用程序(来自官方掌舵图表的 sonarqube 和 jenkins)的掌舵添加标签。我没有模板只有 values.yaml。我害怕添加模板,因为正如我所说,应用程序已经在运行,我只想在元数据中添加几个标签。

rko*_*egi 5

有问题的评论中提到的两个图表都有定义自定义标签的方法

https://github.com/jenkinsci/helm-charts/blob/main/charts/jenkins/templates/jenkins-master-deployment.yaml#L42

    {{- range $key, $val := .Values.master.podLabels }}
    {{ $key }}: {{ $val | quote }}
    {{- end}}
Run Code Online (Sandbox Code Playgroud)

https://github.com/Oteemo/charts/blob/master/charts/sonarqube/templates/deployment.yaml#L31

{{- with .Values.podLabels }}
{{ toYaml . | indent 8 }}
{{- end }}
Run Code Online (Sandbox Code Playgroud)

所以你需要这样的东西 values.yaml

# Jenkins
master:
  podLabels:
    label1Name: label1Value

# Sonar
podLabels:
  label1Name: label1Value
Run Code Online (Sandbox Code Playgroud)