Skip to content

Commit

Permalink
Update helm values file to move controller.serviceMonitor to promethe…
Browse files Browse the repository at this point in the history
…us.serviceMonitor (#4351)
  • Loading branch information
shaun-nx authored Sep 20, 2023
1 parent 372aeb9 commit 3b91d97
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 68 deletions.
12 changes: 6 additions & 6 deletions deployments/helm-chart/templates/controller-servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{{- if .Values.controller.serviceMonitor.create }}
{{- if .Values.prometheus.serviceMonitor.create }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "nginx-ingress.controller.fullname" . }}
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 }}
98 changes: 49 additions & 49 deletions deployments/helm-chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down Expand Up @@ -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": [
Expand Down Expand Up @@ -1740,12 +1740,6 @@
"minAvailable": 0,
"minUnavailable": 0
},
"serviceMonitor": {
"create": false,
"labels": {},
"selectorMatchLabels": {},
"endpoints": {}
},
"reportIngressStatus": {
"enable": true,
"externalService": "",
Expand Down Expand Up @@ -1779,6 +1773,12 @@
"service": {
"create": false,
"labels": {}
},
"serviceMonitor": {
"create": false,
"labels": {},
"selectorMatchLabels": {},
"endpoints": {}
}
},
"serviceInsight": {
Expand Down
30 changes: 17 additions & 13 deletions deployments/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/content/installation/installation-with-helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit 3b91d97

Please sign in to comment.