From 50d8e08e93726f698f2934019b6ccdddd24c792a Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Mon, 31 May 2021 13:39:59 +0200 Subject: [PATCH 1/2] Add: Refactoring Kubernetes recommanded labels and custom labels Signed-off-by: Nicolas Lamirault --- thanos/templates/_helpers.tpl | 15 ++++++++++++++- thanos/templates/bucket-deployment.yaml | 9 ++------- thanos/templates/bucket-ingress.yaml | 6 +----- .../templates/bucket-poddisruptionbudget.yaml | 6 +----- thanos/templates/bucket-service.yaml | 6 +----- thanos/templates/compact-deployment.yaml | 9 ++------- .../compact-persistentvolumeclaim.yaml | 6 +----- thanos/templates/compact-service.yaml | 6 +----- thanos/templates/compact-servicemonitor.yaml | 6 +----- thanos/templates/query-deployment.yaml | 9 ++------- .../templates/query-frontend-deployment.yaml | 9 ++------- ...query-frontend-horizontalpodautoscaler.yaml | 6 +----- thanos/templates/query-frontend-ingress.yml | 12 ++---------- .../query-frontend-poddisruptionbudget.yaml | 6 +----- thanos/templates/query-frontend-psp.yaml | 6 +----- thanos/templates/query-frontend-rbac.yaml | 18 +++--------------- thanos/templates/query-frontend-service.yaml | 12 ++---------- .../query-frontend-servicemonitor.yaml | 6 +----- .../query-horizontalpodautoscaler.yaml | 6 +----- thanos/templates/query-ingress.yml | 12 ++---------- .../templates/query-poddisruptionbudget.yaml | 6 +----- thanos/templates/query-psp.yaml | 6 +----- thanos/templates/query-rbac.yaml | 18 +++--------------- thanos/templates/query-service.yaml | 12 ++---------- thanos/templates/query-servicemonitor.yaml | 6 +----- thanos/templates/rule-configmap.yaml | 6 +----- thanos/templates/rule-ingress.yml | 12 ++---------- thanos/templates/rule-service.yaml | 12 ++---------- thanos/templates/rule-servicemonitor.yaml | 6 +----- thanos/templates/rule-statefulset.yaml | 15 +++------------ thanos/templates/secret.yaml | 6 ++---- thanos/templates/sidecar-ingress.yaml | 12 ++---------- thanos/templates/sidecar-service.yaml | 12 ++---------- thanos/templates/sidecar-servicemonitor.yaml | 6 +----- thanos/templates/store-deployment.yaml | 6 ++++++ thanos/templates/store-ingress.yaml | 12 ++---------- .../templates/store-persistentvolumeclaim.yaml | 3 +++ thanos/templates/store-service.yaml | 12 ++---------- thanos/templates/store-servicemonitor.yaml | 6 +----- thanos/values.yaml | 4 ++++ 40 files changed, 84 insertions(+), 265 deletions(-) diff --git a/thanos/templates/_helpers.tpl b/thanos/templates/_helpers.tpl index 054178b4..71f4fc67 100644 --- a/thanos/templates/_helpers.tpl +++ b/thanos/templates/_helpers.tpl @@ -59,4 +59,17 @@ Create a default name for service account if not provided. {{- else -}} {{- printf "%s" .Values.queryFrontend.serviceAccount -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* Generate basic labels */}} +{{- define "thanos.labels" }} +app.kubernetes.io/name: {{ template "thanos.name" . }} +app.kubernetes.io/instance: "{{ .Release.Name }}" +app.kubernetes.io/managed-by: "{{ .Release.Service }}" +app.kubernetes.io/version: "{{ .Chart.AppVersion | replace "+" "_" }}" +app.kubernetes.io/part-of: {{ template "thanos.name" . }} +helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +{{- if .Values.customLabels }} +{{ toYaml .Values.customLabels }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/thanos/templates/bucket-deployment.yaml b/thanos/templates/bucket-deployment.yaml index a9f1b4a3..0c405714 100644 --- a/thanos/templates/bucket-deployment.yaml +++ b/thanos/templates/bucket-deployment.yaml @@ -4,12 +4,8 @@ kind: Deployment metadata: name: {{ include "thanos.componentname" (list $ "bucket") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: bucket + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.bucket.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end -}} {{- with .Values.bucket.deploymentAnnotations }} annotations: {{ toYaml . | nindent 4 }} @@ -28,9 +24,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: bucket + {{- include "thanos.labels" . | indent 8 }} {{ with .Values.bucket.labels }}{{ toYaml . | indent 8 }}{{ end }} {{- with .Values.bucket.annotations }} annotations: {{ toYaml . | nindent 8 }} diff --git a/thanos/templates/bucket-ingress.yaml b/thanos/templates/bucket-ingress.yaml index 949451ec..b82d36b5 100644 --- a/thanos/templates/bucket-ingress.yaml +++ b/thanos/templates/bucket-ingress.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: bucket + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.bucket.http.ingress.labels }} {{ toYaml .Values.bucket.http.ingress.labels | indent 4 }} {{- end }} diff --git a/thanos/templates/bucket-poddisruptionbudget.yaml b/thanos/templates/bucket-poddisruptionbudget.yaml index 56e1bf10..fed036f4 100644 --- a/thanos/templates/bucket-poddisruptionbudget.yaml +++ b/thanos/templates/bucket-poddisruptionbudget.yaml @@ -4,12 +4,8 @@ kind: PodDisruptionBudget metadata: name: {{ include "thanos.componentname" (list $ "bucket") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: bucket + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.bucket.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} spec: {{- if .Values.bucket.podDisruptionBudget.minAvailable }} diff --git a/thanos/templates/bucket-service.yaml b/thanos/templates/bucket-service.yaml index 542fade4..55895ce1 100644 --- a/thanos/templates/bucket-service.yaml +++ b/thanos/templates/bucket-service.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: bucket + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.bucket.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: ports: diff --git a/thanos/templates/compact-deployment.yaml b/thanos/templates/compact-deployment.yaml index ce86cbf5..463dbf7c 100644 --- a/thanos/templates/compact-deployment.yaml +++ b/thanos/templates/compact-deployment.yaml @@ -4,12 +4,8 @@ kind: Deployment metadata: name: {{ include "thanos.componentname" (list $ "compact") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: compact + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.compact.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end -}} {{- with .Values.compact.deploymentAnnotations }} annotations: {{ toYaml . | nindent 4 }} @@ -28,9 +24,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: compact + {{- include "thanos.labels" . | indent 8 }} {{ with .Values.compact.labels }}{{ toYaml . | indent 8 }}{{ end }} {{- if or .Values.compact.annotations .Values.compact.metrics.annotations.enabled }} annotations: diff --git a/thanos/templates/compact-persistentvolumeclaim.yaml b/thanos/templates/compact-persistentvolumeclaim.yaml index a0fad023..9773a016 100644 --- a/thanos/templates/compact-persistentvolumeclaim.yaml +++ b/thanos/templates/compact-persistentvolumeclaim.yaml @@ -5,12 +5,8 @@ kind: PersistentVolumeClaim metadata: name: {{ $pvc.name }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: compact + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.compact.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end -}} {{- with .Values.compact.deploymentAnnotations }} annotations: {{ toYaml . | nindent 4 }} diff --git a/thanos/templates/compact-service.yaml b/thanos/templates/compact-service.yaml index bb3d5b8c..615d6ac9 100644 --- a/thanos/templates/compact-service.yaml +++ b/thanos/templates/compact-service.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: compact + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.compact.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: ports: diff --git a/thanos/templates/compact-servicemonitor.yaml b/thanos/templates/compact-servicemonitor.yaml index 82248ceb..2f612bed 100644 --- a/thanos/templates/compact-servicemonitor.yaml +++ b/thanos/templates/compact-servicemonitor.yaml @@ -4,12 +4,8 @@ kind: ServiceMonitor metadata: name: {{ include "thanos.componentname" (list $ "compact") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: compact + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.compact.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: jobLabel: thanos-compact diff --git a/thanos/templates/query-deployment.yaml b/thanos/templates/query-deployment.yaml index 2ce69dbb..1c0bde3e 100644 --- a/thanos/templates/query-deployment.yaml +++ b/thanos/templates/query-deployment.yaml @@ -4,12 +4,8 @@ kind: Deployment metadata: name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.query.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} {{- with .Values.query.deploymentAnnotations }} annotations: {{ toYaml . | nindent 4 }} @@ -30,9 +26,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 8 }} {{ with .Values.query.labels }}{{ toYaml . | indent 8 }}{{ end }} {{- if or .Values.query.annotations .Values.query.metrics.annotations.enabled }} annotations: diff --git a/thanos/templates/query-frontend-deployment.yaml b/thanos/templates/query-frontend-deployment.yaml index 1d103c2f..03f46d3a 100644 --- a/thanos/templates/query-frontend-deployment.yaml +++ b/thanos/templates/query-frontend-deployment.yaml @@ -4,12 +4,8 @@ kind: Deployment metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.queryFrontend.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} {{- with .Values.queryFrontend.deploymentAnnotations }} annotations: {{ toYaml . | nindent 4 }} @@ -30,9 +26,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.queryFrontend.labels }}{{ toYaml . | indent 8 }}{{ end }} {{- if or .Values.queryFrontend.annotations .Values.queryFrontend.metrics.annotations.enabled }} annotations: diff --git a/thanos/templates/query-frontend-horizontalpodautoscaler.yaml b/thanos/templates/query-frontend-horizontalpodautoscaler.yaml index 82d1ba65..9f1b20ac 100644 --- a/thanos/templates/query-frontend-horizontalpodautoscaler.yaml +++ b/thanos/templates/query-frontend-horizontalpodautoscaler.yaml @@ -5,12 +5,8 @@ kind: HorizontalPodAutoscaler metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 diff --git a/thanos/templates/query-frontend-ingress.yml b/thanos/templates/query-frontend-ingress.yml index cf3b9dd3..8839e5ec 100644 --- a/thanos/templates/query-frontend-ingress.yml +++ b/thanos/templates/query-frontend-ingress.yml @@ -5,12 +5,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }}-http labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.queryFrontend.http.ingress.labels }} {{ toYaml .Values.queryFrontend.http.ingress.labels | indent 4 }} {{- end }} @@ -54,12 +50,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }}-grpc labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.queryFrontend.grpc.ingress.labels }} {{ toYaml .Values.queryFrontend.grpc.ingress.labels | indent 4 }} {{- end }} diff --git a/thanos/templates/query-frontend-poddisruptionbudget.yaml b/thanos/templates/query-frontend-poddisruptionbudget.yaml index ed0c1cd9..cbea6394 100644 --- a/thanos/templates/query-frontend-poddisruptionbudget.yaml +++ b/thanos/templates/query-frontend-poddisruptionbudget.yaml @@ -4,12 +4,8 @@ kind: PodDisruptionBudget metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.queryFrontend.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} spec: {{- if .Values.queryFrontend.podDisruptionBudget.minAvailable }} diff --git a/thanos/templates/query-frontend-psp.yaml b/thanos/templates/query-frontend-psp.yaml index e2c6cca0..0fedd68b 100644 --- a/thanos/templates/query-frontend-psp.yaml +++ b/thanos/templates/query-frontend-psp.yaml @@ -5,12 +5,8 @@ kind: PodSecurityPolicy metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} spec: privileged: false allowPrivilegeEscalation: false diff --git a/thanos/templates/query-frontend-rbac.yaml b/thanos/templates/query-frontend-rbac.yaml index e3a71c01..05064cd3 100644 --- a/thanos/templates/query-frontend-rbac.yaml +++ b/thanos/templates/query-frontend-rbac.yaml @@ -8,24 +8,16 @@ metadata: {{- end }} name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} rules: - apiGroups: ['policy'] resources: ['podsecuritypolicies'] @@ -38,12 +30,8 @@ kind: RoleBinding metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} roleRef: kind: ClusterRole name: {{ include "thanos.componentname" (list $ "query-frontend") }} diff --git a/thanos/templates/query-frontend-service.yaml b/thanos/templates/query-frontend-service.yaml index aa199259..59c29403 100644 --- a/thanos/templates/query-frontend-service.yaml +++ b/thanos/templates/query-frontend-service.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.queryFrontend.grpc.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: ClusterIP @@ -38,12 +34,8 @@ metadata: annotations: {{ toYaml .| nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.queryFrontend.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: {{ .Values.queryFrontend.http.service.type }} diff --git a/thanos/templates/query-frontend-servicemonitor.yaml b/thanos/templates/query-frontend-servicemonitor.yaml index d8accfba..d3fd574f 100644 --- a/thanos/templates/query-frontend-servicemonitor.yaml +++ b/thanos/templates/query-frontend-servicemonitor.yaml @@ -4,12 +4,8 @@ kind: ServiceMonitor metadata: name: {{ include "thanos.componentname" (list $ "query-frontend") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query-frontend + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.queryFrontend.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: jobLabel: thanos-query-frontend diff --git a/thanos/templates/query-horizontalpodautoscaler.yaml b/thanos/templates/query-horizontalpodautoscaler.yaml index aa25b6e0..eb20a70f 100644 --- a/thanos/templates/query-horizontalpodautoscaler.yaml +++ b/thanos/templates/query-horizontalpodautoscaler.yaml @@ -5,12 +5,8 @@ kind: HorizontalPodAutoscaler metadata: name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 diff --git a/thanos/templates/query-ingress.yml b/thanos/templates/query-ingress.yml index 5616d1a9..2935cb21 100644 --- a/thanos/templates/query-ingress.yml +++ b/thanos/templates/query-ingress.yml @@ -5,12 +5,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "query") }}-http labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.query.http.ingress.labels }} {{ toYaml .Values.query.http.ingress.labels | indent 4 }} {{- end }} @@ -54,12 +50,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "query") }}-grpc labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.query.grpc.ingress.labels }} {{ toYaml .Values.query.grpc.ingress.labels | indent 4 }} {{- end }} diff --git a/thanos/templates/query-poddisruptionbudget.yaml b/thanos/templates/query-poddisruptionbudget.yaml index 46382864..b440f9eb 100644 --- a/thanos/templates/query-poddisruptionbudget.yaml +++ b/thanos/templates/query-poddisruptionbudget.yaml @@ -4,12 +4,8 @@ kind: PodDisruptionBudget metadata: name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.query.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} spec: {{- if .Values.query.podDisruptionBudget.minAvailable }} diff --git a/thanos/templates/query-psp.yaml b/thanos/templates/query-psp.yaml index 2ae9a85e..cd272137 100644 --- a/thanos/templates/query-psp.yaml +++ b/thanos/templates/query-psp.yaml @@ -5,12 +5,8 @@ kind: PodSecurityPolicy metadata: name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} spec: privileged: false allowPrivilegeEscalation: false diff --git a/thanos/templates/query-rbac.yaml b/thanos/templates/query-rbac.yaml index 3f0fe76b..65256908 100644 --- a/thanos/templates/query-rbac.yaml +++ b/thanos/templates/query-rbac.yaml @@ -8,24 +8,16 @@ metadata: {{- end }} name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} rules: - apiGroups: ['policy'] resources: ['podsecuritypolicies'] @@ -38,12 +30,8 @@ kind: RoleBinding metadata: name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} roleRef: kind: ClusterRole name: {{ include "thanos.componentname" (list $ "query") }} diff --git a/thanos/templates/query-service.yaml b/thanos/templates/query-service.yaml index 27ade199..360662d5 100644 --- a/thanos/templates/query-service.yaml +++ b/thanos/templates/query-service.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.query.grpc.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: ClusterIP @@ -38,12 +34,8 @@ metadata: annotations: {{ toYaml .| nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.query.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: {{ .Values.query.http.service.type }} diff --git a/thanos/templates/query-servicemonitor.yaml b/thanos/templates/query-servicemonitor.yaml index 8a54d6f0..3de49257 100644 --- a/thanos/templates/query-servicemonitor.yaml +++ b/thanos/templates/query-servicemonitor.yaml @@ -4,12 +4,8 @@ kind: ServiceMonitor metadata: name: {{ include "thanos.componentname" (list $ "query") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: query + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.query.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: jobLabel: thanos-query diff --git a/thanos/templates/rule-configmap.yaml b/thanos/templates/rule-configmap.yaml index 0e76aa8d..b05c1c0b 100644 --- a/thanos/templates/rule-configmap.yaml +++ b/thanos/templates/rule-configmap.yaml @@ -3,12 +3,8 @@ apiVersion: v1 kind: ConfigMap metadata: labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} name: {{ include "thanos.fullname" . }}-rules data: {{- $root := . -}} diff --git a/thanos/templates/rule-ingress.yml b/thanos/templates/rule-ingress.yml index e9a9f406..940dcc83 100644 --- a/thanos/templates/rule-ingress.yml +++ b/thanos/templates/rule-ingress.yml @@ -5,12 +5,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "rule") }}-http labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.rule.http.ingress.labels }} {{ toYaml .Values.rule.http.ingress.labels | indent 4 }} {{- end }} @@ -54,12 +50,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "rule") }}-grpc labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.rule.grpc.ingress.labels }} {{ toYaml .Values.rule.grpc.ingress.labels | indent 4 }} {{- end }} diff --git a/thanos/templates/rule-service.yaml b/thanos/templates/rule-service.yaml index 280466d7..6435b8ee 100644 --- a/thanos/templates/rule-service.yaml +++ b/thanos/templates/rule-service.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.rule.grpc.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: ClusterIP @@ -38,12 +34,8 @@ metadata: annotations: {{ toYaml .| nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.rule.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: {{ .Values.rule.http.service.type }} diff --git a/thanos/templates/rule-servicemonitor.yaml b/thanos/templates/rule-servicemonitor.yaml index 2a145df4..f6912023 100644 --- a/thanos/templates/rule-servicemonitor.yaml +++ b/thanos/templates/rule-servicemonitor.yaml @@ -4,12 +4,8 @@ kind: ServiceMonitor metadata: name: {{ include "thanos.componentname" (list $ "rule") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.rule.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: jobLabel: thanos-rule diff --git a/thanos/templates/rule-statefulset.yaml b/thanos/templates/rule-statefulset.yaml index df43ce76..cb66a2c9 100644 --- a/thanos/templates/rule-statefulset.yaml +++ b/thanos/templates/rule-statefulset.yaml @@ -4,12 +4,8 @@ kind: StatefulSet metadata: name: {{ include "thanos.componentname" (list $ "rule") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.rule.statefulsetLabels }}{{ toYaml . | indent 4 }}{{ end -}} {{- with .Values.rule.statefulsetAnnotations }} annotations: {{ toYaml . | nindent 4 }} @@ -31,9 +27,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.rule.labels }}{{ toYaml . | indent 8 }}{{ end }} {{- with .Values.rule.annotations }} annotations: {{ toYaml . | nindent 8 }} @@ -171,12 +166,8 @@ spec: - metadata: name: {{ .Values.rule.persistentVolumeClaim.name }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: rule + {{- include "thanos.labels" . | indent 4 }} spec: {{- toYaml .Values.rule.persistentVolumeClaim.spec | nindent 6 }} {{- end }} diff --git a/thanos/templates/secret.yaml b/thanos/templates/secret.yaml index e65846ab..b57b8f19 100644 --- a/thanos/templates/secret.yaml +++ b/thanos/templates/secret.yaml @@ -5,10 +5,8 @@ kind: Secret metadata: name: {{ include "thanos.fullname" . }} labels: - app: {{ include "thanos.name" . }} - chart: {{ include "thanos.chart" . }} - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + app.kubernetes.io/component: common + {{- include "thanos.labels" . | indent 4 }} type: Opaque data: {{- if .Values.objstore }} diff --git a/thanos/templates/sidecar-ingress.yaml b/thanos/templates/sidecar-ingress.yaml index 8e65c982..308dc3a5 100644 --- a/thanos/templates/sidecar-ingress.yaml +++ b/thanos/templates/sidecar-ingress.yaml @@ -5,12 +5,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "sidecar") }}-http labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: sidecar + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.sidecar.http.ingress.labels }} {{ toYaml .Values.sidecar.ingress.http.labels | indent 4 }} {{- end }} @@ -54,12 +50,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "sidecar") }}-grpc labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: sidecar + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.sidecar.grpc.ingress.labels }} {{ toYaml .Values.sidecar.grpc.ingress.labels | indent 4 }} {{- end }} diff --git a/thanos/templates/sidecar-service.yaml b/thanos/templates/sidecar-service.yaml index 89106e0c..f91cfbc1 100644 --- a/thanos/templates/sidecar-service.yaml +++ b/thanos/templates/sidecar-service.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: sidecar + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.sidecar.grpc.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: {{ .Values.sidecar.grpc.service.type }} @@ -41,12 +37,8 @@ metadata: annotations: {{ toYaml .| nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: sidecar + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.store.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: {{ .Values.sidecar.http.service.type }} diff --git a/thanos/templates/sidecar-servicemonitor.yaml b/thanos/templates/sidecar-servicemonitor.yaml index 8883fc69..448dae52 100644 --- a/thanos/templates/sidecar-servicemonitor.yaml +++ b/thanos/templates/sidecar-servicemonitor.yaml @@ -4,12 +4,8 @@ kind: ServiceMonitor metadata: name: {{ include "thanos.componentname" (list $ "sidecar") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: sidecar + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.sidecar.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: jobLabel: thanos-sidecar diff --git a/thanos/templates/store-deployment.yaml b/thanos/templates/store-deployment.yaml index 0622522c..3fdb6849 100644 --- a/thanos/templates/store-deployment.yaml +++ b/thanos/templates/store-deployment.yaml @@ -26,6 +26,9 @@ metadata: app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: store app.kubernetes.io/partition: "{{ $index }}" + {{- if $.Values.customLabels }} + {{ toYaml $.Values.customLabels }} + {{- end }} {{ with $root.Values.store.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end }} {{- with $root.Values.store.deploymentAnnotations }} annotations: {{ toYaml . | nindent 4 }} @@ -50,6 +53,9 @@ spec: app.kubernetes.io/instance: {{ $.Release.Name }} app.kubernetes.io/component: store app.kubernetes.io/partition: "{{ $index }}" + {{- if $.Values.customLabels }} + {{ toYaml $.Values.customLabels }} + {{- end }} {{- if or $root.Values.store.annotations $root.Values.store.metrics.annotations.enabled }} annotations: {{- end }} diff --git a/thanos/templates/store-ingress.yaml b/thanos/templates/store-ingress.yaml index 97fbda1c..f0258bbc 100644 --- a/thanos/templates/store-ingress.yaml +++ b/thanos/templates/store-ingress.yaml @@ -4,12 +4,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "store") }}-http labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: store + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.store.http.ingress.labels }} {{ toYaml .Values.store.http.ingress.labels | indent 4 }} {{- end }} @@ -52,12 +48,8 @@ kind: Ingress metadata: name: {{ include "thanos.componentname" (list $ "store") }}-grpc labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: store + {{- include "thanos.labels" . | indent 4 }} {{- if .Values.store.grpc.ingress.labels }} {{ toYaml .Values.store.grpc.ingress.labels | indent 4 }} {{- end }} diff --git a/thanos/templates/store-persistentvolumeclaim.yaml b/thanos/templates/store-persistentvolumeclaim.yaml index def6d89d..860ce523 100644 --- a/thanos/templates/store-persistentvolumeclaim.yaml +++ b/thanos/templates/store-persistentvolumeclaim.yaml @@ -20,6 +20,9 @@ metadata: app.kubernetes.io/managed-by: {{ $.Release.Service }} app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: store + {{- if $.Values.customLabels }} + {{ toYaml $.Values.customLabels }} + {{- end }} {{ with $root.Values.store.deploymentLabels }}{{ toYaml . | indent 4 }}{{ end -}} {{- with $root.Values.store.deploymentAnnotations }} annotations: {{ toYaml . | nindent 4 }} diff --git a/thanos/templates/store-service.yaml b/thanos/templates/store-service.yaml index 7d105b93..76a926f0 100644 --- a/thanos/templates/store-service.yaml +++ b/thanos/templates/store-service.yaml @@ -7,12 +7,8 @@ metadata: annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: store + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.store.grpc.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: ClusterIP @@ -38,12 +34,8 @@ metadata: annotations: {{ toYaml .| nindent 4 }} {{- end }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: store + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.store.http.service.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: type: {{ .Values.store.http.service.type }} diff --git a/thanos/templates/store-servicemonitor.yaml b/thanos/templates/store-servicemonitor.yaml index e6813fcd..8b10be31 100644 --- a/thanos/templates/store-servicemonitor.yaml +++ b/thanos/templates/store-servicemonitor.yaml @@ -4,12 +4,8 @@ kind: ServiceMonitor metadata: name: {{ include "thanos.componentname" (list $ "store") }} labels: - app.kubernetes.io/name: {{ include "thanos.name" . }} - helm.sh/chart: {{ include "thanos.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} app.kubernetes.io/component: store + {{- include "thanos.labels" . | indent 4 }} {{ with .Values.store.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }} spec: jobLabel: thanos-store diff --git a/thanos/values.yaml b/thanos/values.yaml index 26c5050e..086bc181 100644 --- a/thanos/values.yaml +++ b/thanos/values.yaml @@ -3,6 +3,10 @@ image: tag: v0.17.1 pullPolicy: IfNotPresent +## Additional labels to add to all resources +customLabels: #{} + app: thanos + store: enabled: true # Maximum size of items held in the index cache. From 1cd9b064c7e6ba91c1edfe7e90e790468c75db38 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Mon, 31 May 2021 13:41:37 +0200 Subject: [PATCH 2/2] Update: bump chart version Signed-off-by: Nicolas Lamirault --- thanos/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thanos/Chart.yaml b/thanos/Chart.yaml index 28690706..e890c7bb 100644 --- a/thanos/Chart.yaml +++ b/thanos/Chart.yaml @@ -9,7 +9,7 @@ keywords: sources: - https://github.com/thanos-io/thanos - https://github.com/banzaicloud/banzai-charts/tree/master/thanos -version: 0.4.3 +version: 0.4.4 icon: https://raw.githubusercontent.com/thanos-io/thanos/master/docs/img/Thanos-logo_fullmedium.png maintainers: - name: Banzai Cloud