From 468656e8c92aaf2e75d20b0fedc8285a27c68e5d Mon Sep 17 00:00:00 2001 From: Ronan-WeScale Date: Fri, 11 Aug 2023 14:54:10 +0200 Subject: [PATCH 1/4] Update - add servicemonitor --- deploy/k8s/chart/templates/deployment.yaml | 5 ++ deploy/k8s/chart/templates/service.yaml | 6 ++ .../k8s/chart/templates/servicemonitor.yaml | 58 +++++++++++++++++++ deploy/k8s/chart/values.yaml | 41 +++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 deploy/k8s/chart/templates/servicemonitor.yaml diff --git a/deploy/k8s/chart/templates/deployment.yaml b/deploy/k8s/chart/templates/deployment.yaml index 90f431c..fc9bf1b 100644 --- a/deploy/k8s/chart/templates/deployment.yaml +++ b/deploy/k8s/chart/templates/deployment.yaml @@ -39,6 +39,11 @@ spec: - name: http containerPort: {{ .Values.service.targetPort }} protocol: TCP + {{- if .Values.serviceMonitor.enabled }} + - name: http-metrics + containerPort: {{ .Values.serviceMonitor.targetPort }} + protocol: TCP + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: diff --git a/deploy/k8s/chart/templates/service.yaml b/deploy/k8s/chart/templates/service.yaml index df7c77c..fa7b5c7 100644 --- a/deploy/k8s/chart/templates/service.yaml +++ b/deploy/k8s/chart/templates/service.yaml @@ -11,5 +11,11 @@ spec: port: {{ .Values.service.port }} targetPort: {{ .Values.service.targetPort }} protocol: TCP + {{- if .Values.serviceMonitor.enabled }} + - name: http-metrics + port: {{ .Values.serviceMonitor.targetPort }} + targetPort: http-metrics + protocol: TCP + {{- end }} selector: {{- include "cortex-tenant.selectorLabels" . | nindent 4 }} diff --git a/deploy/k8s/chart/templates/servicemonitor.yaml b/deploy/k8s/chart/templates/servicemonitor.yaml new file mode 100644 index 0000000..a2aa82a --- /dev/null +++ b/deploy/k8s/chart/templates/servicemonitor.yaml @@ -0,0 +1,58 @@ +{{- with .Values.serviceMonitor }} +{{- if .enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "cortex-tenant.fullname" $ }} + {{- with .namespace }} + namespace: {{ . }} + {{- end }} + {{- with .annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "cortex-tenant.labels" $ | nindent 4 }} + {{- with .labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .namespaceSelector }} + namespaceSelector: + {{- toYaml . | nindent 4 }} + {{- end }} + selector: + matchLabels: + {{- include "cortex-tenant.selectorLabels" $ | nindent 6 }} + endpoints: + - port: http-metrics + {{- with $.Values.httpPathPrefix }} + path: {{ printf "%s/metrics" . }} + {{- end }} + {{- with .interval }} + interval: {{ . }} + {{- end }} + {{- with .scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + {{- with .relabelings }} + relabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .scheme }} + scheme: {{ . }} + {{- end }} + {{- with .tlsConfig }} + tlsConfig: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .targetLabels }} + targetLabels: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/deploy/k8s/chart/values.yaml b/deploy/k8s/chart/values.yaml index a297ea8..197eca4 100644 --- a/deploy/k8s/chart/values.yaml +++ b/deploy/k8s/chart/values.yaml @@ -127,3 +127,44 @@ nodeSelector: {} # [Node Selection](https://kubernetes.io/docs/concepts/scheduli tolerations: [] # [Taints and Tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) affinity: {} # [Node Selection](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node) + +# ServiceMonitor configuration +serviceMonitor: + # -- If enabled, ServiceMonitor resources for Prometheus Operator are created + enabled: false + # -- Alternative namespace for ServiceMonitor resources + namespace: null + # Service targetPort + targetPort: 9090 + # -- Namespace selector for ServiceMonitor resources + namespaceSelector: {} + # -- ServiceMonitor annotations + annotations: {} + # -- Additional ServiceMonitor labels + labels: {} + # -- ServiceMonitor scrape interval + interval: null + # -- ServiceMonitor scrape timeout in Go duration format (e.g. 15s) + scrapeTimeout: null + # -- ServiceMonitor relabel configs to apply to samples before scraping + # https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig + # (defines `relabel_configs`) + relabelings: [] + # -- ServiceMonitor relabel configs to apply to samples as the last + # step before ingestion + # https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig + # (defines `metric_relabel_configs`) + metricRelabelings: [] + # --ServiceMonitor will add labels from the service to the Prometheus metric + # https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec + targetLabels: [] + # -- ServiceMonitor will use http by default, but you can pick https as well + scheme: http + # -- ServiceMonitor will use these tlsConfig settings to make the health check requests + tlsConfig: null + # -- Prometheus rules will be deployed for alerting purposes + prometheusRule: + enabled: false + additionalLabels: {} + # namespace: + rules: [] \ No newline at end of file From 03307dd7669cae9d9de84be2ed617b61bfcd54de Mon Sep 17 00:00:00 2001 From: Ronan-WeScale Date: Fri, 11 Aug 2023 16:19:17 +0200 Subject: [PATCH 2/4] Add - prometheus rules --- .../k8s/chart/templates/prometheus-rules.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 deploy/k8s/chart/templates/prometheus-rules.yaml diff --git a/deploy/k8s/chart/templates/prometheus-rules.yaml b/deploy/k8s/chart/templates/prometheus-rules.yaml new file mode 100644 index 0000000..9bb7eae --- /dev/null +++ b/deploy/k8s/chart/templates/prometheus-rules.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.serviceMonitor.enabled .Values.serviceMonitor.prometheusRule.enabled -}} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ include "promtail.fullname" . }} + {{- with .Values.serviceMonitor.prometheusRule.namespace }} + namespace: {{ . | quote }} + {{- end }} + labels: + {{- include "cortex-tenant.labels" . | nindent 4 }} + {{- with .Values.serviceMonitor.prometheusRule.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.serviceMonitor.prometheusRule.rules }} + groups: + - name: {{ template "cortex-tenant.fullname" . }} + rules: + {{- toYaml .Values.serviceMonitor.prometheusRule.rules | nindent 4 }} +{{- end }} +{{- end }} \ No newline at end of file From 4cf44c221416e5cc215455413e63ba195901227f Mon Sep 17 00:00:00 2001 From: Ronan-WeScale Date: Fri, 11 Aug 2023 16:19:25 +0200 Subject: [PATCH 3/4] Update - chart README --- deploy/k8s/chart/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/deploy/k8s/chart/README.md b/deploy/k8s/chart/README.md index aab178d..0069589 100644 --- a/deploy/k8s/chart/README.md +++ b/deploy/k8s/chart/README.md @@ -56,4 +56,17 @@ A Helm Chart for cortex-tenant | service.port | int | `8080` | | | service.targetPort | int | `8080` | | | service.type | string | `"ClusterIP"` | | +| serviceMonitor.annotations | object | `{}` | ServiceMonitor annotations | +| serviceMonitor.enabled | bool | `false` | If enabled, ServiceMonitor resources for Prometheus Operator are created | +| serviceMonitor.interval | string | `nil` | ServiceMonitor scrape interval | +| serviceMonitor.labels | object | `{}` | Additional ServiceMonitor labels | +| serviceMonitor.metricRelabelings | list | `[]` | ServiceMonitor relabel configs to apply to samples as the last step before ingestion https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig (defines `metric_relabel_configs`) | +| serviceMonitor.namespace | string | `nil` | Alternative namespace for ServiceMonitor resources | +| serviceMonitor.namespaceSelector | object | `{}` | Namespace selector for ServiceMonitor resources | +| serviceMonitor.prometheusRule | object | `{"additionalLabels":{},"enabled":false,"rules":[]}` | Prometheus rules will be deployed for alerting purposes | +| serviceMonitor.relabelings | list | `[]` | ServiceMonitor relabel configs to apply to samples before scraping https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig (defines `relabel_configs`) | +| serviceMonitor.scheme | string | `"http"` | ServiceMonitor will use http by default, but you can pick https as well | +| serviceMonitor.scrapeTimeout | string | `nil` | ServiceMonitor scrape timeout in Go duration format (e.g. 15s) | +| serviceMonitor.targetLabels | list | `[]` | ServiceMonitor will add labels from the service to the Prometheus metric https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec | +| serviceMonitor.tlsConfig | string | `nil` | ServiceMonitor will use these tlsConfig settings to make the health check requests | | tolerations | list | `[]` | | From f344f40767be02bf50c5b5b1bd89b0dd01a7f462 Mon Sep 17 00:00:00 2001 From: Ronan-WeScale Date: Fri, 11 Aug 2023 17:35:49 +0200 Subject: [PATCH 4/4] Bump - chart version --- deploy/k8s/chart/Chart.yaml | 2 +- deploy/k8s/chart/README.md | 2 +- docs/cortex-tenant-0.3.0.tgz | Bin 0 -> 5722 bytes docs/index.yaml | 18 ++++++++++++++---- 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 docs/cortex-tenant-0.3.0.tgz diff --git a/deploy/k8s/chart/Chart.yaml b/deploy/k8s/chart/Chart.yaml index a52490d..4b88968 100644 --- a/deploy/k8s/chart/Chart.yaml +++ b/deploy/k8s/chart/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 description: A Helm Chart for cortex-tenant name: cortex-tenant -version: 0.2.1 # This is the chart version +version: 0.3.0 # This is the chart version appVersion: 1.11.0 # version number of the application being deployed. type: application diff --git a/deploy/k8s/chart/README.md b/deploy/k8s/chart/README.md index 0069589..f587819 100644 --- a/deploy/k8s/chart/README.md +++ b/deploy/k8s/chart/README.md @@ -1,6 +1,6 @@ # cortex-tenant -![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.0](https://img.shields.io/badge/AppVersion-1.11.0-informational?style=flat-square) +![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.11.0](https://img.shields.io/badge/AppVersion-1.11.0-informational?style=flat-square) A Helm Chart for cortex-tenant diff --git a/docs/cortex-tenant-0.3.0.tgz b/docs/cortex-tenant-0.3.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..26c9beda35ed0e038828927e7fba5b8f15a678c4 GIT binary patch literal 5722 zcmV-g7NzMQiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PKD1a@#nv@ciae^vbjKCHqAZ&BV37sBAg2Td64- zA|VMAl3)N(j@Hh*oM$;tb_zG%DcP~d$<&%t729M3eLoy^ibnn0t)GLcJTnI~;_d^aN&>OA}Cw+VZQKKhtTdcAd%mu40!?W z7E}qgfZ;jef~`PMh?5|2K>ZlefOxAu9M8_E7%|MTf{xW|xLM#xfstqq3O9EE1e*7u z)q*XslyMLXtO4X#c;(|6N&*3d!*xgdvCNoVzjhps*^+pQ6>X9ZgMDjm@zbWv?8R2+BPqiIVMcgr))Z`yg0?VGE9D@QyO_ZyE^{jHo{_;Fv*}Z~;?n zn>YX=i7v1*hJEP47Mzj@q9mMR26P57^`)fcXRugxGxRxawj-ON&-ZDjc{#-)Wvjsw zGc?EV;J%Y-xfLH zIP#TRh14fAg8htxSBFZuUl-7f2NypN$EgVWun;2dckM**rS_9)A}H(VR~^3e6klBw zlkT$DjT64GG>8Rek_xRU@F~G;C7G6jJsvIhfnkp_zbL)o+2HRd!^!dJ{eG&K6A~}? z`!GWR*J3%La|rMf2Sp*B|2#Pvz8{`Q3DNmPLGf&N}cK9y`z@w3uFoq*(KYOn0mUU-F*$rYogjg`*arqPZNTBizl(1T( zHRB}ma0Z;xw2(6`qKZe38NnP#Bn2Bn8*VUoD2k{6pDc-w^?MQt3fcu|DO^%Lr7E4P zv6x~|_FrfyYs8HYp;54U17rp?!qTuSWOzm*>_b~NSf#!AjK;CDc$x4{hvUJ~U_6l4 z)1c2!i{qKL-wgAZM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