From 3e4f3c76beb582f1c8f926998da4004cf84bf557 Mon Sep 17 00:00:00 2001 From: Cem Enson <23116487+cemenson@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:55:51 +1000 Subject: [PATCH 1/6] feat: support prometheus deployment custom annotations --- viz/charts/linkerd-viz/templates/prometheus.yaml | 1 + viz/charts/linkerd-viz/values.yaml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/viz/charts/linkerd-viz/templates/prometheus.yaml b/viz/charts/linkerd-viz/templates/prometheus.yaml index d7615c0ffca05..6d475f72ff271 100644 --- a/viz/charts/linkerd-viz/templates/prometheus.yaml +++ b/viz/charts/linkerd-viz/templates/prometheus.yaml @@ -189,6 +189,7 @@ metadata: {{ include "partials.annotations.created-by" . }} linkerd.io/inject: enabled config.linkerd.io/proxy-await: "enabled" + {{- with .Values.prometheusAnnotations }}{{ toYaml . | trim | nindent 4 }}{{- end }} labels: linkerd.io/extension: viz app.kubernetes.io/name: prometheus diff --git a/viz/charts/linkerd-viz/values.yaml b/viz/charts/linkerd-viz/values.yaml index 9dadbfad62c8a..0de46ef9f98bf 100644 --- a/viz/charts/linkerd-viz/values.yaml +++ b/viz/charts/linkerd-viz/values.yaml @@ -64,6 +64,9 @@ enablePSP: false # -- url of external prometheus instance prometheusUrl: "" +# -- annotations for the prometheus deployment +prometheusAnnotations: {} + # -- url of external jaeger instance # Set this to `jaeger.linkerd-jaeger.svc.:16686` if you plan to use jaeger extension jaegerUrl: "" From 7eaf80ca00a92feab18ecef6143efc20da0b14d2 Mon Sep 17 00:00:00 2001 From: Cem Enson <23116487+cemenson@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:30:17 +1000 Subject: [PATCH 2/6] fix: add annotations to pod spec too --- viz/charts/linkerd-viz/templates/prometheus.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/viz/charts/linkerd-viz/templates/prometheus.yaml b/viz/charts/linkerd-viz/templates/prometheus.yaml index 6d475f72ff271..f381c170654c0 100644 --- a/viz/charts/linkerd-viz/templates/prometheus.yaml +++ b/viz/charts/linkerd-viz/templates/prometheus.yaml @@ -219,6 +219,7 @@ spec: {{- include "partials.proxy.config.annotations" .resources | nindent 8 }} {{- end }} {{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} + {{- with .Values.prometheusAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} linkerd.io/inject: enabled config.alpha.linkerd.io/proxy-wait-before-exit-seconds: "0" labels: From 84913256ecc3c302e4b2c5a70ae27074b36d9778 Mon Sep 17 00:00:00 2001 From: Cem Enson <23116487+cemenson@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:03:57 +1000 Subject: [PATCH 3/6] chore: add readme --- viz/charts/linkerd-viz/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/viz/charts/linkerd-viz/README.md b/viz/charts/linkerd-viz/README.md index 8c96c172e864f..16ad32f45c0fa 100644 --- a/viz/charts/linkerd-viz/README.md +++ b/viz/charts/linkerd-viz/README.md @@ -135,6 +135,7 @@ Kubernetes: `>=1.21.0-0` | podLabels | object | `{}` | Additional labels to add to all pods | | prometheus.alertRelabelConfigs | string | `nil` | Alert relabeling is applied to alerts before they are sent to the Alertmanager. | | prometheus.alertmanagers | string | `nil` | Alertmanager instances the Prometheus server sends alerts to configured via the static_configs parameter. | +| prometheus.annotations | object | `{}` | annotations for the prometheus deployment | | prometheus.args | object | `{"config.file":"/etc/prometheus/prometheus.yml","storage.tsdb.path":"/data","storage.tsdb.retention.time":"6h"}` | Command line options for Prometheus binary | | prometheus.enabled | bool | `true` | toggle field to enable or disable prometheus | | prometheus.globalConfig | object | `{"evaluation_interval":"10s","scrape_interval":"10s","scrape_timeout":"10s"}` | The global configuration specifies parameters that are valid in all other configuration contexts. | From bfee081c1001e9d9fdaff79de243313a445d983f Mon Sep 17 00:00:00 2001 From: Cem Enson <23116487+cemenson@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:04:23 +1000 Subject: [PATCH 4/6] fix: relocate value to prometheus root --- viz/charts/linkerd-viz/templates/prometheus.yaml | 4 ++-- viz/charts/linkerd-viz/values.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/viz/charts/linkerd-viz/templates/prometheus.yaml b/viz/charts/linkerd-viz/templates/prometheus.yaml index f381c170654c0..093e1c2a15d8e 100644 --- a/viz/charts/linkerd-viz/templates/prometheus.yaml +++ b/viz/charts/linkerd-viz/templates/prometheus.yaml @@ -189,7 +189,7 @@ metadata: {{ include "partials.annotations.created-by" . }} linkerd.io/inject: enabled config.linkerd.io/proxy-await: "enabled" - {{- with .Values.prometheusAnnotations }}{{ toYaml . | trim | nindent 4 }}{{- end }} + {{- with .Values.prometheus.annotations }}{{ toYaml . | trim | nindent 4 }}{{- end }} labels: linkerd.io/extension: viz app.kubernetes.io/name: prometheus @@ -219,7 +219,7 @@ spec: {{- include "partials.proxy.config.annotations" .resources | nindent 8 }} {{- end }} {{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} - {{- with .Values.prometheusAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} + {{- with .Values.prometheus.annotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} linkerd.io/inject: enabled config.alpha.linkerd.io/proxy-wait-before-exit-seconds: "0" labels: diff --git a/viz/charts/linkerd-viz/values.yaml b/viz/charts/linkerd-viz/values.yaml index 0de46ef9f98bf..06cae8ab8d4d9 100644 --- a/viz/charts/linkerd-viz/values.yaml +++ b/viz/charts/linkerd-viz/values.yaml @@ -64,9 +64,6 @@ enablePSP: false # -- url of external prometheus instance prometheusUrl: "" -# -- annotations for the prometheus deployment -prometheusAnnotations: {} - # -- url of external jaeger instance # Set this to `jaeger.linkerd-jaeger.svc.:16686` if you plan to use jaeger extension jaegerUrl: "" @@ -443,6 +440,9 @@ prometheus: scrape_interval: 10s scrape_timeout: 10s evaluation_interval: 10s + + # -- annotations for the prometheus deployment + annotations: {} # -- Alert relabeling is applied to alerts before they are sent to the # Alertmanager. From 7f274c2e88efdc0aad441557e47bbb435af58b24 Mon Sep 17 00:00:00 2001 From: Cem Enson <23116487+cemenson@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:10:20 +1000 Subject: [PATCH 5/6] fix: only apply annotations to pod and rename values for clarity --- viz/charts/linkerd-viz/templates/prometheus.yaml | 3 +-- viz/charts/linkerd-viz/values.yaml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/viz/charts/linkerd-viz/templates/prometheus.yaml b/viz/charts/linkerd-viz/templates/prometheus.yaml index 093e1c2a15d8e..9c2927d186e83 100644 --- a/viz/charts/linkerd-viz/templates/prometheus.yaml +++ b/viz/charts/linkerd-viz/templates/prometheus.yaml @@ -189,7 +189,6 @@ metadata: {{ include "partials.annotations.created-by" . }} linkerd.io/inject: enabled config.linkerd.io/proxy-await: "enabled" - {{- with .Values.prometheus.annotations }}{{ toYaml . | trim | nindent 4 }}{{- end }} labels: linkerd.io/extension: viz app.kubernetes.io/name: prometheus @@ -219,7 +218,7 @@ spec: {{- include "partials.proxy.config.annotations" .resources | nindent 8 }} {{- end }} {{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} - {{- with .Values.prometheus.annotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} + {{- with .Values.prometheus.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }} linkerd.io/inject: enabled config.alpha.linkerd.io/proxy-wait-before-exit-seconds: "0" labels: diff --git a/viz/charts/linkerd-viz/values.yaml b/viz/charts/linkerd-viz/values.yaml index 06cae8ab8d4d9..e2064a96dd50c 100644 --- a/viz/charts/linkerd-viz/values.yaml +++ b/viz/charts/linkerd-viz/values.yaml @@ -441,8 +441,8 @@ prometheus: scrape_timeout: 10s evaluation_interval: 10s - # -- annotations for the prometheus deployment - annotations: {} + # -- annotations for the prometheus pod + podAnnotations: {} # -- Alert relabeling is applied to alerts before they are sent to the # Alertmanager. From 2797fa6024413df95922e1e7abbeadfb7231a8bb Mon Sep 17 00:00:00 2001 From: Cem Enson <23116487+cemenson@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:11:53 +1000 Subject: [PATCH 6/6] chore: update readme --- viz/charts/linkerd-viz/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viz/charts/linkerd-viz/README.md b/viz/charts/linkerd-viz/README.md index 16ad32f45c0fa..7025a49629bfe 100644 --- a/viz/charts/linkerd-viz/README.md +++ b/viz/charts/linkerd-viz/README.md @@ -135,7 +135,6 @@ Kubernetes: `>=1.21.0-0` | podLabels | object | `{}` | Additional labels to add to all pods | | prometheus.alertRelabelConfigs | string | `nil` | Alert relabeling is applied to alerts before they are sent to the Alertmanager. | | prometheus.alertmanagers | string | `nil` | Alertmanager instances the Prometheus server sends alerts to configured via the static_configs parameter. | -| prometheus.annotations | object | `{}` | annotations for the prometheus deployment | | prometheus.args | object | `{"config.file":"/etc/prometheus/prometheus.yml","storage.tsdb.path":"/data","storage.tsdb.retention.time":"6h"}` | Command line options for Prometheus binary | | prometheus.enabled | bool | `true` | toggle field to enable or disable prometheus | | prometheus.globalConfig | object | `{"evaluation_interval":"10s","scrape_interval":"10s","scrape_timeout":"10s"}` | The global configuration specifies parameters that are valid in all other configuration contexts. | @@ -146,6 +145,7 @@ Kubernetes: `>=1.21.0-0` | prometheus.logFormat | string | defaultLogLevel | log format (plain, json) of the prometheus instance | | prometheus.logLevel | string | defaultLogLevel | log level of the prometheus instance | | prometheus.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | NodeSelector section, See the [K8S documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) for more information | +| prometheus.podAnnotations | object | `{}` | annotations for the prometheus pod | | prometheus.proxy | string | `nil` | | | prometheus.remoteWrite | string | `nil` | Allows transparently sending samples to an endpoint. Mostly used for long term storage. | | prometheus.resources.cpu.limit | string | `nil` | Maximum amount of CPU units that the prometheus container can use |