Skip to content
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 deploy/charts/version-checker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ A Helm chart for version-checker
| service.labels | object | `{}` | Additional labels to add to the service |
| service.port | int | `8080` | Port to expose within the service |
| serviceMonitor.additionalLabels | object | `{}` | Additional labels to add to the ServiceMonitor |
| serviceMonitor.enabled | bool | `false` | Disable/Enable ServiceMonitor Object |
| serviceMonitor.enabled | bool | `true` | Disable/Enable ServiceMonitor Object |
| tolerations | list | `[]` | Configure tolerations |
| topologySpreadConstraints | list | `[]` | Set topologySpreadConstraints |
| versionChecker.imageCacheTimeout | string | `"30m"` | How long to hold on to image tags and their versions |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if or .Values.serviceMonitor.enabled }}
{{- if and .Values.serviceMonitor.enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
27 changes: 18 additions & 9 deletions deploy/charts/version-checker/tests/servicemonitor_test.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
suite: test ServiceMonitor
templates:
- servicemonitor.yaml
capabilities:
apiVersions:
- "monitoring.coreos.com/v1"
- "monitoring.coreos.com/v1/ServiceMonitor"
tests:
- it: should work (defaults)
asserts:
- hasDocuments:
count: 0

- it: works (when enabled)
set:
serviceMonitor.enabled: true
- it: Should deploy (defaults)
asserts:
- hasDocuments:
count: 1
Expand All @@ -18,7 +15,19 @@ tests:
apiVersion: monitoring.coreos.com/v1
name: version-checker

- it: able to provide custom labels
- it: Not Deploy when disabled
capabilities:
apiVersions: []
set:
serviceMonitor.enabled: false
asserts:
- hasDocuments:
count: 0

- it: Able to provide custom labels
capabilities:
apiVersions:
- "monitoring.coreos.com/v1/ServiceMonitor"
set:
serviceMonitor.enabled: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably remove this line, from this test if enabled by default?

serviceMonitor.additionalLabels:
Expand Down
2 changes: 1 addition & 1 deletion deploy/charts/version-checker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ prometheus:
# Configure a Prometheus-Operator ServiceMonitor object
serviceMonitor:
# -- Disable/Enable ServiceMonitor Object
enabled: false
enabled: true
# -- Additional labels to add to the ServiceMonitor
additionalLabels: {}

Expand Down
Loading