1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-15 16:56:24 +00:00

feat: update Prometheus to v2.45.0 & Add global limits fields (#5646)

Add global limits field to Prometheus

Co-authored-by: Arthur Silva Sens <arthur.sens@coralogix.com>
This commit is contained in:
Mohamed Chiheb Ben Jemaa 2023-07-21 23:55:47 +02:00 committed by GitHub
parent 062874f27d
commit ec8188c48b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 984 additions and 15 deletions

400
Documentation/api.md generated
View file

@ -2360,6 +2360,86 @@ breaking way.</p>
</tr>
<tr>
<td>
<code>bodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
ByteSize
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>sampleLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>targetLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>TargetLimit defines a limit on the number of scraped targets that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on number of labels that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelNameLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels name that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelValueLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels value that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>baseImage</code><br/>
<em>
string
@ -6397,6 +6477,86 @@ experimental feature, it may change in any upcoming release in a
breaking way.</p>
</td>
</tr>
<tr>
<td>
<code>bodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
ByteSize
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>sampleLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>targetLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>TargetLimit defines a limit on the number of scraped targets that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on number of labels that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelNameLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels name that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelValueLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels value that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1.Condition">Condition
@ -9991,6 +10151,86 @@ breaking way.</p>
</tr>
<tr>
<td>
<code>bodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
ByteSize
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>sampleLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>targetLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>TargetLimit defines a limit on the number of scraped targets that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on number of labels that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelNameLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels name that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelValueLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels value that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>baseImage</code><br/>
<em>
string
@ -15156,6 +15396,86 @@ experimental feature, it may change in any upcoming release in a
breaking way.</p>
</td>
</tr>
<tr>
<td>
<code>bodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
ByteSize
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>sampleLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>targetLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>TargetLimit defines a limit on the number of scraped targets that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on number of labels that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelNameLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels name that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelValueLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels value that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
</table>
</td>
</tr>
@ -18458,6 +18778,86 @@ experimental feature, it may change in any upcoming release in a
breaking way.</p>
</td>
</tr>
<tr>
<td>
<code>bodySizeLimit</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.ByteSize">
ByteSize
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>sampleLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>targetLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>TargetLimit defines a limit on the number of scraped targets that will be accepted.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on number of labels that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelNameLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels name that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
<tr>
<td>
<code>labelValueLengthLimit</code><br/>
<em>
uint64
</em>
</td>
<td>
<em>(Optional)</em>
<p>Per-scrape limit on length of labels value that will be accepted for a sample.
Only valid in Prometheus versions 2.45.0 and newer.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.PushoverConfig">PushoverConfig

View file

@ -56,12 +56,13 @@ Prometheus Operator supports all Prometheus versions >= v2.0.0. The operator's e
* v2.43.0
* v2.43.1
* v2.44.0
* v2.45.0
```
The end-to-end tests are mostly tested against
```$ mdox-exec="go run ./cmd/po-docgen/. compatibility defaultPrometheusVersion"
* v2.44.0
* v2.45.0
```
## Alertmanager

68
bundle.yaml generated
View file

@ -14828,6 +14828,11 @@ spec:
deny:
type: boolean
type: object
bodySizeLimit:
description: BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@ -17598,6 +17603,23 @@ spec:
- name
type: object
type: array
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
format: int64
type: integer
labelNameLengthLimit:
description: Per-scrape limit on length of labels name that will be
accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
labelValueLengthLimit:
description: Per-scrape limit on length of labels value that will
be accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@ -18509,6 +18531,12 @@ spec:
is still true, but the server serves requests under a different
route prefix. For example for use with `kubectl proxy`."
type: string
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@ -19567,6 +19595,12 @@ spec:
type: object
type: object
type: object
targetLimit:
description: TargetLimit defines a limit on the number of scraped
targets that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
tolerations:
description: Defines the Pods' tolerations if specified.
items:
@ -23443,6 +23477,11 @@ spec:
baseImage:
description: '*Deprecated: use ''spec.image'' instead.*'
type: string
bodySizeLimit:
description: BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@ -26243,6 +26282,23 @@ spec:
- name
type: object
type: array
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
format: int64
type: integer
labelNameLengthLimit:
description: Per-scrape limit on length of labels name that will be
accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
labelValueLengthLimit:
description: Per-scrape limit on length of labels value that will
be accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@ -27699,6 +27755,12 @@ spec:
type: string
type: object
type: object
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@ -28765,6 +28827,12 @@ spec:
description: '*Deprecated: use ''spec.image'' instead. The image''s
tag can be specified as part of the image name.*'
type: string
targetLimit:
description: TargetLimit defines a limit on the number of scraped
targets that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
thanos:
description: "Defines the configuration of the optional Thanos sidecar.
\n This section is experimental, it may change significantly without

View file

@ -1196,6 +1196,11 @@ spec:
deny:
type: boolean
type: object
bodySizeLimit:
description: BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@ -3966,6 +3971,23 @@ spec:
- name
type: object
type: array
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
format: int64
type: integer
labelNameLengthLimit:
description: Per-scrape limit on length of labels name that will be
accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
labelValueLengthLimit:
description: Per-scrape limit on length of labels value that will
be accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@ -4877,6 +4899,12 @@ spec:
is still true, but the server serves requests under a different
route prefix. For example for use with `kubectl proxy`."
type: string
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@ -5935,6 +5963,12 @@ spec:
type: object
type: object
type: object
targetLimit:
description: TargetLimit defines a limit on the number of scraped
targets that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
tolerations:
description: Defines the Pods' tolerations if specified.
items:

View file

@ -1534,6 +1534,11 @@ spec:
baseImage:
description: '*Deprecated: use ''spec.image'' instead.*'
type: string
bodySizeLimit:
description: BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@ -4334,6 +4339,23 @@ spec:
- name
type: object
type: array
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
format: int64
type: integer
labelNameLengthLimit:
description: Per-scrape limit on length of labels name that will be
accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
labelValueLengthLimit:
description: Per-scrape limit on length of labels value that will
be accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@ -5790,6 +5812,12 @@ spec:
type: string
type: object
type: object
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@ -6856,6 +6884,12 @@ spec:
description: '*Deprecated: use ''spec.image'' instead. The image''s
tag can be specified as part of the image name.*'
type: string
targetLimit:
description: TargetLimit defines a limit on the number of scraped
targets that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
thanos:
description: "Defines the configuration of the optional Thanos sidecar.
\n This section is experimental, it may change significantly without

View file

@ -1196,6 +1196,11 @@ spec:
deny:
type: boolean
type: object
bodySizeLimit:
description: BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@ -3966,6 +3971,23 @@ spec:
- name
type: object
type: array
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
format: int64
type: integer
labelNameLengthLimit:
description: Per-scrape limit on length of labels name that will be
accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
labelValueLengthLimit:
description: Per-scrape limit on length of labels value that will
be accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@ -4877,6 +4899,12 @@ spec:
is still true, but the server serves requests under a different
route prefix. For example for use with `kubectl proxy`."
type: string
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@ -5935,6 +5963,12 @@ spec:
type: object
type: object
type: object
targetLimit:
description: TargetLimit defines a limit on the number of scraped
targets that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
tolerations:
description: Defines the Pods' tolerations if specified.
items:

View file

@ -1534,6 +1534,11 @@ spec:
baseImage:
description: '*Deprecated: use ''spec.image'' instead.*'
type: string
bodySizeLimit:
description: BodySizeLimit defines per-scrape on response body size.
Only valid in Prometheus versions 2.45.0 and newer.
pattern: (^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$
type: string
configMaps:
description: ConfigMaps is a list of ConfigMaps in the same namespace
as the Prometheus object, which shall be mounted into the Prometheus
@ -4334,6 +4339,23 @@ spec:
- name
type: object
type: array
labelLimit:
description: Per-scrape limit on number of labels that will be accepted
for a sample. Only valid in Prometheus versions 2.45.0 and newer.
format: int64
type: integer
labelNameLengthLimit:
description: Per-scrape limit on length of labels name that will be
accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
labelValueLengthLimit:
description: Per-scrape limit on length of labels value that will
be accepted for a sample. Only valid in Prometheus versions 2.45.0
and newer.
format: int64
type: integer
listenLocal:
description: When true, the Prometheus server listens on the loopback
address instead of the Pod IP's address.
@ -5790,6 +5812,12 @@ spec:
type: string
type: object
type: object
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
scrapeConfigNamespaceSelector:
description: Namespaces to match for ScrapeConfig discovery. An empty
label selector matches all namespaces. A null label selector matches
@ -6856,6 +6884,12 @@ spec:
description: '*Deprecated: use ''spec.image'' instead. The image''s
tag can be specified as part of the image name.*'
type: string
targetLimit:
description: TargetLimit defines a limit on the number of scraped
targets that will be accepted. Only valid in Prometheus versions
2.45.0 and newer.
format: int64
type: integer
thanos:
description: "Defines the configuration of the optional Thanos sidecar.
\n This section is experimental, it may change significantly without

View file

@ -1051,6 +1051,11 @@
},
"type": "object"
},
"bodySizeLimit": {
"description": "BodySizeLimit defines per-scrape on response body size. Only valid in Prometheus versions 2.45.0 and newer.",
"pattern": "(^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$",
"type": "string"
},
"configMaps": {
"description": "ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. Each ConfigMap is added to the StatefulSet definition as a volume named `configmap-<configmap-name>`. The ConfigMaps are mounted into /etc/prometheus/configmaps/<configmap-name> in the 'prometheus' container.",
"items": {
@ -3569,6 +3574,21 @@
},
"type": "array"
},
"labelLimit": {
"description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"labelNameLengthLimit": {
"description": "Per-scrape limit on length of labels name that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"labelValueLengthLimit": {
"description": "Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"listenLocal": {
"description": "When true, the Prometheus server listens on the loopback address instead of the Pod IP's address.",
"type": "boolean"
@ -4482,6 +4502,11 @@
"description": "The route prefix Prometheus registers HTTP handlers for. \n This is useful when using `spec.externalURL`, and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`.",
"type": "string"
},
"sampleLimit": {
"description": "SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"scrapeConfigNamespaceSelector": {
"description": "Namespaces to match for ScrapeConfig discovery. An empty label selector matches all namespaces. A null label selector matches the current current namespace only.",
"properties": {
@ -5335,6 +5360,11 @@
},
"type": "object"
},
"targetLimit": {
"description": "TargetLimit defines a limit on the number of scraped targets that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"tolerations": {
"description": "Defines the Pods' tolerations if specified.",
"items": {

View file

@ -1402,6 +1402,11 @@
"description": "*Deprecated: use 'spec.image' instead.*",
"type": "string"
},
"bodySizeLimit": {
"description": "BodySizeLimit defines per-scrape on response body size. Only valid in Prometheus versions 2.45.0 and newer.",
"pattern": "(^0|([0-9]*[.])?[0-9]+((K|M|G|T|E|P)i?)?B)$",
"type": "string"
},
"configMaps": {
"description": "ConfigMaps is a list of ConfigMaps in the same namespace as the Prometheus object, which shall be mounted into the Prometheus Pods. Each ConfigMap is added to the StatefulSet definition as a volume named `configmap-<configmap-name>`. The ConfigMaps are mounted into /etc/prometheus/configmaps/<configmap-name> in the 'prometheus' container.",
"items": {
@ -3945,6 +3950,21 @@
},
"type": "array"
},
"labelLimit": {
"description": "Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"labelNameLengthLimit": {
"description": "Per-scrape limit on length of labels name that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"labelValueLengthLimit": {
"description": "Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"listenLocal": {
"description": "When true, the Prometheus server listens on the loopback address instead of the Pod IP's address.",
"type": "boolean"
@ -5430,6 +5450,11 @@
},
"type": "object"
},
"sampleLimit": {
"description": "SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"scrapeConfigNamespaceSelector": {
"description": "Namespaces to match for ScrapeConfig discovery. An empty label selector matches all namespaces. A null label selector matches the current current namespace only.",
"properties": {
@ -6291,6 +6316,11 @@
"description": "*Deprecated: use 'spec.image' instead. The image's tag can be specified as part of the image name.*",
"type": "string"
},
"targetLimit": {
"description": "TargetLimit defines a limit on the number of scraped targets that will be accepted. Only valid in Prometheus versions 2.45.0 and newer.",
"format": "int64",
"type": "integer"
},
"thanos": {
"description": "Defines the configuration of the optional Thanos sidecar. \n This section is experimental, it may change significantly without deprecation notice in any release.",
"properties": {

View file

@ -550,6 +550,36 @@ type CommonPrometheusFields struct {
//
// +optional
TracingConfig *PrometheusTracingConfig `json:"tracingConfig,omitempty"`
// BodySizeLimit defines per-scrape on response body size.
// Only valid in Prometheus versions 2.45.0 and newer.
//
// +optional
BodySizeLimit *ByteSize `json:"bodySizeLimit,omitempty"`
// SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
// Only valid in Prometheus versions 2.45.0 and newer.
//
// +optional
SampleLimit *uint64 `json:"sampleLimit,omitempty"`
// TargetLimit defines a limit on the number of scraped targets that will be accepted.
// Only valid in Prometheus versions 2.45.0 and newer.
//
// +optional
TargetLimit *uint64 `json:"targetLimit,omitempty"`
// Per-scrape limit on number of labels that will be accepted for a sample.
// Only valid in Prometheus versions 2.45.0 and newer.
//
// +optional
LabelLimit *uint64 `json:"labelLimit,omitempty"`
// Per-scrape limit on length of labels name that will be accepted for a sample.
// Only valid in Prometheus versions 2.45.0 and newer.
//
// +optional
LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"`
// Per-scrape limit on length of labels value that will be accepted for a sample.
// Only valid in Prometheus versions 2.45.0 and newer.
//
// +optional
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
}
// +genclient

View file

@ -792,6 +792,36 @@ func (in *CommonPrometheusFields) DeepCopyInto(out *CommonPrometheusFields) {
*out = new(PrometheusTracingConfig)
(*in).DeepCopyInto(*out)
}
if in.BodySizeLimit != nil {
in, out := &in.BodySizeLimit, &out.BodySizeLimit
*out = new(ByteSize)
**out = **in
}
if in.SampleLimit != nil {
in, out := &in.SampleLimit, &out.SampleLimit
*out = new(uint64)
**out = **in
}
if in.TargetLimit != nil {
in, out := &in.TargetLimit, &out.TargetLimit
*out = new(uint64)
**out = **in
}
if in.LabelLimit != nil {
in, out := &in.LabelLimit, &out.LabelLimit
*out = new(uint64)
**out = **in
}
if in.LabelNameLengthLimit != nil {
in, out := &in.LabelNameLengthLimit, &out.LabelNameLengthLimit
*out = new(uint64)
**out = **in
}
if in.LabelValueLengthLimit != nil {
in, out := &in.LabelValueLengthLimit, &out.LabelValueLengthLimit
*out = new(uint64)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonPrometheusFields.

View file

@ -92,6 +92,12 @@ type CommonPrometheusFieldsApplyConfiguration struct {
HostNetwork *bool `json:"hostNetwork,omitempty"`
PodTargetLabels []string `json:"podTargetLabels,omitempty"`
TracingConfig *PrometheusTracingConfigApplyConfiguration `json:"tracingConfig,omitempty"`
BodySizeLimit *monitoringv1.ByteSize `json:"bodySizeLimit,omitempty"`
SampleLimit *uint64 `json:"sampleLimit,omitempty"`
TargetLimit *uint64 `json:"targetLimit,omitempty"`
LabelLimit *uint64 `json:"labelLimit,omitempty"`
LabelNameLengthLimit *uint64 `json:"labelNameLengthLimit,omitempty"`
LabelValueLengthLimit *uint64 `json:"labelValueLengthLimit,omitempty"`
}
// CommonPrometheusFieldsApplyConfiguration constructs an declarative configuration of the CommonPrometheusFields type for use with
@ -689,3 +695,51 @@ func (b *CommonPrometheusFieldsApplyConfiguration) WithTracingConfig(value *Prom
b.TracingConfig = value
return b
}
// WithBodySizeLimit sets the BodySizeLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BodySizeLimit field is set to the value of the last call.
func (b *CommonPrometheusFieldsApplyConfiguration) WithBodySizeLimit(value monitoringv1.ByteSize) *CommonPrometheusFieldsApplyConfiguration {
b.BodySizeLimit = &value
return b
}
// WithSampleLimit sets the SampleLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SampleLimit field is set to the value of the last call.
func (b *CommonPrometheusFieldsApplyConfiguration) WithSampleLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
b.SampleLimit = &value
return b
}
// WithTargetLimit sets the TargetLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the TargetLimit field is set to the value of the last call.
func (b *CommonPrometheusFieldsApplyConfiguration) WithTargetLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
b.TargetLimit = &value
return b
}
// WithLabelLimit sets the LabelLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelLimit field is set to the value of the last call.
func (b *CommonPrometheusFieldsApplyConfiguration) WithLabelLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
b.LabelLimit = &value
return b
}
// WithLabelNameLengthLimit sets the LabelNameLengthLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelNameLengthLimit field is set to the value of the last call.
func (b *CommonPrometheusFieldsApplyConfiguration) WithLabelNameLengthLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
b.LabelNameLengthLimit = &value
return b
}
// WithLabelValueLengthLimit sets the LabelValueLengthLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelValueLengthLimit field is set to the value of the last call.
func (b *CommonPrometheusFieldsApplyConfiguration) WithLabelValueLengthLimit(value uint64) *CommonPrometheusFieldsApplyConfiguration {
b.LabelValueLengthLimit = &value
return b
}

