feat: validate scrape configs · GoogleCloudPlatform/prometheus-engine@99aa511 (original) (raw)
`@@ -129,9 +129,9 @@ spec:
`
129
129
`type: string
`
130
130
`type: object
`
131
131
`interval:
`
132
``
`-
default: 1m
`
133
132
`description: Interval at which to scrape metrics. Must be a
`
134
133
`valid Prometheus duration.
`
``
134
`+
format: duration
`
135
135
`pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)$
`
136
136
`type: string
`
137
137
`metricRelabeling:
`
`@@ -147,6 +147,18 @@ spec:
`
147
147
`action:
`
148
148
`description: Action to perform based on regex matching.
`
149
149
`Defaults to 'replace'.
`
``
150
`+
enum:
`
``
151
`+
- replace
`
``
152
`+
- lowercase
`
``
153
`+
- uppercase
`
``
154
`+
- keep
`
``
155
`+
- drop
`
``
156
`+
- keepequal
`
``
157
`+
- dropequal
`
``
158
`+
- hashmod
`
``
159
`+
- labeldrop
`
``
160
`+
- labelkeep
`
``
161
`+
format: relabel_action
`
150
162
`type: string
`
151
163
`modulus:
`
152
164
`description: Modulus to take of the hash of the source
`
`@@ -172,12 +184,16 @@ spec:
`
172
184
` using the configured separator and matched against the configured regular expression
`
173
185
` for the replace, keep, and drop actions.
`
174
186
`items:
`
``
187
`+
format: labelname
`
``
188
`+
pattern: '[a-zA-Z_][a-zA-Z0-9_]*'
`
175
189
`type: string
`
176
190
`type: array
`
177
191
`targetLabel:
`
178
192
`description: |-
`
179
193
` Label to which the resulting value is written in a replace action.
`
180
194
` It is mandatory for replace actions. Regex capture groups are available.
`
``
195
`+
format: labelname
`
``
196
`+
pattern: '[a-zA-Z_][a-zA-Z0-9_]*'
`
181
197
`type: string
`
182
198
`type: object
`
183
199
`type: array
`
`@@ -366,11 +382,16 @@ spec:
`
366
382
`type: string
`
367
383
`scheme:
`
368
384
`description: Protocol scheme to use to scrape.
`
``
385
`+
enum:
`
``
386
`+
- http
`
``
387
`+
- https
`
369
388
`type: string
`
370
389
`timeout:
`
371
390
`description: |-
`
372
391
` Timeout for metrics scrapes. Must be a valid Prometheus duration.
`
373
392
` Must not be larger than the scrape interval.
`
``
393
`+
format: duration
`
``
394
`+
pattern: ^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)$
`
374
395
`type: string
`
375
396
`tls:
`
376
397
`description: TLS configures the scrape request's TLS settings.
`
`@@ -479,6 +500,11 @@ spec:
`
479
500
`required:
`
480
501
` - port
`
481
502
`type: object
`
``
503
`+
x-kubernetes-validations:
`
``
504
`+
- messageExpression: '''"scrape timeout " + self.timeout + "must
`
``
505
`+
not be greater than scrape interval" + self.interval'''
`
``
506
`+
rule: '!has(self.interval) || !has(self.timeout) || self.interval
`
``
507
`+
<= self.timeout'
`
482
508
`minItems: 1
`
483
509
`type: array
`
484
510
`filterRunning:
`
`@@ -592,11 +618,15 @@ spec:
`
592
618
`properties:
`
593
619
`from:
`
594
620
`description: Kubernetes resource label to remap.
`
``
621
`+
format: labelname
`
``
622
`+
pattern: '[a-zA-Z_][a-zA-Z0-9_]*'
`
595
623
`type: string
`
596
624
`to:
`
597
625
`description: |-
`
598
626
` Remapped Prometheus target label.
`
599
627
`` Defaults to the same name as From.
``
``
628
`+
format: labelname
`
``
629
`+
pattern: '[a-zA-Z_][a-zA-Z0-9_]*'
`
600
630
`type: string
`
601
631
`required:
`
602
632
` - from
`
`@@ -615,8 +645,16 @@ spec:
`
615
645
` and to [namespace] for ClusterPodMonitoring. This is for backwards-compatibility
`
616
646
` only.
`
617
647
`items:
`
``
648
`+
enum:
`
``
649
`+
- pod
`
``
650
`+
- container
`
``
651
`+
- node
`
``
652
`+
- namespace
`
``
653
`+
- top_level_controller_name
`
``
654
`+
- top_level_controller_type
`
618
655
`type: string
`
619
656
`type: array
`
``
657
`+
x-kubernetes-list-type: set
`
620
658
`type: object
`
621
659
`required:
`
622
660
` - endpoints
`