chore(argo-cd): Metrics DRY cleaning (#1569)

Signed-off-by: Petr Drastil <petr.drastil@gmail.com>
This commit is contained in:
Petr Drastil 2022-10-25 16:08:51 +02:00 committed by GitHub
parent e217e71580
commit 24de82b214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 48 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v2.4.15 appVersion: v2.4.15
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes. description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd name: argo-cd
version: 5.6.7 version: 5.6.8
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
sources: sources:
@ -22,5 +22,4 @@ dependencies:
condition: redis-ha.enabled condition: redis-ha.enabled
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- "[Changed]: Created dedicated docs section for Argo CD configs" - "[Changed]: DRY cleanup of metrics templates"
- "[Fixed]: Documentation how to run server as insecure"

View file

@ -2,18 +2,18 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
{{- if .Values.applicationSet.metrics.service.annotations }} name: {{ include "argo-cd.applicationSet.fullname" . }}-metrics
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" "metrics") | nindent 4 }}
{{- with .Values.applicationSet.metrics.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.applicationSet.metrics.service.annotations }}
annotations: annotations:
{{- range $key, $value := .Values.applicationSet.metrics.service.annotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" "metrics") | nindent 4 }}
{{- if .Values.applicationSet.metrics.service.labels }}
{{- toYaml .Values.applicationSet.metrics.service.labels | nindent 4 }}
{{- end }}
name: {{ template "argo-cd.applicationSet.fullname" . }}-metrics
spec: spec:
ports: ports:
- name: {{ .Values.applicationSet.metrics.service.portName }} - name: {{ .Values.applicationSet.metrics.service.portName }}

View file

@ -2,18 +2,18 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "argo-cd.notifications.fullname" . }}-metrics name: {{ include "argo-cd.notifications.fullname" . }}-metrics
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.name "name" "metrics") | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.notifications.name "name" "metrics") | nindent 4 }}
{{- if .Values.notifications.metrics.service.labels }} {{- with .Values.notifications.metrics.service.labels }}
{{- toYaml .Values.notifications.metrics.service.labels | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.notifications.metrics.service.annotations }} {{- with .Values.notifications.metrics.service.annotations }}
annotations: annotations:
{{- range $key, $value := .Values.notifications.metrics.service.annotations }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }} {{- end }}
{{- end }}
spec: spec:
selector: selector:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.notifications.name) | nindent 6 }} {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.notifications.name) | nindent 6 }}

View file

@ -1,19 +1,19 @@
{{- if .Values.repoServer.metrics.enabled}} {{- if .Values.repoServer.metrics.enabled }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
{{- if .Values.repoServer.metrics.service.annotations }} name: {{ include "argo-cd.repoServer.fullname" . }}-metrics
annotations:
{{- range $key, $value := .Values.repoServer.metrics.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.repoServer.name "name" (printf "%s-metrics" .Values.repoServer.name)) | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.repoServer.name "name" (printf "%s-metrics" .Values.repoServer.name)) | nindent 4 }}
{{- if .Values.repoServer.metrics.service.labels }} {{- with .Values.repoServer.metrics.service.labels }}
{{- toYaml .Values.repoServer.metrics.service.labels | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
name: {{ template "argo-cd.repoServer.fullname" . }}-metrics {{- with .Values.repoServer.metrics.service.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec: spec:
ports: ports:
- name: {{ .Values.repoServer.metrics.service.portName }} - name: {{ .Values.repoServer.metrics.service.portName }}
@ -22,4 +22,4 @@ spec:
targetPort: metrics targetPort: metrics
selector: selector:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.repoServer.name) | nindent 4 }} {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.repoServer.name) | nindent 4 }}
{{- end }} {{- end }}

View file

@ -2,18 +2,18 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
{{- if .Values.server.metrics.service.annotations }} name: {{ include "argo-cd.server.fullname" . }}-metrics
annotations:
{{- range $key, $value := .Values.server.metrics.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
labels: labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" (printf "%s-metrics" .Values.server.name)) | nindent 4 }} {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" (printf "%s-metrics" .Values.server.name)) | nindent 4 }}
{{- if .Values.server.metrics.service.labels }} {{- with .Values.server.metrics.service.labels }}
{{- toYaml .Values.server.metrics.service.labels | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
name: {{ template "argo-cd.server.fullname" . }}-metrics {{- with .Values.server.metrics.service.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec: spec:
ports: ports:
- name: {{ .Values.server.metrics.service.portName }} - name: {{ .Values.server.metrics.service.portName }}
@ -22,4 +22,4 @@ spec:
targetPort: metrics targetPort: metrics
selector: selector:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.server.name) | nindent 4 }} {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.server.name) | nindent 4 }}
{{- end }} {{- end }}

View file

@ -3,19 +3,20 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "argo-cd.redis.fullname" . }}-metrics name: {{ include "argo-cd.redis.fullname" . }}-metrics
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }}
{{- with .Values.redis.metrics.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.redis.metrics.service.annotations }} {{- with .Values.redis.metrics.service.annotations }}
annotations: annotations:
{{- range $key, $value := . }} {{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }} {{ $key }}: {{ $value | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }}
{{- with .Values.redis.metrics.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
type: {{ .Values.redis.metrics.service.type }}
{{- with .Values.redis.metrics.service.clusterIP }} {{- with .Values.redis.metrics.service.clusterIP }}
clusterIP: {{ . }} clusterIP: {{ . }}
{{- end }} {{- end }}
@ -26,5 +27,4 @@ spec:
targetPort: metrics targetPort: metrics
selector: selector:
{{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }} {{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }}
type: {{ .Values.redis.metrics.service.type }}
{{- end }} {{- end }}