Skip to content

Commit ee1adb7

Browse files
authored
Disable Promethues metrics exporting by default (#789)
Signed-off-by: Yi Chen <[email protected]>
1 parent 9308c01 commit ee1adb7

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

charts/jobset/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall) for command docum
8181
| controller.podSecurityContext | object | `{"runAsNonRoot":true,"seccompProfile":{"type":"RuntimeDefault"}}` | Security context of the jobset controller pods. |
8282
| certManager.enable | bool | `false` | Whether to use cert-manager to generate certificates for the jobset webhook. |
8383
| certManager.issuerRef | object | `{}` | The reference to the issuer. If empty, self-signed issuer will be created and used. |
84-
| prometheus.enable | bool | `true` | Whether to enable Prometheus metrics exporting. |
84+
| prometheus.enable | bool | `false` | Whether to enable Prometheus metrics exporting. |
8585

8686
## Maintainers
8787

charts/jobset/templates/prometheus/service_monitor.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ limitations under the License.
1515
*/ -}}
1616

1717
{{- if .Values.prometheus.enable }}
18+
{{- if not (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }}
19+
{{- fail "The cluster does not support the required API resource `monitoring.coreos.com/v1/ServiceMonitor`." }}
20+
{{- end -}}
1821
apiVersion: monitoring.coreos.com/v1
1922
kind: ServiceMonitor
2023
metadata:

charts/jobset/tests/prometheus/service_monitor_test.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ release:
2424
namespace: jobset-system
2525

2626
tests:
27+
- it: Should not create Prometheus ServiceMonitor by default
28+
asserts:
29+
- hasDocuments:
30+
count: 0
31+
2732
- it: Should create Prometheus ServiceMonitor if `prometheus.enable` is `true`
33+
capabilities:
34+
apiVersions:
35+
- monitoring.coreos.com/v1/ServiceMonitor
2836
set:
2937
prometheus:
3038
enable: true
@@ -33,3 +41,11 @@ tests:
3341
apiVersion: monitoring.coreos.com/v1
3442
kind: ServiceMonitor
3543
name: jobset-metrics-service-monitor
44+
45+
- it: Should fail if the cluster does not support the required API resource `monitoring.coreos.com/v1/ServiceMonitor`
46+
set:
47+
prometheus:
48+
enable: true
49+
asserts:
50+
- failedTemplate:
51+
errorMessage: "The cluster does not support the required API resource `monitoring.coreos.com/v1/ServiceMonitor`."

charts/jobset/tests/prometheus/service_test.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ release:
2424
namespace: jobset-system
2525

2626
tests:
27+
- it: Should not create Prometheus metrics service by default
28+
asserts:
29+
- hasDocuments:
30+
count: 0
31+
2732
- it: Should create Prometheus Service if `prometheus.enable` is `true`
2833
set:
2934
prometheus:

charts/jobset/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ certManager:
107107

108108
prometheus:
109109
# -- Whether to enable Prometheus metrics exporting.
110-
enable: true
110+
enable: false

0 commit comments

Comments
 (0)