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 aab178d..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 @@ -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 | `[]` | | 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/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 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 diff --git a/docs/cortex-tenant-0.3.0.tgz b/docs/cortex-tenant-0.3.0.tgz new file mode 100644 index 0000000..26c9bed Binary files /dev/null and b/docs/cortex-tenant-0.3.0.tgz differ diff --git a/docs/index.yaml b/docs/index.yaml index b2332d2..cab647d 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -3,7 +3,17 @@ entries: cortex-tenant: - apiVersion: v2 appVersion: 1.11.0 - created: "2023-07-21T13:23:40.3468175+02:00" + created: "2023-08-11T17:35:30.148984+02:00" + description: A Helm Chart for cortex-tenant + digest: cf12ab22dd0973e94e15d8246f66ae35738dadfc489952f919ed326a1f7eed5a + name: cortex-tenant + type: application + urls: + - cortex-tenant-0.3.0.tgz + version: 0.3.0 + - apiVersion: v2 + appVersion: 1.11.0 + created: "2023-08-11T17:35:30.148575+02:00" description: A Helm Chart for cortex-tenant digest: c967d4dea6ff8ae827133876f588d22bfa51d10168e4bca57f161b7ab6097c7c name: cortex-tenant @@ -13,7 +23,7 @@ entries: version: 0.2.1 - apiVersion: v2 appVersion: 1.11.0 - created: "2023-07-21T13:23:40.3464084+02:00" + created: "2023-08-11T17:35:30.148215+02:00" description: A Helm Chart for cortex-tenant digest: 8b9caea0e1774a6c8f3e627a63386f532498ca5f410927c702380692e5d20b61 name: cortex-tenant @@ -23,7 +33,7 @@ entries: version: 0.2.0 - apiVersion: v2 appVersion: 1.10.1 - created: "2023-07-21T13:23:40.3459992+02:00" + created: "2023-08-11T17:35:30.147801+02:00" description: A Helm Chart for cortex-tenant digest: eabef3ad16e555543e32d9308994f76679e5fa54371cccd3957112f33a28a59e name: cortex-tenant @@ -31,4 +41,4 @@ entries: urls: - cortex-tenant-0.1.0.tgz version: 0.1.0 -generated: "2023-07-21T13:23:40.3454267+02:00" +generated: "2023-08-11T17:35:30.147201+02:00"