gpt4 book ai didi

kubernetes - 向第 3 方 Helm 图添加功能的推荐方法?

转载 作者:行者123 更新时间:2023-12-02 11:43:14 27 4
gpt4 key购买 nike

目前我们正在向我们正在部署的第 3 方 helm 图表添加功能(例如 - 在 prometheus 中,我们正在添加身份验证支持,因为我们使用 nginx 入口 Controller )。

显然,当我们想要升级这些 helm chart 时,这会让我们很头疼,我们需要对我们的更改执行“diffs”。

向现有第 3 方 Helm 图表添加功能的推荐方法是什么?我应该使用伞状图表并使用普罗米修斯作为依赖吗?然后从图表中导入值? ( https://github.com/helm/helm/blob/master/docs/charts.md#importing-child-values-via-requirementsyaml )

或者其他推荐的方式?

-- 编辑--

示例 - 如您所见,我添加了 3 个 nginx.ingress.* 注释以支持 prometheus 入口资源的基本身份验证 - 当然,如果我要升级,我将需要再次手动添加,会出问题

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
{{- if .Values.prometheus.ingress.annotations }}
annotations:
{{ toYaml .Values.prometheus.ingress.annotations | indent 4 }}
{{- end }}
{{- if .Values.alertmanager.ingress.nginxBasicAuthEnabled }}
nginx.ingress.kubernetes.io/auth-realm: "Authentication Required - ok"
nginx.ingress.kubernetes.io/auth-secret: {{ template "prometheus-operator.fullname" . }}-prometheus-basicauth
nginx.ingress.kubernetes.io/auth-type: "basic"
{{- end }}
name: {{ $serviceName }}
labels:
app: {{ template "prometheus-operator.name" . }}-prometheus
{{ include "prometheus-operator.labels" . | indent 4 }}
{{- if .Values.prometheus.ingress.labels }}
{{ toYaml .Values.prometheus.ingress.labels | indent 4 }}
{{- end }}
spec:
rules:
{{- range $host := .Values.prometheus.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: "{{ $routePrefix }}"
backend:
serviceName: {{ $serviceName }}
servicePort: 9090
{{- end }}
{{- if .Values.prometheus.ingress.tls }}
tls:
{{ toYaml .Values.prometheus.ingress.tls | indent 4 }}
{{- end }}
{{- end }}

最佳答案

我认为这可能会回答您的 question .

这让我找到了 specific part I was looking for ,其中父图表可以通过将图表名称指定为父 values.yaml 中的键来覆盖子图表。

在应用程序图表的requirements.yaml中:

dependencies:
- name: jenkins
# Can be found with "helm search jenkins"
version: '0.18.0'
# This is the binaries repository, as documented in the GitHub repo
repository: 'https://kubernetes-charts.storage.googleapis.com/'

运行:

helm dependency update

在应用程序图表的 values.yaml 中:

# ...other normal config values

# Name matches the sub-chart
jenkins:
# This will be override "someJenkinsConfig" in the "jenkins" sub-chart
someJenkinsConfig: value

关于kubernetes - 向第 3 方 Helm 图添加功能的推荐方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57867081/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com