From ac6e439e7f4580d81435aa36719a9b62180d4fad Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 19 Feb 2024 17:27:37 +0000 Subject: [PATCH 1/5] fix!(helm): remove prometheus-http port declaration from coderd service spec --- helm/coder/templates/service.yaml | 19 ------------------- helm/coder/tests/testdata/prometheus.golden | 8 -------- 2 files changed, 27 deletions(-) diff --git a/helm/coder/templates/service.yaml b/helm/coder/templates/service.yaml index 4c427a699cb64..1881f992a695e 100644 --- a/helm/coder/templates/service.yaml +++ b/helm/coder/templates/service.yaml @@ -28,25 +28,6 @@ spec: nodePort: {{ .Values.coder.service.httpsNodePort }} {{ end }} {{- end }} - {{- range .Values.coder.env }} - {{- if eq .name "CODER_PROMETHEUS_ENABLE" }} - {{/* - This sadly has to be nested to avoid evaluating the second part - of the condition too early and potentially getting type errors if - the value is not a string (like a `valueFrom`). We do not support - `valueFrom` for this env var specifically. - */}} - {{- if eq .value "true" }} - - name: "prometheus-http" - port: 2112 - targetPort: "prometheus-http" - protocol: TCP - {{ if eq $.Values.coder.service.type "NodePort" }} - nodePort: {{ $.Values.coder.service.prometheusNodePort }} - {{ end }} - {{- end }} - {{- end }} - {{- end }} {{- if eq "LoadBalancer" .Values.coder.service.type }} {{- with .Values.coder.service.loadBalancerIP }} loadBalancerIP: {{ . | quote }} diff --git a/helm/coder/tests/testdata/prometheus.golden b/helm/coder/tests/testdata/prometheus.golden index d84861fa2d338..a16fcc1a08493 100644 --- a/helm/coder/tests/testdata/prometheus.golden +++ b/helm/coder/tests/testdata/prometheus.golden @@ -93,14 +93,6 @@ spec: nodePort: - - - name: "prometheus-http" - port: 2112 - targetPort: "prometheus-http" - protocol: TCP - - nodePort: 31112 - selector: app.kubernetes.io/name: coder app.kubernetes.io/instance: release-name From 973143a6af1d058a91f5e072bda9a5b430aa8505 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 19 Feb 2024 17:37:50 +0000 Subject: [PATCH 2/5] update docs --- docs/admin/prometheus.md | 5 +++-- helm/coder/values.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/admin/prometheus.md b/docs/admin/prometheus.md index 5f2c21c5977bb..7232b949ca64f 100644 --- a/docs/admin/prometheus.md +++ b/docs/admin/prometheus.md @@ -35,8 +35,9 @@ The Prometheus endpoint can be enabled in the [Helm chart's](https://github.com/coder/coder/tree/main/helm) `values.yml` by setting the environment variable `CODER_PROMETHEUS_ADDRESS` to `0.0.0.0:2112`. The environment variable `CODER_PROMETHEUS_ENABLE` will be enabled -automatically. A Service Endpoint will also be exposed allowing Prometheus -Service Monitors to be used. +automatically. A Service Endpoint will not be exposed; if you need to expose the +Prometheus port on a Service, (for example, to use a `ServiceMonitor`), create a +separate service instead. ### Prometheus configuration diff --git a/helm/coder/values.yaml b/helm/coder/values.yaml index fae239de7fb9a..50fff8a0b57ea 100644 --- a/helm/coder/values.yaml +++ b/helm/coder/values.yaml @@ -285,7 +285,7 @@ coder: # coder.service.prometheusNodePort -- Enabled if coder.service.type is set # to NodePort. If not set, Kubernetes will allocate a port from the default # range, 30000-32767. The "prometheus-http" port on the coder service is - # only exposed if CODER_PROMETHEUS_ENABLE is set to true. + # not exposed if CODER_PROMETHEUS_ENABLE is set to true. prometheusNodePort: "" # coder.ingress -- The Ingress object to expose for Coder. From d66bd758b7af1b324bfa95121fd3a3c8d67a780e Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 20 Feb 2024 11:06:02 +0000 Subject: [PATCH 3/5] remove coder.service.prometheusNodePort --- helm/coder/values.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/helm/coder/values.yaml b/helm/coder/values.yaml index 50fff8a0b57ea..dcf32c6213657 100644 --- a/helm/coder/values.yaml +++ b/helm/coder/values.yaml @@ -282,11 +282,6 @@ coder: # NodePort. If not set, Kubernetes will allocate a port from the default # range, 30000-32767. httpsNodePort: "" - # coder.service.prometheusNodePort -- Enabled if coder.service.type is set - # to NodePort. If not set, Kubernetes will allocate a port from the default - # range, 30000-32767. The "prometheus-http" port on the coder service is - # not exposed if CODER_PROMETHEUS_ENABLE is set to true. - prometheusNodePort: "" # coder.ingress -- The Ingress object to expose for Coder. ingress: From d9a275a2ed6b345928076ad01e9d66b46c79ef3b Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 20 Feb 2024 11:14:40 +0000 Subject: [PATCH 4/5] add example headless service --- docs/admin/prometheus.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/admin/prometheus.md b/docs/admin/prometheus.md index 7232b949ca64f..adca4d8b95071 100644 --- a/docs/admin/prometheus.md +++ b/docs/admin/prometheus.md @@ -37,7 +37,26 @@ setting the environment variable `CODER_PROMETHEUS_ADDRESS` to `0.0.0.0:2112`. The environment variable `CODER_PROMETHEUS_ENABLE` will be enabled automatically. A Service Endpoint will not be exposed; if you need to expose the Prometheus port on a Service, (for example, to use a `ServiceMonitor`), create a -separate service instead. +separate headless service instead: + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: coder-prom + namespace: coder +spec: + clusterIP: None + ports: + - name: prom-http + port: 2112 + protocol: TCP + targetPort: 2112 + selector: + app.kubernetes.io/instance: coder + app.kubernetes.io/name: coder + type: ClusterIP +``` ### Prometheus configuration From ad02adce5fc83b25cb1c52c64eddcbf31a17b47e Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 20 Feb 2024 11:18:46 +0000 Subject: [PATCH 5/5] make fmt --- docs/admin/prometheus.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/admin/prometheus.md b/docs/admin/prometheus.md index adca4d8b95071..3f525a2e7d6d0 100644 --- a/docs/admin/prometheus.md +++ b/docs/admin/prometheus.md @@ -48,10 +48,10 @@ metadata: spec: clusterIP: None ports: - - name: prom-http - port: 2112 - protocol: TCP - targetPort: 2112 + - name: prom-http + port: 2112 + protocol: TCP + targetPort: 2112 selector: app.kubernetes.io/instance: coder app.kubernetes.io/name: coder pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy