From ff16fd0b0a38271cf68eb758582f6fd7d4e7c1fd Mon Sep 17 00:00:00 2001 From: junot Date: Wed, 13 Mar 2024 18:16:36 +0800 Subject: [PATCH] [prometheus-node-exporter] support to use global.imageRegistry for nginx image Signed-off-by: junot --- charts/prometheus-node-exporter/Chart.yaml | 2 +- .../charts/calico-exporter/Chart.yaml | 2 +- .../calico-exporter/templates/_images.tpl | 16 +++++++----- .../charts/calico-exporter/values.yaml | 3 ++- .../prometheus-process-exporter/Chart.yaml | 2 +- .../templates/_images.tpl | 12 ++++----- .../templates/_helpers.tpl | 25 +++++++++++++++++++ .../templates/daemonset.yaml | 2 +- charts/prometheus-node-exporter/values.yaml | 5 ++-- 9 files changed, 50 insertions(+), 19 deletions(-) diff --git a/charts/prometheus-node-exporter/Chart.yaml b/charts/prometheus-node-exporter/Chart.yaml index 8f2ae2d39421..2fe13dfdfbbf 100644 --- a/charts/prometheus-node-exporter/Chart.yaml +++ b/charts/prometheus-node-exporter/Chart.yaml @@ -6,7 +6,7 @@ keywords: - prometheus - exporter type: application -version: 4.21.3 +version: 4.21.4 appVersion: 1.6.0 home: https://github.com/prometheus/node_exporter/ sources: diff --git a/charts/prometheus-node-exporter/charts/calico-exporter/Chart.yaml b/charts/prometheus-node-exporter/charts/calico-exporter/Chart.yaml index 85dcec37fd15..73f4d2e668ec 100644 --- a/charts/prometheus-node-exporter/charts/calico-exporter/Chart.yaml +++ b/charts/prometheus-node-exporter/charts/calico-exporter/Chart.yaml @@ -16,7 +16,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.1 +version: 0.2.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. diff --git a/charts/prometheus-node-exporter/charts/calico-exporter/templates/_images.tpl b/charts/prometheus-node-exporter/charts/calico-exporter/templates/_images.tpl index 96ba7f885b1f..2e868e1da74c 100644 --- a/charts/prometheus-node-exporter/charts/calico-exporter/templates/_images.tpl +++ b/charts/prometheus-node-exporter/charts/calico-exporter/templates/_images.tpl @@ -1,17 +1,21 @@ {{- define "calico-exporter.common.image" -}} {{- if .Values.image.digest }} -{{- if .Values.global.imageRegistry }} -{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag .Values.image.digest }} -{{- else if .Values.registry }} +{{- if .Values.image.registry }} {{- printf "%s/%s:%s@%s" .Values.image.registry .Values.image.repository .Values.image.tag .Values.image.digest }} +{{- else if .Values.global.imageRegistry }} +{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag .Values.image.digest }} +{{- else if .Values.image.defaultRegistry }} +{{- printf "%s/%s:%s@%s" .Values.image.defaultRegistry .Values.image.repository .Values.image.tag .Values.image.digest }} {{- else }} {{- printf "%s:%s@%s" .Values.image.repository .Values.image.tag .Values.image.digest }} {{- end }} {{- else }} -{{- if .Values.global.imageRegistry }} -{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag }} -{{- else if .Values.registry }} +{{- if .Values.image.registry }} {{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag }} +{{- else if .Values.global.imageRegistry }} +{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag }} +{{- else if .Values.image.defaultRegistry }} +{{- printf "%s/%s:%s" .Values.image.defaultRegistry .Values.image.repository .Values.image.tag }} {{- else }} {{- printf "%s:%s" .Values.image.repository .Values.image.tag }} {{- end }} diff --git a/charts/prometheus-node-exporter/charts/calico-exporter/values.yaml b/charts/prometheus-node-exporter/charts/calico-exporter/values.yaml index 2eb8c4430da4..97bfb86b4c80 100644 --- a/charts/prometheus-node-exporter/charts/calico-exporter/values.yaml +++ b/charts/prometheus-node-exporter/charts/calico-exporter/values.yaml @@ -98,8 +98,9 @@ tolerations: kubeRbacProxy: image: + defaultRegistry: "quay.io" registry: "" - repository: kubesphere/kube-rbac-proxy + repository: brancz/kube-rbac-proxy tag: v0.14.0 digest: "" pullPolicy: IfNotPresent diff --git a/charts/prometheus-node-exporter/charts/prometheus-process-exporter/Chart.yaml b/charts/prometheus-node-exporter/charts/prometheus-process-exporter/Chart.yaml index 950f19a825a6..fc364d75b965 100644 --- a/charts/prometheus-node-exporter/charts/prometheus-process-exporter/Chart.yaml +++ b/charts/prometheus-node-exporter/charts/prometheus-process-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "0.5.0" description: A Helm chart for prometheus process-exporter name: ProcessExporter -version: 0.5.5 +version: 0.5.6 home: https://github.com/mumoshu/prometheus-process-exporter sources: - https://github.com/ncabatoff/process-exporter diff --git a/charts/prometheus-node-exporter/charts/prometheus-process-exporter/templates/_images.tpl b/charts/prometheus-node-exporter/charts/prometheus-process-exporter/templates/_images.tpl index ec29386fd8d2..06e56908f7c9 100644 --- a/charts/prometheus-node-exporter/charts/prometheus-process-exporter/templates/_images.tpl +++ b/charts/prometheus-node-exporter/charts/prometheus-process-exporter/templates/_images.tpl @@ -1,17 +1,17 @@ {{- define "prometheus-process-exporter.common.image" -}} {{- if .Values.image.digest }} -{{- if .Values.global.imageRegistry }} -{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag .Values.image.digest }} -{{- else if .Values.registry }} +{{- if .Values.image.registry }} {{- printf "%s/%s:%s@%s" .Values.image.registry .Values.image.repository .Values.image.tag .Values.image.digest }} +{{- else if .Values.global.imageRegistry }} +{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag .Values.image.digest }} {{- else }} {{- printf "%s:%s@%s" .Values.image.repository .Values.image.tag .Values.image.digest }} {{- end }} {{- else }} -{{- if .Values.global.imageRegistry }} -{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag }} -{{- else if .Values.registry }} +{{- if .Values.image.registry }} {{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag }} +{{- else if .Values.global.imageRegistry }} +{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag }} {{- else }} {{- printf "%s:%s" .Values.image.repository .Values.image.tag }} {{- end }} diff --git a/charts/prometheus-node-exporter/templates/_helpers.tpl b/charts/prometheus-node-exporter/templates/_helpers.tpl index 84552fe475a9..1eac025c468a 100644 --- a/charts/prometheus-node-exporter/templates/_helpers.tpl +++ b/charts/prometheus-node-exporter/templates/_helpers.tpl @@ -71,6 +71,31 @@ Create the name of the service account to use {{- end }} {{- end }} +{{- define "prometheus-node-exporter.common.image" -}} +{{- if .Values.image.digest }} +{{- if .Values.image.registry }} +{{- printf "%s/%s:%s@%s" .Values.image.registry .Values.image.repository .Values.image.tag .Values.image.digest }} +{{- else if .Values.global.imageRegistry }} +{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag .Values.image.digest }} +{{- else }} +{{- printf "%s:%s@%s" .Values.image.repository .Values.image.tag .Values.image.digest }} +{{- end }} +{{- else }} +{{- if .Values.image.registry }} +{{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag }} +{{- else if .Values.global.imageRegistry }} +{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.image.repository .Values.image.tag }} +{{- else }} +{{- printf "%s:%s" .Values.image.repository .Values.image.tag }} +{{- end }} +{{- end }} +{{- end }} + +{{- define "prometheus-node-exporter.nginx.image" }} + {{- $imageDict := dict "Values" (dict "image" .Values.nginx.image "global" .Values.global) }} + {{- include "prometheus-node-exporter.common.image" $imageDict }} +{{- end }} + {{/* The image to use */}} diff --git a/charts/prometheus-node-exporter/templates/daemonset.yaml b/charts/prometheus-node-exporter/templates/daemonset.yaml index fd0c517d3141..4c81156edc27 100644 --- a/charts/prometheus-node-exporter/templates/daemonset.yaml +++ b/charts/prometheus-node-exporter/templates/daemonset.yaml @@ -240,7 +240,7 @@ spec: {{- end }} {{- if or .Values.CalicoExporter.enabled .Values.ProcessExporter.enabled }} - name: nginx - image: {{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }} + image: {{ include "prometheus-node-exporter.nginx.image" . }} imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} ports: - name: nginx diff --git a/charts/prometheus-node-exporter/values.yaml b/charts/prometheus-node-exporter/values.yaml index fd99ce72c807..54ce100cb6b1 100644 --- a/charts/prometheus-node-exporter/values.yaml +++ b/charts/prometheus-node-exporter/values.yaml @@ -475,8 +475,9 @@ extraManifests: [] # Nginx configuration for prometheus-node-exporter nginx: image: + registry: "" repository: nginxinc/nginx-unprivileged - tag: 1.24 + tag: '1.24' pullPolicy: IfNotPresent port: 18102 resources: {} @@ -729,6 +730,6 @@ CalicoExporter: kubeRbacProxy: image: - repository: kubesphere/kube-rbac-proxy + repository: brancz/kube-rbac-proxy tag: v0.14.0 resources: {}