Skip to content

Commit c40eeb7

Browse files
committed
Add prometheus support to helm chart
- Update helm chart documentation - Add prometheus support to daemonset and deployment templates
1 parent a636f5d commit c40eeb7

File tree

5 files changed

+51
-1
lines changed

5 files changed

+51
-1
lines changed

helm-chart/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: nginx-ingress
2-
version: 0.1.0
2+
version: 0.1.1
33
appVersion: 1.2.0
44
description: NGINX Ingress Controller
55
sources:

helm-chart/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ Parameter | Description | Default
8282
`controller.watchNamespace` | Namespace to watch for Ingress resources. By default the Ingress controller watches all namespaces. | ""
8383
`controller.healthStatus` | Add a location "/nginx-health" to the default server. The location responds with the 200 status code for any request. Useful for external health-checking of the Ingress controller. | false
8484
`rbac.create` | Configures RBAC. | true
85+
`prometheues.create` | Deploys a Prometheus exporter container within the Ingress controller pod. Requires NGINX Plus. `controller.nginxplus` must be set to `true`. | false
86+
`prometheus.port` | Configures the port to scrape the metrics. | 9113
87+
`prometheus.image.repository` | The image repository of the Prometheus exporter. | nginx/nginx-prometheus-exporter
88+
`prometheus.image.tag` | The tag of the Prometheus exporter image. | 0.1.0
89+
`prometheus.image.pullPolicy` | The pull policy for the Prometheus exporter image. | IfNotPresent
8590

8691
Example:
8792
```

helm-chart/templates/controller-daemonset.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ spec:
1616
metadata:
1717
labels:
1818
app: {{ .Values.controller.name | trunc 63 }}
19+
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
20+
annotations:
21+
prometheus.io/scrape: "true"
22+
prometheus.io/port: "{{ .Values.prometheus.port }}"
23+
{{- end }}
1924
spec:
2025
{{- if .Values.controller.serviceAccountName }}
2126
serviceAccountName: {{ .Values.controller.serviceAccountName }}
@@ -72,4 +77,18 @@ spec:
7277
{{- if .Values.controller.healthStatus }}
7378
- -health-status
7479
{{- end }}
80+
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
81+
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
82+
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
83+
name: nginx-prometheus-exporter
84+
ports:
85+
- name: prometheus
86+
containerPort: {{ .Values.prometheus.port }}
87+
args:
88+
- -web.listen-address
89+
- :{{ .Values.prometheus.port }}
90+
- -nginx.plus
91+
- -nginx.scrape-uri
92+
- http://127.0.0.1:8080/api
93+
{{- end }}
7594
{{- end }}

helm-chart/templates/controller-deployment.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ spec:
1717
metadata:
1818
labels:
1919
app: {{ .Values.controller.name | trunc 63 }}
20+
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
21+
annotations:
22+
prometheus.io/scrape: "true"
23+
prometheus.io/port: "{{ .Values.prometheus.port }}"
24+
{{- end }}
2025
spec:
2126
{{- if .Values.controller.serviceAccountName }}
2227
serviceAccountName: {{ .Values.controller.serviceAccountName }}
@@ -58,4 +63,18 @@ spec:
5863
{{- if .Values.controller.healthStatus }}
5964
- -health-status
6065
{{- end }}
66+
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
67+
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
68+
name: nginx-prometheus-exporter
69+
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
70+
ports:
71+
- name: prometheus
72+
containerPort: {{ .Values.prometheus.port }}
73+
args:
74+
- -web.listen-address
75+
- :{{ .Values.prometheus.port }}
76+
- -nginx.plus
77+
- -nginx.scrape-uri
78+
- http://127.0.0.1:8080/api
79+
{{- end }}
6180
{{- end }}

helm-chart/values-plus.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ controller:
3030
serviceAccountName: nginx-ingress
3131
rbac:
3232
create: true
33+
prometheus:
34+
create: false
35+
port: 9113
36+
image:
37+
repository: nginx/nginx-prometheus-exporter
38+
tag: "0.1.0"
39+
pullPolicy: IfNotPresent

0 commit comments

Comments
 (0)