Skip to content

Commit

Permalink
Chart: Add controller.metrics.prometheusRule.annotations. (#11849)
Browse files Browse the repository at this point in the history
  • Loading branch information
adberger authored Aug 26, 2024
1 parent 5d457c7 commit 3cde777
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/ingress-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
| controller.metrics.port | int | `10254` | |
| controller.metrics.portName | string | `"metrics"` | |
| controller.metrics.prometheusRule.additionalLabels | object | `{}` | |
| controller.metrics.prometheusRule.annotations | object | `{}` | Annotations to be added to the PrometheusRule. |
| controller.metrics.prometheusRule.enabled | bool | `false` | |
| controller.metrics.prometheusRule.rules | list | `[]` | |
| controller.metrics.service.annotations | object | `{}` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/ingress-nginx/templates/controller-prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ metadata:
{{- if .Values.controller.metrics.prometheusRule.additionalLabels }}
{{- toYaml .Values.controller.metrics.prometheusRule.additionalLabels | nindent 4 }}
{{- end }}
{{- if .Values.controller.metrics.prometheusRule.annotations }}
annotations: {{ toYaml .Values.controller.metrics.prometheusRule.annotations | nindent 4 }}
{{- end }}
spec:
{{- if .Values.controller.metrics.prometheusRule.rules }}
groups:
Expand Down
12 changes: 12 additions & 0 deletions charts/ingress-nginx/tests/controller-prometheusrule_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ tests:
- equal:
path: metadata.name
value: RELEASE-NAME-ingress-nginx-controller

- it: should create a PrometheusRule with annotations if `controller.metrics.prometheusRule.annotations` is set
set:
controller.metrics.enabled: true
controller.metrics.prometheusRule.enabled: true
controller.metrics.prometheusRule.annotations:
my-little-annotation: test-value
asserts:
- equal:
path: metadata.annotations
value:
my-little-annotation: test-value
2 changes: 2 additions & 0 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@ controller:
prometheusRule:
enabled: false
additionalLabels: {}
# -- Annotations to be added to the PrometheusRule.
annotations: {}
# namespace: ""
rules: []
# # These are just examples rules, please adapt them to your needs
Expand Down

0 comments on commit 3cde777

Please sign in to comment.