View file

@ -646,6 +646,54 @@ func (b *PrometheusSpecApplyConfiguration) WithTracingConfig(value *PrometheusTr
return b
}
// WithBodySizeLimit sets the BodySizeLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BodySizeLimit field is set to the value of the last call.
func (b *PrometheusSpecApplyConfiguration) WithBodySizeLimit(value monitoringv1.ByteSize) *PrometheusSpecApplyConfiguration {
b.BodySizeLimit = &value
return b
}
// WithSampleLimit sets the SampleLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SampleLimit field is set to the value of the last call.
func (b *PrometheusSpecApplyConfiguration) WithSampleLimit(value uint64) *PrometheusSpecApplyConfiguration {
b.SampleLimit = &value
return b
}
// WithTargetLimit sets the TargetLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the TargetLimit field is set to the value of the last call.
func (b *PrometheusSpecApplyConfiguration) WithTargetLimit(value uint64) *PrometheusSpecApplyConfiguration {
b.TargetLimit = &value
return b
}
// WithLabelLimit sets the LabelLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelLimit field is set to the value of the last call.
func (b *PrometheusSpecApplyConfiguration) WithLabelLimit(value uint64) *PrometheusSpecApplyConfiguration {
b.LabelLimit = &value
return b
}
// WithLabelNameLengthLimit sets the LabelNameLengthLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelNameLengthLimit field is set to the value of the last call.
func (b *PrometheusSpecApplyConfiguration) WithLabelNameLengthLimit(value uint64) *PrometheusSpecApplyConfiguration {
b.LabelNameLengthLimit = &value
return b
}
// WithLabelValueLengthLimit sets the LabelValueLengthLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelValueLengthLimit field is set to the value of the last call.
func (b *PrometheusSpecApplyConfiguration) WithLabelValueLengthLimit(value uint64) *PrometheusSpecApplyConfiguration {
b.LabelValueLengthLimit = &value
return b
}
// WithBaseImage sets the BaseImage field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BaseImage field is set to the value of the last call.

