From 3b91d97fc40f1006391c697f9f6832b92f6f5e22 Mon Sep 17 00:00:00 2001 From: Shaun Date: Wed, 20 Sep 2023 12:05:15 +0100 Subject: [PATCH] Update helm values file to move controller.serviceMonitor to prometheus.serviceMonitor (#4351) --- .../templates/controller-servicemonitor.yaml | 12 +-- deployments/helm-chart/values.schema.json | 98 +++++++++---------- deployments/helm-chart/values.yaml | 30 +++--- .../installation/installation-with-helm.md | 7 ++ 4 files changed, 79 insertions(+), 68 deletions(-) diff --git a/deployments/helm-chart/templates/controller-servicemonitor.yaml b/deployments/helm-chart/templates/controller-servicemonitor.yaml index a279af3382..e1a4268f95 100644 --- a/deployments/helm-chart/templates/controller-servicemonitor.yaml +++ b/deployments/helm-chart/templates/controller-servicemonitor.yaml @@ -1,4 +1,4 @@ -{{- if .Values.controller.serviceMonitor.create }} +{{- if .Values.prometheus.serviceMonitor.create }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: @@ -6,16 +6,16 @@ metadata: namespace: {{ .Release.Namespace }} labels: {{- include "nginx-ingress.labels" . | nindent 4 }} - {{- if .Values.controller.serviceMonitor.labels -}} - {{- toYaml .Values.controller.serviceMonitor.labels | nindent 4 }} + {{- if .Values.prometheus.serviceMonitor.labels -}} + {{- toYaml .Values.prometheus.serviceMonitor.labels | nindent 4 }} {{- end }} spec: selector: matchLabels: - {{- if .Values.controller.serviceMonitor.selectorMatchLabels -}} - {{- toYaml .Values.controller.serviceMonitor.selectorMatchLabels | nindent 6 }} + {{- if .Values.prometheus.serviceMonitor.selectorMatchLabels -}} + {{- toYaml .Values.prometheus.serviceMonitor.selectorMatchLabels | nindent 6 }} {{- end }} {{- include "nginx-ingress.selectorLabels" . | nindent 6 }} endpoints: - {{- toYaml .Values.controller.serviceMonitor.endpoints | nindent 4 }} + {{- toYaml .Values.prometheus.serviceMonitor.endpoints | nindent 4 }} {{- end }} diff --git a/deployments/helm-chart/values.schema.json b/deployments/helm-chart/values.schema.json index b8efc0b713..4c089d282c 100644 --- a/deployments/helm-chart/values.schema.json +++ b/deployments/helm-chart/values.schema.json @@ -1061,49 +1061,6 @@ } ] }, - "serviceMonitor": { - "type": "object", - "default": {}, - "title": "The serviceMonitor Schema", - "required": [], - "properties": { - "create": { - "type": "boolean", - "default": false, - "title": "The create", - "examples": [ - false - ] - }, - "labels": { - "type": "object", - "default": {}, - "title": "The labels Schema", - "$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta/properties/labels" - }, - "selectorMatchLabels": { - "type": "object", - "default": {}, - "title": "The selectorMatchLabels Schema", - "$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector/properties/matchLabels" - }, - "endpoints": { - "type": "array", - "default": [], - "title": "The endpoints", - "required": [], - "items": {} - } - }, - "examples": [ - { - "create": false, - "labels": {}, - "selectorMatchLabels": {}, - "endpoints": [] - } - ] - }, "reportIngressStatus": { "type": "object", "default": {}, @@ -1524,6 +1481,49 @@ "$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta/properties/labels" } } + }, + "serviceMonitor": { + "type": "object", + "default": {}, + "title": "The serviceMonitor Schema", + "required": [], + "properties": { + "create": { + "type": "boolean", + "default": false, + "title": "The create", + "examples": [ + false + ] + }, + "labels": { + "type": "object", + "default": {}, + "title": "The labels Schema", + "$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta/properties/labels" + }, + "selectorMatchLabels": { + "type": "object", + "default": {}, + "title": "The selectorMatchLabels Schema", + "$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector/properties/matchLabels" + }, + "endpoints": { + "type": "array", + "default": [], + "title": "The endpoints", + "required": [], + "items": {} + } + }, + "examples": [ + { + "create": false, + "labels": {}, + "selectorMatchLabels": {}, + "endpoints": [] + } + ] } }, "examples": [ @@ -1740,12 +1740,6 @@ "minAvailable": 0, "minUnavailable": 0 }, - "serviceMonitor": { - "create": false, - "labels": {}, - "selectorMatchLabels": {}, - "endpoints": {} - }, "reportIngressStatus": { "enable": true, "externalService": "", @@ -1779,6 +1773,12 @@ "service": { "create": false, "labels": {} + }, + "serviceMonitor": { + "create": false, + "labels": {}, + "selectorMatchLabels": {}, + "endpoints": {} } }, "serviceInsight": { diff --git a/deployments/helm-chart/values.yaml b/deployments/helm-chart/values.yaml index a6c38a76cc..f1fc00510f 100644 --- a/deployments/helm-chart/values.yaml +++ b/deployments/helm-chart/values.yaml @@ -439,19 +439,6 @@ controller: ## Configure root filesystem as read-only and add volumes for temporary data. readOnlyRootFilesystem: false - serviceMonitor: - ## Creates a serviceMonitor to expose statistics on the kubernetes pods. - create: false - - ## Kubernetes object labels to attach to the serviceMonitor object. - labels: {} - - ## A set of labels to allow the selection of endpoints for the ServiceMonitor. - selectorMatchLabels: {} - - ## A list of endpoints allowed as part of this ServiceMonitor. - endpoints: [] - rbac: ## Configures RBAC. create: true @@ -474,8 +461,25 @@ prometheus: ## Requires prometheus.create=true create: false + labels: + service: "nginx-ingress-prometheus-service" + + serviceMonitor: + ## Creates a serviceMonitor to expose statistics on the kubernetes pods. + create: false + + ## Kubernetes object labels to attach to the serviceMonitor object. labels: {} + ## A set of labels to allow the selection of endpoints for the ServiceMonitor. + selectorMatchLabels: + service: "nginx-ingress-prometheus-service" + + ## A list of endpoints allowed as part of this ServiceMonitor. + ## Matches on the name of a Service port. + endpoints: + - port: prometheus + serviceInsight: ## Expose NGINX Plus Service Insight endpoint. create: false diff --git a/docs/content/installation/installation-with-helm.md b/docs/content/installation/installation-with-helm.md index e4f3223253..442985ab6a 100644 --- a/docs/content/installation/installation-with-helm.md +++ b/docs/content/installation/installation-with-helm.md @@ -411,6 +411,13 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont |`prometheus.port` | Configures the port to scrape the metrics. | 9113 | |`prometheus.scheme` | Configures the HTTP scheme to use for connections to the Prometheus endpoint. | http | |`prometheus.secret` | The namespace / name of a Kubernetes TLS Secret. If specified, this secret is used to secure the Prometheus endpoint with TLS connections. | "" | +|`prometheus.service.create` | Create a Headless service to expose prometheus metrics. Requires `prometheus.create`. | false | +|`prometheus.service.endpoint` | Configures the name of the service's port listing. | prometheus | +|`prometheus.service.labels` | Kubernetes object labels to attach to the service object. | "" | +|`prometheus.serviceMonitor.create` | Create a ServiceMonitor custom resource. Requires ServiceMonitor CRD to be installed. For the latest CRD, check the latest release on the [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) GitHub repo under `example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml` | false | +|`prometheus.serviceMonitor.labels` | Kubernetes object labels to attach to the serviceMonitor object. | "" | +|`prometheus.serviceMonitor.selectorMatchLabels` | A set of labels to allow the selection of endpoints for the ServiceMonitor. | "" | +|`prometheus.serviceMonitor.endpoints` | A list of endpoints allowed as part of this ServiceMonitor. | "" | |`serviceInsight.create` | Expose NGINX Plus Service Insight endpoint. | false | |`serviceInsight.port` | Configures the port to expose endpoints. | 9114 | |`serviceInsight.scheme` | Configures the HTTP scheme to use for connections to the Service Insight endpoint. | http |