Skip to content

Commit 00200bc

Browse files
committed
test: validate nodemonitorings with CEL
1 parent fd42d64 commit 00200bc

File tree

4 files changed

+595
-468
lines changed

4 files changed

+595
-468
lines changed

charts/operator/crds/monitoring.googleapis.com_clusternodemonitorings.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
default: 1m
6565
description: Interval at which to scrape metrics. Must be a
6666
valid Prometheus duration.
67-
pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)$
67+
format: duration
6868
type: string
6969
metricRelabeling:
7070
description: |-
@@ -158,11 +158,15 @@ spec:
158158
type: string
159159
scheme:
160160
description: Protocol scheme to use to scrape.
161+
enum:
162+
- http
163+
- https
161164
type: string
162165
timeout:
163166
description: |-
164167
Timeout for metrics scrapes. Must be a valid Prometheus duration.
165168
Must not be larger then the scrape interval.
169+
format: duration
166170
type: string
167171
tls:
168172
description: TLS configures the scrape request's TLS settings.
@@ -172,7 +176,13 @@ spec:
172176
validation.
173177
type: boolean
174178
type: object
179+
required:
180+
- interval
175181
type: object
182+
x-kubernetes-validations:
183+
- messageExpression: '''scrape timeout (%s) must not be greater
184+
than scrape interval (%s)''.format([self.timeout, self.interval])'
185+
rule: '!has(self.timeout) || self.timeout <= self.interval'
176186
maxItems: 100
177187
minItems: 1
178188
type: array

0 commit comments

Comments
 (0)