View file

@ -624,3 +624,51 @@ func (b *PrometheusAgentSpecApplyConfiguration) WithTracingConfig(value *v1.Prom
b.TracingConfig = value
return b
}
// WithBodySizeLimit sets the BodySizeLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the BodySizeLimit field is set to the value of the last call.
func (b *PrometheusAgentSpecApplyConfiguration) WithBodySizeLimit(value monitoringv1.ByteSize) *PrometheusAgentSpecApplyConfiguration {
b.BodySizeLimit = &value
return b
}
// WithSampleLimit sets the SampleLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the SampleLimit field is set to the value of the last call.
func (b *PrometheusAgentSpecApplyConfiguration) WithSampleLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
b.SampleLimit = &value
return b
}
// WithTargetLimit sets the TargetLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the TargetLimit field is set to the value of the last call.
func (b *PrometheusAgentSpecApplyConfiguration) WithTargetLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
b.TargetLimit = &value
return b
}
// WithLabelLimit sets the LabelLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelLimit field is set to the value of the last call.
func (b *PrometheusAgentSpecApplyConfiguration) WithLabelLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
b.LabelLimit = &value
return b
}
// WithLabelNameLengthLimit sets the LabelNameLengthLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelNameLengthLimit field is set to the value of the last call.
func (b *PrometheusAgentSpecApplyConfiguration) WithLabelNameLengthLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
b.LabelNameLengthLimit = &value
return b
}
// WithLabelValueLengthLimit sets the LabelValueLengthLimit field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LabelValueLengthLimit field is set to the value of the last call.
func (b *PrometheusAgentSpecApplyConfiguration) WithLabelValueLengthLimit(value uint64) *PrometheusAgentSpecApplyConfiguration {
b.LabelValueLengthLimit = &value
return b
}

