Skip to content

Commit

Permalink
Merge pull request #57 from junotx/node-exporter
Browse files Browse the repository at this point in the history
[prometheus-node-exporter] support to use global.imageRegistry for nginx image
  • Loading branch information
benjaminhuo authored Mar 13, 2024
2 parents 4726cab + ff16fd0 commit 7151996
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-node-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
25 changes: 25 additions & 0 deletions charts/prometheus-node-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/prometheus-node-exporter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions charts/prometheus-node-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down Expand Up @@ -729,6 +730,6 @@ CalicoExporter:

kubeRbacProxy:
image:
repository: kubesphere/kube-rbac-proxy
repository: brancz/kube-rbac-proxy
tag: v0.14.0
resources: {}

0 comments on commit 7151996

Please sign in to comment.