feat(argocd-image-updater): Optionally expose metrics (#1005)

* feat(argocd-image-updater): Optionally expose metrics

Signed-off-by: Jan Pieper <kontakt@jan-pieper.info>

* Apply suggestions from code review

Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>

* Add missing link references to README

Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>

Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
This commit is contained in:
Jan Pieper 2021-11-09 22:14:17 +01:00 committed by GitHub
parent 5e18356d25
commit a4b05b43e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 123 additions and 4 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
name: argocd-image-updater
description: A Helm chart for Argo CD Image Updater, a tool to automatically update the container images of Kubernetes workloads which are managed by Argo CD
type: application
version: 0.2.1
version: 0.3.0
appVersion: v0.10.1
home: https://github.com/argoproj-labs/argocd-image-updater
icon: https://argocd-image-updater.readthedocs.io/en/stable/assets/logo.png
@ -15,4 +15,4 @@ maintainers:
url: https://argoproj.github.io/
annotations:
artifacthub.io/changes: |
- "[Fixed]: Update default values example for extraArgs
- "[Added]: Ability to expose metrics and deploy a Prometheus ServiceMonitor"

View file

@ -66,13 +66,24 @@ The `config.registries` value can be used exactly as it looks in the documentati
| config.argocd.serverAddress | string | `""` | Connect to the Argo CD API server at server address |
| config.logLevel | string | `"info"` | ArgoCD Image Update log level |
| config.registries | list | `[]` | ArgoCD Image Updater registries list configuration. More information [here](https://argocd-image-updater.readthedocs.io/en/stable/configuration/registries/) |
| extraArgs | list | `[]` | Extra arguments for argocd-image-updater not defined in config.argocd |
| extraArgs | list | `[]` | Extra arguments for argocd-image-updater not defined in `config.argocd`. If a flag contains both key and value, they need to be split to a new entry |
| extraEnv | list | `[]` | Extra environment variables for argocd-image-updater |
| fullnameOverride | string | `""` | Global fullname (argocd-image-updater.fullname in _helpers.tpl) override |
| image.pullPolicy | string | `"Always"` | Default image pull policy |
| image.repository | string | `"argoprojlabs/argocd-image-updater"` | Default image repository |
| image.tag | string | `"v0.10.1"` | Default image tag |
| imagePullSecrets | list | `[]` | ImagePullSecrets for the image updater deployment |
| metrics.enabled | bool | `false` | Deploy metrics service |
| metrics.service.annotations | object | `{}` | Metrics service annotations |
| metrics.service.labels | object | `{}` | Metrics service labels |
| metrics.service.servicePort | int | `8081` | Metrics service port |
| metrics.serviceMonitor.additionalLabels | object | `{}` | Prometheus ServiceMonitor labels |
| metrics.serviceMonitor.enabled | bool | `false` | Enable a prometheus ServiceMonitor |
| metrics.serviceMonitor.interval | string | `"30s"` | Prometheus ServiceMonitor interval |
| metrics.serviceMonitor.metricRelabelings | list | `[]` | Prometheus [MetricRelabelConfigs] to apply to samples before ingestion |
| metrics.serviceMonitor.namespace | string | `""` | Prometheus ServiceMonitor namespace |
| metrics.serviceMonitor.relabelings | list | `[]` | Prometheus [RelabelConfigs] to apply to samples before scraping |
| metrics.serviceMonitor.selector | object | `{}` | Prometheus ServiceMonitor selector |
| nameOverride | string | `""` | Global name (argocd-image-updater.name in _helpers.tpl) override |
| nodeSelector | object | `{}` | Kubernetes nodeSelector settings for the deployment |
| podAnnotations | object | `{}` | Pod Annotations for the deployment |
@ -85,3 +96,9 @@ The `config.registries` value can be used exactly as it looks in the documentati
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| tolerations | list | `[]` | Kubernetes toleration settings for the deployment |
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
[MetricRelabelConfigs]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
[RelabelConfigs]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config

View file

@ -56,3 +56,8 @@ If you need support for ECR, you can reference [this issue](https://github.com/a
The `config.registries` value can be used exactly as it looks in the documentation as it gets dumped directly into a configmap in this chart.
{{ template "chart.valuesSection" . }}
{{ template "helm-docs.versionFooter" . }}
[MetricRelabelConfigs]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
[RelabelConfigs]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config

View file

@ -60,6 +60,11 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
{{ if .Values.metrics.enabled }}
- name: metrics
containerPort: 8081
protocol: TCP
{{- end }}
readinessProbe:
httpGet:
path: /healthz

View file

@ -0,0 +1,25 @@
{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.metrics.service.annotations }}
annotations:
{{- range $key, $value := .Values.metrics.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
labels:
{{- include "argocd-image-updater.labels" . | nindent 4 }}
{{- with .Values.metrics.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ include "argocd-image-updater.fullname" . }}-metrics
spec:
ports:
- name: metrics
protocol: TCP
port: {{ .Values.metrics.service.servicePort }}
targetPort: metrics
selector:
{{- include "argocd-image-updater.selectorLabels" . | nindent 4 }}
{{- end }}

View file

@ -0,0 +1,38 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "argocd-image-updater.fullname" . }}-metrics
{{- with .Values.metrics.serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
labels:
{{- include "argocd-image-updater.labels" . | nindent 4 }}
{{- with .Values.metrics.serviceMonitor.selector }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: metrics
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
path: /metrics
{{- with .Values.metrics.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "argocd-image-updater.selectorLabels" . | nindent 6 }}
{{- end }}

View file

@ -15,7 +15,7 @@ nameOverride: ""
# -- Global fullname (argocd-image-updater.fullname in _helpers.tpl) override
fullnameOverride: ""
# -- Extra arguments for argocd-image-updater not defined in config.argocd
# -- Extra arguments for argocd-image-updater not defined in `config.argocd`.
# If a flag contains both key and value, they need to be split to a new entry
extraArgs: []
# - --disable-kubernetes
@ -112,3 +112,32 @@ tolerations: []
# -- Kubernetes affinity settings for the deployment
affinity: {}
# Metrics configuration
metrics:
# -- Deploy metrics service
enabled: false
service:
# -- Metrics service annotations
annotations: {}
# -- Metrics service labels
labels: {}
# -- Metrics service port
servicePort: 8081
serviceMonitor:
# -- Enable a prometheus ServiceMonitor
enabled: false
# -- Prometheus ServiceMonitor interval
interval: 30s
# -- Prometheus [RelabelConfigs] to apply to samples before scraping
relabelings: []
# -- Prometheus [MetricRelabelConfigs] to apply to samples before ingestion
metricRelabelings: []
# -- Prometheus ServiceMonitor selector
selector: {}
# promtheus: kube-prometheus
# -- Prometheus ServiceMonitor namespace
namespace: ""
# -- Prometheus ServiceMonitor labels
additionalLabels: {}