View file

@ -75,5 +75,6 @@ var (
"v2.43.0",
"v2.43.1",
"v2.44.0",
"v2.45.0",
}
)

View file

@ -488,6 +488,7 @@ func (cg *ConfigGenerator) GenerateServerConfiguration(
globalItems = cg.appendScrapeIntervals(globalItems)
globalItems = cg.appendExternalLabels(globalItems)
globalItems = cg.appendQueryLogFile(globalItems, queryLogFile)
globalItems = cg.appendScrapeLimits(globalItems)
cfg = append(cfg, yaml.MapItem{Key: "global", Value: globalItems})
// Rule Files config
@ -1954,6 +1955,30 @@ func (cg *ConfigGenerator) appendEvaluationInterval(slice yaml.MapSlice, evaluat
return append(slice, yaml.MapItem{Key: "evaluation_interval", Value: evaluationInterval})
}
func (cg *ConfigGenerator) appendScrapeLimits(slice yaml.MapSlice) yaml.MapSlice {
cpf := cg.prom.GetCommonPrometheusFields()
if cpf.BodySizeLimit != nil {
slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "body_size_limit", cpf.BodySizeLimit)
}
if cpf.SampleLimit != nil {
slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "sample_limit", *cpf.SampleLimit)
}
if cpf.TargetLimit != nil {
slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "target_limit", *cpf.TargetLimit)
}
if cpf.LabelLimit != nil {
slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "label_limit", *cpf.LabelLimit)
}
if cpf.LabelNameLengthLimit != nil {
slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "label_name_length_limit", *cpf.LabelNameLengthLimit)
}
if cpf.LabelValueLengthLimit != nil {
slice = cg.WithMinimumVersion("2.45.0").AppendMapItem(slice, "label_value_length_limit", *cpf.LabelValueLengthLimit)
}
return slice
}
func (cg *ConfigGenerator) appendExternalLabels(slice yaml.MapSlice) yaml.MapSlice {
slice = append(slice, yaml.MapItem{
Key: "external_labels",
@ -2114,6 +2139,7 @@ func (cg *ConfigGenerator) GenerateAgentConfiguration(
globalItems := yaml.MapSlice{}
globalItems = cg.appendScrapeIntervals(globalItems)
globalItems = cg.appendExternalLabels(globalItems)
globalItems = cg.appendScrapeLimits(globalItems)
cfg = append(cfg, yaml.MapItem{Key: "global", Value: globalItems})
// Scrape config

View file

@ -99,16 +99,31 @@ func TestConfigGeneration(t *testing.T) {
}
func TestGlobalSettings(t *testing.T) {
var (
expectedBodySizeLimit monitoringv1.ByteSize = "1000MB"
expectedSampleLimit uint64 = 10000
expectedTargetLimit uint64 = 1000
expectedLabelLimit uint64 = 50
expectedLabelNameLengthLimit uint64 = 40
expectedLabelValueLengthLimit uint64 = 30
)
for _, tc := range []struct {
Scenario string
EvaluationInterval monitoringv1.Duration
ScrapeInterval monitoringv1.Duration
ScrapeTimeout monitoringv1.Duration
ExternalLabels map[string]string
QueryLogFile string
Version string
Expected string
ExpectError bool
Scenario string
EvaluationInterval monitoringv1.Duration
ScrapeInterval monitoringv1.Duration
ScrapeTimeout monitoringv1.Duration
ExternalLabels map[string]string
QueryLogFile string
Version string
BodySizeLimit *monitoringv1.ByteSize
SampleLimit *uint64
TargetLimit *uint64
LabelLimit *uint64
LabelNameLengthLimit *uint64
LabelValueLengthLimit *uint64
Expected string
ExpectError bool
}{
{
Scenario: "valid config",
@ -181,6 +196,52 @@ scrape_configs: []
prometheus_replica: $(POD_NAME)
query_log_file: /var/log/prometheus/test.log
scrape_configs: []
`,
},
{
Scenario: "valid global limits",
Version: "v2.45.0",
ScrapeInterval: "30s",
EvaluationInterval: "30s",
BodySizeLimit: &expectedBodySizeLimit,
SampleLimit: &expectedSampleLimit,
TargetLimit: &expectedTargetLimit,
Expected: `global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: /
prometheus_replica: $(POD_NAME)
body_size_limit: 1000MB
sample_limit: 10000
target_limit: 1000
scrape_configs: []
`,
},
{
Scenario: "valid global config with label limits",
Version: "v2.45.0",
ScrapeInterval: "30s",
EvaluationInterval: "30s",
BodySizeLimit: &expectedBodySizeLimit,
SampleLimit: &expectedSampleLimit,
TargetLimit: &expectedTargetLimit,
LabelLimit: &expectedLabelLimit,
LabelNameLengthLimit: &expectedLabelNameLengthLimit,
LabelValueLengthLimit: &expectedLabelValueLengthLimit,
Expected: `global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: /
prometheus_replica: $(POD_NAME)
body_size_limit: 1000MB
sample_limit: 10000
target_limit: 1000
label_limit: 50
label_name_length_limit: 40
label_value_length_limit: 30
scrape_configs: []
`,
},
} {
@ -189,11 +250,17 @@ scrape_configs: []
ObjectMeta: metav1.ObjectMeta{},
Spec: monitoringv1.PrometheusSpec{
CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
ScrapeInterval: tc.ScrapeInterval,
ScrapeTimeout: tc.ScrapeTimeout,
ExternalLabels: tc.ExternalLabels,
Version: tc.Version,
TracingConfig: nil,
ScrapeInterval: tc.ScrapeInterval,
ScrapeTimeout: tc.ScrapeTimeout,
ExternalLabels: tc.ExternalLabels,
Version: tc.Version,
TracingConfig: nil,
BodySizeLimit: tc.BodySizeLimit,
SampleLimit: tc.SampleLimit,
TargetLimit: tc.TargetLimit,
LabelLimit: tc.LabelLimit,
LabelNameLengthLimit: tc.LabelNameLengthLimit,
LabelValueLengthLimit: tc.LabelValueLengthLimit,
},
EvaluationInterval: tc.EvaluationInterval,
QueryLogFile: tc.QueryLogFile,