Skip to content

Add prometheus exporter support to helm chart #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: nginx-ingress
version: 0.1.0
version: 0.1.1
appVersion: 1.2.0
description: NGINX Ingress Controller
sources:
Expand Down
5 changes: 5 additions & 0 deletions helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ Parameter | Description | Default
`controller.watchNamespace` | Namespace to watch for Ingress resources. By default the Ingress controller watches all namespaces. | ""
`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
`rbac.create` | Configures RBAC. | true
`prometheues.create` | Deploys a Prometheus exporter container within the Ingress controller pod. Requires NGINX Plus. `controller.nginxplus` must be set to `true`. | false
`prometheus.port` | Configures the port to scrape the metrics. | 9113
`prometheus.image.repository` | The image repository of the Prometheus exporter. | nginx/nginx-prometheus-exporter
`prometheus.image.tag` | The tag of the Prometheus exporter image. | 0.1.0
`prometheus.image.pullPolicy` | The pull policy for the Prometheus exporter image. | IfNotPresent

Example:
```
Expand Down
19 changes: 19 additions & 0 deletions helm-chart/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ spec:
metadata:
labels:
app: {{ .Values.controller.name | trunc 63 }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.prometheus.port }}"
{{- end }}
spec:
{{- if .Values.controller.serviceAccountName }}
serviceAccountName: {{ .Values.controller.serviceAccountName }}
Expand Down Expand Up @@ -72,4 +77,18 @@ spec:
{{- if .Values.controller.healthStatus }}
- -health-status
{{- end }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
name: nginx-prometheus-exporter
ports:
- name: prometheus
containerPort: {{ .Values.prometheus.port }}
args:
- -web.listen-address
- :{{ .Values.prometheus.port }}
- -nginx.plus
- -nginx.scrape-uri
- http://127.0.0.1:8080/api
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions helm-chart/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ spec:
metadata:
labels:
app: {{ .Values.controller.name | trunc 63 }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.prometheus.port }}"
{{- end }}
spec:
{{- if .Values.controller.serviceAccountName }}
serviceAccountName: {{ .Values.controller.serviceAccountName }}
Expand Down Expand Up @@ -58,4 +63,18 @@ spec:
{{- if .Values.controller.healthStatus }}
- -health-status
{{- end }}
{{- if and (.Values.controller.nginxplus) (.Values.prometheus.create) }}
- image: "{{ .Values.prometheus.image.repository }}:{{ .Values.prometheus.image.tag }}"
name: nginx-prometheus-exporter
imagePullPolicy: "{{ .Values.prometheus.image.pullPolicy }}"
ports:
- name: prometheus
containerPort: {{ .Values.prometheus.port }}
args:
- -web.listen-address
- :{{ .Values.prometheus.port }}
- -nginx.plus
- -nginx.scrape-uri
- http://127.0.0.1:8080/api
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions helm-chart/values-plus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ controller:
serviceAccountName: nginx-ingress
rbac:
create: true
prometheus:
create: false
port: 9113
image:
repository: nginx/nginx-prometheus-exporter
tag: "0.1.0"
pullPolicy: IfNotPresent