Skip to content
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

🐛 Don't fail when prometheus is disabled #756

Merged
merged 1 commit into from
Dec 7, 2022
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
7 changes: 5 additions & 2 deletions traefik/templates/service-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{{- fail "ERROR: Cannot create a metrics service when name contains more than 50 characters" }}
{{- end }}

{{- if .Values.metrics.prometheus }}
{{- if .Values.metrics.prometheus.service }}
{{- if (and (.Values.metrics.prometheus.service).enabled (not .Values.hub.enabled)) -}}
apiVersion: v1
kind: Service
Expand All @@ -26,5 +28,6 @@ spec:
{{- if .Values.ports.metrics.nodePort }}
nodePort: {{ .Values.ports.metrics.nodePort }}
{{- end }}
{{- end -}}

{{- end }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions traefik/tests/metrics-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ suite: Traefik Metrics configuration
templates:
- deployment.yaml
tests:
- it: "should support to set prometheus: null"
set:
metrics:
prometheus: null
asserts:
- hasDocuments:
count: 1
- it: should have prometheus enabled by default on metrics entrypoint
asserts:
- contains:
Expand Down
7 changes: 7 additions & 0 deletions traefik/tests/service-metrics-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ suite: Metrics Service configuration
templates:
- service-metrics.yaml
tests:
- it: "should support prometheus: null"
set:
metrics:
prometheus: null
asserts:
- hasDocuments:
count: 0
- it: should not provide a dedicated metrics service by default
asserts:
- hasDocuments:
Expand Down