From 2126cb60a0974de3369ad210ebce8be786d4ccaa Mon Sep 17 00:00:00 2001 From: Ryan Brady Date: Fri, 27 Sep 2024 11:41:56 -0400 Subject: [PATCH] Adds global extraEnv support to deployed components Most of the deployed components did not apply the global extraEnv in the deployment templates. This resulted in having to duplicate extraEnv vars in the values/overrides files. This change uses the pattern from mimir to create an env: for a deployment if the .Values.global.extraEnv or .Values..extraEnv exists. It also adds the global extraEnv section to the values.yaml file. Signed-off-by: Ryan Brady --- charts/tempo-distributed/Chart.yaml | 2 +- charts/tempo-distributed/README.md | 3 ++- .../templates/admin-api/admin-api-dep.yaml | 2 ++ .../templates/compactor/deployment-compactor.yaml | 9 +++++++-- .../templates/distributor/deployment-distributor.yaml | 9 +++++++-- .../deployment-federation-frontend.yaml | 9 +++++++-- .../templates/gateway/deployment-gateway.yaml | 9 +++++++-- .../templates/ingester/statefulset-ingester.yaml | 9 +++++++-- .../templates/memcached/statefulset-memcached.yaml | 9 +++++++-- .../metrics-generator/deployment-metrics-generator.yaml | 9 +++++++-- .../templates/querier/deployment-querier.yaml | 9 +++++++-- .../query-frontend/deployment-query-frontend.yaml | 9 +++++++-- charts/tempo-distributed/values.yaml | 3 +++ 13 files changed, 71 insertions(+), 20 deletions(-) diff --git a/charts/tempo-distributed/Chart.yaml b/charts/tempo-distributed/Chart.yaml index 68a6eb7a95..63250f02c2 100644 --- a/charts/tempo-distributed/Chart.yaml +++ b/charts/tempo-distributed/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: tempo-distributed description: Grafana Tempo in MicroService mode type: application -version: 1.18.1 +version: 1.18.2 appVersion: 2.6.0 engine: gotpl home: https://grafana.com/docs/tempo/latest/ diff --git a/charts/tempo-distributed/README.md b/charts/tempo-distributed/README.md index 0e46843bb4..eb6cb3b692 100755 --- a/charts/tempo-distributed/README.md +++ b/charts/tempo-distributed/README.md @@ -1,6 +1,6 @@ # tempo-distributed -![Version: 1.18.1](https://img.shields.io/badge/Version-1.18.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.6.0](https://img.shields.io/badge/AppVersion-2.6.0-informational?style=flat-square) +![Version: 1.18.2](https://img.shields.io/badge/Version-1.18.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.6.0](https://img.shields.io/badge/AppVersion-2.6.0-informational?style=flat-square) Grafana Tempo in MicroService mode @@ -498,6 +498,7 @@ The memcached default args are removed and should be provided manually. The sett | global.clusterDomain | string | `"cluster.local"` | configures cluster domain ("cluster.local" by default) | | global.dnsNamespace | string | `"kube-system"` | configures DNS service namespace | | global.dnsService | string | `"kube-dns"` | configures DNS service name | +| global.extraEnv | list | `[]` | Common environment variables to add to all pods directly managed by this chart. scope: admin-api, compactor, distributor, enterprise-federation-frontend, gateway, ingester, memcached, metrics-generator, querier, query-frontend, tokengen | | global.image.pullSecrets | list | `[]` | Optional list of imagePullSecrets for all images, excluding enterprise. Names of existing secrets with private container registry credentials. Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod Example: pullSecrets: [ my-dockerconfigjson-secret ] | | global.image.registry | string | `"docker.io"` | Overrides the Docker registry globally for all images, excluding enterprise. | | global.priorityClassName | string | `nil` | Overrides the priorityClassName for all pods | diff --git a/charts/tempo-distributed/templates/admin-api/admin-api-dep.yaml b/charts/tempo-distributed/templates/admin-api/admin-api-dep.yaml index ae0d733c33..04525b4f9f 100644 --- a/charts/tempo-distributed/templates/admin-api/admin-api-dep.yaml +++ b/charts/tempo-distributed/templates/admin-api/admin-api-dep.yaml @@ -82,6 +82,7 @@ spec: {{- toYaml .Values.adminApi.resources | nindent 12 }} securityContext: {{- toYaml .Values.adminApi.containerSecurityContext | nindent 12 }} + {{- if or .Values.global.extraEnv .Values.adminApi.env }} env: {{- with .Values.global.extraEnv }} {{ toYaml . | nindent 12 }} @@ -89,6 +90,7 @@ spec: {{- with .Values.adminApi.env }} {{ toYaml . | nindent 12 }} {{- end }} + {{- end }} envFrom: {{- with .Values.global.extraEnvFrom }} {{- toYaml . | nindent 12 }} diff --git a/charts/tempo-distributed/templates/compactor/deployment-compactor.yaml b/charts/tempo-distributed/templates/compactor/deployment-compactor.yaml index adafe7c9a9..1e5fc8c2da 100644 --- a/charts/tempo-distributed/templates/compactor/deployment-compactor.yaml +++ b/charts/tempo-distributed/templates/compactor/deployment-compactor.yaml @@ -70,9 +70,14 @@ spec: name: http-metrics - containerPort: {{ include "tempo.memberlistBindPort" . }} name: http-memberlist - {{- with .Values.compactor.extraEnv }} + {{- if or .Values.global.extraEnv .Values.compactor.env }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{ toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.compactor.extraEnv }} + {{ toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.compactor.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/distributor/deployment-distributor.yaml b/charts/tempo-distributed/templates/distributor/deployment-distributor.yaml index d03795bbed..c7495b3832 100644 --- a/charts/tempo-distributed/templates/distributor/deployment-distributor.yaml +++ b/charts/tempo-distributed/templates/distributor/deployment-distributor.yaml @@ -109,9 +109,14 @@ spec: name: opencensus protocol: TCP {{- end }} - {{- with .Values.distributor.extraEnv }} + {{- if or .Values.global.extraEnv .Values.distributor.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.distributor.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.distributor.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/enterprise-federation-frontend/deployment-federation-frontend.yaml b/charts/tempo-distributed/templates/enterprise-federation-frontend/deployment-federation-frontend.yaml index 552bbd873c..20f2d8fa44 100644 --- a/charts/tempo-distributed/templates/enterprise-federation-frontend/deployment-federation-frontend.yaml +++ b/charts/tempo-distributed/templates/enterprise-federation-frontend/deployment-federation-frontend.yaml @@ -71,9 +71,14 @@ spec: ports: - containerPort: 3100 name: http-metrics - {{- with .Values.enterpriseFederationFrontend.extraEnv }} + {{- if or .Values.global.extraEnv .Values.enterpriseFederationFrontend.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.enterpriseFederationFrontend.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.enterpriseFederationFrontend.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/gateway/deployment-gateway.yaml b/charts/tempo-distributed/templates/gateway/deployment-gateway.yaml index 468e7775b5..ea6cd5dd34 100644 --- a/charts/tempo-distributed/templates/gateway/deployment-gateway.yaml +++ b/charts/tempo-distributed/templates/gateway/deployment-gateway.yaml @@ -58,9 +58,14 @@ spec: - name: http-metrics containerPort: 8080 protocol: TCP - {{- with .Values.gateway.extraEnv }} + {{- if or .Values.global.extraEnv .Values.gateway.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.gateway.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.gateway.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/ingester/statefulset-ingester.yaml b/charts/tempo-distributed/templates/ingester/statefulset-ingester.yaml index debe777b64..123b26790d 100644 --- a/charts/tempo-distributed/templates/ingester/statefulset-ingester.yaml +++ b/charts/tempo-distributed/templates/ingester/statefulset-ingester.yaml @@ -88,9 +88,14 @@ spec: containerPort: {{ include "tempo.memberlistBindPort" . }} - name: http-metrics containerPort: 3100 - {{- with .Values.ingester.extraEnv }} + {{- if or .Values.global.extraEnv .Values.ingester.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.ingester.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.ingester.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/memcached/statefulset-memcached.yaml b/charts/tempo-distributed/templates/memcached/statefulset-memcached.yaml index b1cc7000c0..6827e6dc2e 100644 --- a/charts/tempo-distributed/templates/memcached/statefulset-memcached.yaml +++ b/charts/tempo-distributed/templates/memcached/statefulset-memcached.yaml @@ -62,9 +62,14 @@ spec: ports: - containerPort: 11211 name: client - {{- with .Values.memcached.extraEnv }} + {{- if or .Values.global.extraEnv .Values.memcached.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.memcached.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.memcached.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/metrics-generator/deployment-metrics-generator.yaml b/charts/tempo-distributed/templates/metrics-generator/deployment-metrics-generator.yaml index ed1cd3f228..55c7094ea1 100644 --- a/charts/tempo-distributed/templates/metrics-generator/deployment-metrics-generator.yaml +++ b/charts/tempo-distributed/templates/metrics-generator/deployment-metrics-generator.yaml @@ -67,9 +67,14 @@ spec: - name: {{ .name | quote }} containerPort: {{ .port }} {{- end }} - {{- with .Values.metricsGenerator.extraEnv }} + {{- if or .Values.global.extraEnv .Values.metricsGenerator.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.metricsGenerator.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.metricsGenerator.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/querier/deployment-querier.yaml b/charts/tempo-distributed/templates/querier/deployment-querier.yaml index 297bc24762..8412589860 100644 --- a/charts/tempo-distributed/templates/querier/deployment-querier.yaml +++ b/charts/tempo-distributed/templates/querier/deployment-querier.yaml @@ -73,9 +73,14 @@ spec: protocol: TCP - containerPort: 3100 name: http-metrics - {{- with .Values.querier.extraEnv }} + {{- if or .Values.global.extraEnv .Values.querier.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.querier.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.querier.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/templates/query-frontend/deployment-query-frontend.yaml b/charts/tempo-distributed/templates/query-frontend/deployment-query-frontend.yaml index 26600a7662..01f05b21cf 100644 --- a/charts/tempo-distributed/templates/query-frontend/deployment-query-frontend.yaml +++ b/charts/tempo-distributed/templates/query-frontend/deployment-query-frontend.yaml @@ -72,9 +72,14 @@ spec: name: http-metrics - containerPort: 9095 name: grpc - {{- with .Values.queryFrontend.extraEnv }} + {{- if or .Values.global.extraEnv .Values.queryFrontend.extraEnv }} env: - {{- toYaml . | nindent 12 }} + {{- with .Values.global.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.queryFrontend.extraEnv }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- end }} {{- with .Values.queryFrontend.extraEnvFrom }} envFrom: diff --git a/charts/tempo-distributed/values.yaml b/charts/tempo-distributed/values.yaml index ccbb560de1..31d32c1eff 100755 --- a/charts/tempo-distributed/values.yaml +++ b/charts/tempo-distributed/values.yaml @@ -16,6 +16,9 @@ global: dnsService: 'kube-dns' # -- configures DNS service namespace dnsNamespace: 'kube-system' + # -- Common environment variables to add to all pods directly managed by this chart. + # scope: admin-api, compactor, distributor, enterprise-federation-frontend, gateway, ingester, memcached, metrics-generator, querier, query-frontend, tokengen + extraEnv: [] fullnameOverride: '' # fullnameOverride: tempo