1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

feat(scrapeConfig): Add proxy settings support for the ScrapeConfig CRD ()

Signed-off-by: adinhodovic <hodovicadin@gmail.com>
This commit is contained in:
Adin Hodovic 2023-12-06 19:19:06 +01:00 committed by GitHub
parent 9fe4c212cb
commit 3014870986
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 1274 additions and 290 deletions

128
Documentation/api.md generated
View file

@ -17062,59 +17062,6 @@ OAuth2
</tr>
<tr>
<td>
<code>proxyUrl</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Optional proxy URL.</p>
</td>
</tr>
<tr>
<td>
<code>noProxy</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Comma-separated string that can contain IPs, CIDR notation, domain names
that should be excluded from proxying. IP and domain names can
contain port numbers.</p>
</td>
</tr>
<tr>
<td>
<code>proxyFromEnvironment</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
If unset, Prometheus uses its default value.</p>
</td>
</tr>
<tr>
<td>
<code>proxyConnectHeader</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#secretkeyselector-v1-core">
map[string]k8s.io/api/core/v1.SecretKeySelector
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Specifies headers to send to proxies during CONNECT requests.</p>
</td>
</tr>
<tr>
<td>
<code>followRedirects</code><br/>
<em>
bool
@ -20379,6 +20326,81 @@ If not specified, the configuration is reloaded using the /-/reload HTTP endpoin
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.ProxyConfig">ProxyConfig
</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
</p>
<div>
</div>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>proxyUrl</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p><code>proxyURL</code> defines the HTTP proxy server to use.</p>
<p>It requires Prometheus &gt;= v2.43.0.</p>
</td>
</tr>
<tr>
<td>
<code>noProxy</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p><code>noProxy</code> is a comma-separated string that can contain IPs, CIDR notation, domain names
that should be excluded from proxying. IP and domain names can
contain port numbers.</p>
<p>It requires Prometheus &gt;= v2.43.0.</p>
</td>
</tr>
<tr>
<td>
<code>proxyFromEnvironment</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to use the proxy configuration defined by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
If unset, Prometheus uses its default value.</p>
<p>It requires Prometheus &gt;= v2.43.0.</p>
</td>
</tr>
<tr>
<td>
<code>proxyConnectHeader</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#secretkeyselector-v1-core">
map[string]k8s.io/api/core/v1.SecretKeySelector
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>ProxyConnectHeader optionally specifies headers to send to
proxies during CONNECT requests.</p>
<p>It requires Prometheus &gt;= v2.43.0.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.PushoverConfig">PushoverConfig
</h3>
<p>

105
bundle.yaml generated
View file

@ -33453,9 +33453,10 @@ spec:
description: Namespaces are only supported in Consul Enterprise.
type: string
noProxy:
description: Comma-separated string that can contain IPs, CIDR
notation, domain names that should be excluded from proxying.
IP and domain names can contain port numbers.
description: "`noProxy` is a comma-separated string that can
contain IPs, CIDR notation, domain names that should be excluded
from proxying. IP and domain names can contain port numbers.
\n It requires Prometheus >= v2.43.0."
type: string
nodeMeta:
additionalProperties:
@ -33577,17 +33578,21 @@ spec:
- key
type: object
x-kubernetes-map-type: atomic
description: Specifies headers to send to proxies during CONNECT
requests.
description: "ProxyConnectHeader optionally specifies headers
to send to proxies during CONNECT requests. \n It requires
Prometheus >= v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: Use proxy URL indicated by environment variables
(HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
If unset, Prometheus uses its default value.
description: "Whether to use the proxy configuration defined
by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
If unset, Prometheus uses its default value. \n It requires
Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: Optional proxy URL.
description: "`proxyURL` defines the HTTP proxy server to use.
\n It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
refreshInterval:
description: The time after which the provided names are refreshed.
@ -34059,6 +34064,48 @@ spec:
type: object
x-kubernetes-map-type: atomic
type: object
noProxy:
description: "`noProxy` is a comma-separated string that can
contain IPs, CIDR notation, domain names that should be excluded
from proxying. IP and domain names can contain port numbers.
\n It requires Prometheus >= v2.43.0."
type: string
proxyConnectHeader:
additionalProperties:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
description: "ProxyConnectHeader optionally specifies headers
to send to proxies during CONNECT requests. \n It requires
Prometheus >= v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: "Whether to use the proxy configuration defined
by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
If unset, Prometheus uses its default value. \n It requires
Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: "`proxyURL` defines the HTTP proxy server to use.
\n It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
refreshInterval:
description: RefreshInterval configures the refresh interval
at which Prometheus will re-query the endpoint to update the
@ -34352,6 +34399,12 @@ spec:
description: MetricsPath HTTP path to scrape for metrics. If empty,
Prometheus uses the default value (e.g. /metrics).
type: string
noProxy:
description: "`noProxy` is a comma-separated string that can contain
IPs, CIDR notation, domain names that should be excluded from proxying.
IP and domain names can contain port numbers. \n It requires Prometheus
>= v2.43.0."
type: string
params:
additionalProperties:
items:
@ -34360,6 +34413,40 @@ spec:
description: Optional HTTP URL parameters
type: object
x-kubernetes-map-type: atomic
proxyConnectHeader:
additionalProperties:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must be
a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
description: "ProxyConnectHeader optionally specifies headers to send
to proxies during CONNECT requests. \n It requires Prometheus >=
v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: "Whether to use the proxy configuration defined by environment
variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY). If unset, Prometheus
uses its default value. \n It requires Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: "`proxyURL` defines the HTTP proxy server to use. \n
It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
relabelings:
description: 'RelabelConfigs defines how to rewrite the target''s
labels before scraping. Prometheus Operator automatically adds relabelings

View file

@ -282,9 +282,10 @@ spec:
description: Namespaces are only supported in Consul Enterprise.
type: string
noProxy:
description: Comma-separated string that can contain IPs, CIDR
notation, domain names that should be excluded from proxying.
IP and domain names can contain port numbers.
description: "`noProxy` is a comma-separated string that can
contain IPs, CIDR notation, domain names that should be excluded
from proxying. IP and domain names can contain port numbers.
\n It requires Prometheus >= v2.43.0."
type: string
nodeMeta:
additionalProperties:
@ -406,17 +407,21 @@ spec:
- key
type: object
x-kubernetes-map-type: atomic
description: Specifies headers to send to proxies during CONNECT
requests.
description: "ProxyConnectHeader optionally specifies headers
to send to proxies during CONNECT requests. \n It requires
Prometheus >= v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: Use proxy URL indicated by environment variables
(HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
If unset, Prometheus uses its default value.
description: "Whether to use the proxy configuration defined
by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
If unset, Prometheus uses its default value. \n It requires
Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: Optional proxy URL.
description: "`proxyURL` defines the HTTP proxy server to use.
\n It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
refreshInterval:
description: The time after which the provided names are refreshed.
@ -888,6 +893,48 @@ spec:
type: object
x-kubernetes-map-type: atomic
type: object
noProxy:
description: "`noProxy` is a comma-separated string that can
contain IPs, CIDR notation, domain names that should be excluded
from proxying. IP and domain names can contain port numbers.
\n It requires Prometheus >= v2.43.0."
type: string
proxyConnectHeader:
additionalProperties:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
description: "ProxyConnectHeader optionally specifies headers
to send to proxies during CONNECT requests. \n It requires
Prometheus >= v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: "Whether to use the proxy configuration defined
by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
If unset, Prometheus uses its default value. \n It requires
Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: "`proxyURL` defines the HTTP proxy server to use.
\n It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
refreshInterval:
description: RefreshInterval configures the refresh interval
at which Prometheus will re-query the endpoint to update the
@ -1181,6 +1228,12 @@ spec:
description: MetricsPath HTTP path to scrape for metrics. If empty,
Prometheus uses the default value (e.g. /metrics).
type: string
noProxy:
description: "`noProxy` is a comma-separated string that can contain
IPs, CIDR notation, domain names that should be excluded from proxying.
IP and domain names can contain port numbers. \n It requires Prometheus
>= v2.43.0."
type: string
params:
additionalProperties:
items:
@ -1189,6 +1242,40 @@ spec:
description: Optional HTTP URL parameters
type: object
x-kubernetes-map-type: atomic
proxyConnectHeader:
additionalProperties:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must be
a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
description: "ProxyConnectHeader optionally specifies headers to send
to proxies during CONNECT requests. \n It requires Prometheus >=
v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: "Whether to use the proxy configuration defined by environment
variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY). If unset, Prometheus
uses its default value. \n It requires Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: "`proxyURL` defines the HTTP proxy server to use. \n
It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
relabelings:
description: 'RelabelConfigs defines how to rewrite the target''s
labels before scraping. Prometheus Operator automatically adds relabelings

View file

@ -283,9 +283,10 @@ spec:
description: Namespaces are only supported in Consul Enterprise.
type: string
noProxy:
description: Comma-separated string that can contain IPs, CIDR
notation, domain names that should be excluded from proxying.
IP and domain names can contain port numbers.
description: "`noProxy` is a comma-separated string that can
contain IPs, CIDR notation, domain names that should be excluded
from proxying. IP and domain names can contain port numbers.
\n It requires Prometheus >= v2.43.0."
type: string
nodeMeta:
additionalProperties:
@ -407,17 +408,21 @@ spec:
- key
type: object
x-kubernetes-map-type: atomic
description: Specifies headers to send to proxies during CONNECT
requests.
description: "ProxyConnectHeader optionally specifies headers
to send to proxies during CONNECT requests. \n It requires
Prometheus >= v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: Use proxy URL indicated by environment variables
(HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
If unset, Prometheus uses its default value.
description: "Whether to use the proxy configuration defined
by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
If unset, Prometheus uses its default value. \n It requires
Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: Optional proxy URL.
description: "`proxyURL` defines the HTTP proxy server to use.
\n It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
refreshInterval:
description: The time after which the provided names are refreshed.
@ -889,6 +894,48 @@ spec:
type: object
x-kubernetes-map-type: atomic
type: object
noProxy:
description: "`noProxy` is a comma-separated string that can
contain IPs, CIDR notation, domain names that should be excluded
from proxying. IP and domain names can contain port numbers.
\n It requires Prometheus >= v2.43.0."
type: string
proxyConnectHeader:
additionalProperties:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must
be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
description: "ProxyConnectHeader optionally specifies headers
to send to proxies during CONNECT requests. \n It requires
Prometheus >= v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: "Whether to use the proxy configuration defined
by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
If unset, Prometheus uses its default value. \n It requires
Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: "`proxyURL` defines the HTTP proxy server to use.
\n It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
refreshInterval:
description: RefreshInterval configures the refresh interval
at which Prometheus will re-query the endpoint to update the
@ -1182,6 +1229,12 @@ spec:
description: MetricsPath HTTP path to scrape for metrics. If empty,
Prometheus uses the default value (e.g. /metrics).
type: string
noProxy:
description: "`noProxy` is a comma-separated string that can contain
IPs, CIDR notation, domain names that should be excluded from proxying.
IP and domain names can contain port numbers. \n It requires Prometheus
>= v2.43.0."
type: string
params:
additionalProperties:
items:
@ -1190,6 +1243,40 @@ spec:
description: Optional HTTP URL parameters
type: object
x-kubernetes-map-type: atomic
proxyConnectHeader:
additionalProperties:
description: SecretKeySelector selects a key of a Secret.
properties:
key:
description: The key of the secret to select from. Must be
a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
description: "ProxyConnectHeader optionally specifies headers to send
to proxies during CONNECT requests. \n It requires Prometheus >=
v2.43.0."
type: object
x-kubernetes-map-type: atomic
proxyFromEnvironment:
description: "Whether to use the proxy configuration defined by environment
variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY). If unset, Prometheus
uses its default value. \n It requires Prometheus >= v2.43.0."
type: boolean
proxyUrl:
description: "`proxyURL` defines the HTTP proxy server to use. \n
It requires Prometheus >= v2.43.0."
pattern: ^http(s)?://.+$
type: string
relabelings:
description: 'RelabelConfigs defines how to rewrite the target''s
labels before scraping. Prometheus Operator automatically adds relabelings

View file

@ -307,7 +307,7 @@
"type": "string"
},
"noProxy": {
"description": "Comma-separated string that can contain IPs, CIDR notation, domain names that should be excluded from proxying. IP and domain names can contain port numbers.",
"description": "`noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names that should be excluded from proxying. IP and domain names can contain port numbers. \n It requires Prometheus >= v2.43.0.",
"type": "string"
},
"nodeMeta": {
@ -447,16 +447,17 @@
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"description": "Specifies headers to send to proxies during CONNECT requests.",
"description": "ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. \n It requires Prometheus >= v2.43.0.",
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"proxyFromEnvironment": {
"description": "Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy) If unset, Prometheus uses its default value.",
"description": "Whether to use the proxy configuration defined by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY). If unset, Prometheus uses its default value. \n It requires Prometheus >= v2.43.0.",
"type": "boolean"
},
"proxyUrl": {
"description": "Optional proxy URL.",
"description": "`proxyURL` defines the HTTP proxy server to use. \n It requires Prometheus >= v2.43.0.",
"pattern": "^http(s)?://.+$",
"type": "string"
},
"refreshInterval": {
@ -961,6 +962,46 @@
},
"type": "object"
},
"noProxy": {
"description": "`noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names that should be excluded from proxying. IP and domain names can contain port numbers. \n It requires Prometheus >= v2.43.0.",
"type": "string"
},
"proxyConnectHeader": {
"additionalProperties": {
"description": "SecretKeySelector selects a key of a Secret.",
"properties": {
"key": {
"description": "The key of the secret to select from. Must be a valid secret key.",
"type": "string"
},
"name": {
"description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?",
"type": "string"
},
"optional": {
"description": "Specify whether the Secret or its key must be defined",
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"description": "ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. \n It requires Prometheus >= v2.43.0.",
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"proxyFromEnvironment": {
"description": "Whether to use the proxy configuration defined by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY). If unset, Prometheus uses its default value. \n It requires Prometheus >= v2.43.0.",
"type": "boolean"
},
"proxyUrl": {
"description": "`proxyURL` defines the HTTP proxy server to use. \n It requires Prometheus >= v2.43.0.",
"pattern": "^http(s)?://.+$",
"type": "string"
},
"refreshInterval": {
"description": "RefreshInterval configures the refresh interval at which Prometheus will re-query the endpoint to update the target list.",
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
@ -1281,6 +1322,10 @@
"description": "MetricsPath HTTP path to scrape for metrics. If empty, Prometheus uses the default value (e.g. /metrics).",
"type": "string"
},
"noProxy": {
"description": "`noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names that should be excluded from proxying. IP and domain names can contain port numbers. \n It requires Prometheus >= v2.43.0.",
"type": "string"
},
"params": {
"additionalProperties": {
"items": {
@ -1292,6 +1337,42 @@
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"proxyConnectHeader": {
"additionalProperties": {
"description": "SecretKeySelector selects a key of a Secret.",
"properties": {
"key": {
"description": "The key of the secret to select from. Must be a valid secret key.",
"type": "string"
},
"name": {
"description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?",
"type": "string"
},
"optional": {
"description": "Specify whether the Secret or its key must be defined",
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"description": "ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. \n It requires Prometheus >= v2.43.0.",
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"proxyFromEnvironment": {
"description": "Whether to use the proxy configuration defined by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY). If unset, Prometheus uses its default value. \n It requires Prometheus >= v2.43.0.",
"type": "boolean"
},
"proxyUrl": {
"description": "`proxyURL` defines the HTTP proxy server to use. \n It requires Prometheus >= v2.43.0.",
"pattern": "^http(s)?://.+$",
"type": "string"
},
"relabelings": {
"description": "RelabelConfigs defines how to rewrite the target's labels before scraping. Prometheus Operator automatically adds relabelings for a few standard Kubernetes fields. The original scrape job's name is available via the `__tmp_prometheus_job_name` label. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config",
"items": {

View file

@ -1,8 +1,11 @@
module github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring
go 1.17
go 1.21
toolchain go1.21.1
require (
github.com/prometheus-operator/prometheus-operator v0.69.1
k8s.io/api v0.28.4
k8s.io/apiextensions-apiserver v0.28.4
k8s.io/apimachinery v0.28.4
@ -10,18 +13,40 @@ require (
)
require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/client-go v0.28.4 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20230905202853-d090da108d2f // indirect
k8s.io/utils v0.0.0-20231127182322-b307cd553661 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

View file

@ -1,80 +1,174 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus-operator/prometheus-operator v0.69.1 h1:pqNMssMBBaM6mYg7FKK7kQi9sIyWYCA33z5FSmmbybw=
github.com/prometheus-operator/prometheus-operator v0.69.1/go.mod h1:1GSjL8dKOO9be+b7aSowZo7cuTdsdTqLT3ZETktVqvU=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4=
golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY=
k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0=
k8s.io/apiextensions-apiserver v0.28.4 h1:AZpKY/7wQ8n+ZYDtNHbAJBb+N4AXXJvyZx6ww6yAJvU=
k8s.io/apiextensions-apiserver v0.28.4/go.mod h1:pgQIZ1U8eJSMQcENew/0ShUTlePcSGFq6dxSxf2mwPM=
k8s.io/apimachinery v0.28.4 h1:zOSJe1mc+GxuMnFzD4Z/U1wst50X28ZNsn5bhgIIao8=
k8s.io/apimachinery v0.28.4/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg=
k8s.io/client-go v0.28.4 h1:Np5ocjlZcTrkyRJ3+T3PkXDpe4UpatQxj85+xjaD2wY=
k8s.io/client-go v0.28.4/go.mod h1:0VDZFpgoZfelyP5Wqu0/r/TRYcLYuJ2U1KEeoaPa1N4=
k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=
k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo=
k8s.io/kube-openapi v0.0.0-20230905202853-d090da108d2f h1:eeEUOoGYWhOz7EyXqhlR2zHKNw2mNJ9vzJmub6YN6kk=
k8s.io/kube-openapi v0.0.0-20230905202853-d090da108d2f/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6RxQGZDnzuLcrUTI=
k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigwG62c4=
@ -83,4 +177,5 @@ sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMm
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

View file

@ -15,10 +15,16 @@
package v1alpha1
import (
"context"
"fmt"
v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"github.com/prometheus-operator/prometheus-operator/pkg/assets"
)
const (
@ -191,6 +197,9 @@ type ScrapeConfigSpec struct {
// MetricRelabelConfigs to apply to samples before ingestion.
// +optional
MetricRelabelConfigs []*v1.RelabelConfig `json:"metricRelabelings,omitempty"`
// ProxyConfig allows customizing the proxy behaviour for this scrape config.
// +optional
*ProxyConfig `json:",inline"`
}
// StaticConfig defines a Prometheus static configuration.
@ -243,6 +252,9 @@ type HTTPSDConfig struct {
// TLS configuration applying to the target HTTP endpoint.
// +optional
TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"`
// ProxyConfig allows customizing the proxy behaviour for this scrape config.
// +optional
*ProxyConfig `json:",inline"`
}
// KubernetesSDConfig allows retrieving scrape targets from Kubernetes' REST API.
@ -318,22 +330,9 @@ type ConsulSDConfig struct {
// Optional OAuth 2.0 configuration.
// +optional
Oauth2 *v1.OAuth2 `json:"oauth2,omitempty"`
// Optional proxy URL.
// ProxyConfig allows customizing the proxy behaviour for this scrape config.
// +optional
ProxyUrl *string `json:"proxyUrl,omitempty"`
// Comma-separated string that can contain IPs, CIDR notation, domain names
// that should be excluded from proxying. IP and domain names can
// contain port numbers.
// +optional
NoProxy *string `json:"noProxy,omitempty"`
// Use proxy URL indicated by environment variables (HTTP_PROXY, https_proxy, HTTPs_PROXY, https_proxy, and no_proxy)
// If unset, Prometheus uses its default value.
// +optional
ProxyFromEnvironment *bool `json:"proxyFromEnvironment,omitempty"`
// Specifies headers to send to proxies during CONNECT requests.
// +mapType:=atomic
// +optional
ProxyConnectHeader map[string]corev1.SecretKeySelector `json:"proxyConnectHeader,omitempty"`
*ProxyConfig `json:",inline"`
// Configure whether HTTP requests follow HTTP 3xx redirects.
// If unset, Prometheus uses its default value.
// +optional
@ -479,3 +478,57 @@ type GCESDConfig struct {
// +optional
TagSeparator *string `json:"tagSeparator,omitempty"`
}
type ProxyConfig struct {
// `proxyURL` defines the HTTP proxy server to use.
//
// It requires Prometheus >= v2.43.0.
// +kubebuilder:validation:Pattern:="^http(s)?://.+$"
// +optional
ProxyURL *string `json:"proxyUrl,omitempty"`
// `noProxy` is a comma-separated string that can contain IPs, CIDR notation, domain names
// that should be excluded from proxying. IP and domain names can
// contain port numbers.
//
// It requires Prometheus >= v2.43.0.
// +optional
NoProxy *string `json:"noProxy,omitempty"`
// Whether to use the proxy configuration defined by environment variables (HTTP_PROXY, HTTPS_PROXY, and NO_PROXY).
// If unset, Prometheus uses its default value.
//
// It requires Prometheus >= v2.43.0.
// +optional
ProxyFromEnvironment *bool `json:"proxyFromEnvironment,omitempty"`
// ProxyConnectHeader optionally specifies headers to send to
// proxies during CONNECT requests.
//
// It requires Prometheus >= v2.43.0.
// +optional
// +mapType:=atomic
ProxyConnectHeader map[string]corev1.SecretKeySelector `json:"proxyConnectHeader,omitempty"`
}
func (pc *ProxyConfig) Validate(ctx context.Context, store *assets.Store, namespace string) error {
proxyFromEnvironmentDefined := pc.ProxyFromEnvironment != nil && *pc.ProxyFromEnvironment
proxyURLDefined := pc.ProxyURL != nil && *pc.ProxyURL != ""
noProxyDefined := pc.NoProxy != nil && *pc.NoProxy != ""
if len(pc.ProxyConnectHeader) > 0 && (!proxyFromEnvironmentDefined && !proxyURLDefined) {
return fmt.Errorf("if proxyConnectHeader is configured, proxyUrl or proxyFromEnvironment must also be configured")
}
if proxyFromEnvironmentDefined && proxyURLDefined {
return fmt.Errorf("if proxyFromEnvironment is configured, proxyUrl must not be configured")
}
if proxyFromEnvironmentDefined && noProxyDefined {
return fmt.Errorf("if proxyFromEnvironment is configured, noProxy must not be configured")
}
if !proxyURLDefined && noProxyDefined {
return fmt.Errorf("if noProxy is configured, proxyUrl must also be configured")
}
for k, v := range pc.ProxyConnectHeader {
if _, err := store.GetSecretKey(ctx, namespace, v); err != nil {
return fmt.Errorf("header[%s]: %w", k, err)
}
}
return nil
}

View file

@ -241,27 +241,10 @@ func (in *ConsulSDConfig) DeepCopyInto(out *ConsulSDConfig) {
*out = new(monitoringv1.OAuth2)
(*in).DeepCopyInto(*out)
}
if in.ProxyUrl != nil {
in, out := &in.ProxyUrl, &out.ProxyUrl
*out = new(string)
**out = **in
}
if in.NoProxy != nil {
in, out := &in.NoProxy, &out.NoProxy
*out = new(string)
**out = **in
}
if in.ProxyFromEnvironment != nil {
in, out := &in.ProxyFromEnvironment, &out.ProxyFromEnvironment
*out = new(bool)
**out = **in
}
if in.ProxyConnectHeader != nil {
in, out := &in.ProxyConnectHeader, &out.ProxyConnectHeader
*out = make(map[string]corev1.SecretKeySelector, len(*in))
for key, val := range *in {
(*out)[key] = *val.DeepCopy()
}
if in.ProxyConfig != nil {
in, out := &in.ProxyConfig, &out.ProxyConfig
*out = new(ProxyConfig)
(*in).DeepCopyInto(*out)
}
if in.FollowRedirects != nil {
in, out := &in.FollowRedirects, &out.FollowRedirects
@ -635,6 +618,11 @@ func (in *HTTPSDConfig) DeepCopyInto(out *HTTPSDConfig) {
*out = new(monitoringv1.SafeTLSConfig)
(*in).DeepCopyInto(*out)
}
if in.ProxyConfig != nil {
in, out := &in.ProxyConfig, &out.ProxyConfig
*out = new(ProxyConfig)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPSDConfig.
@ -1003,6 +991,43 @@ func (in *PrometheusAgentSpec) DeepCopy() *PrometheusAgentSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProxyConfig) DeepCopyInto(out *ProxyConfig) {
*out = *in
if in.ProxyURL != nil {
in, out := &in.ProxyURL, &out.ProxyURL
*out = new(string)
**out = **in
}
if in.NoProxy != nil {
in, out := &in.NoProxy, &out.NoProxy
*out = new(string)
**out = **in
}
if in.ProxyFromEnvironment != nil {
in, out := &in.ProxyFromEnvironment, &out.ProxyFromEnvironment
*out = new(bool)
**out = **in
}
if in.ProxyConnectHeader != nil {
in, out := &in.ProxyConnectHeader, &out.ProxyConnectHeader
*out = make(map[string]corev1.SecretKeySelector, len(*in))
for key, val := range *in {
(*out)[key] = *val.DeepCopy()
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyConfig.
func (in *ProxyConfig) DeepCopy() *ProxyConfig {
if in == nil {
return nil
}
out := new(ProxyConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PushoverConfig) DeepCopyInto(out *PushoverConfig) {
*out = *in
@ -1468,6 +1493,11 @@ func (in *ScrapeConfigSpec) DeepCopyInto(out *ScrapeConfigSpec) {
}
}
}
if in.ProxyConfig != nil {
in, out := &in.ProxyConfig, &out.ProxyConfig
*out = new(ProxyConfig)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScrapeConfigSpec.

View file

@ -25,28 +25,25 @@ import (
// ConsulSDConfigApplyConfiguration represents an declarative configuration of the ConsulSDConfig type for use
// with apply.
type ConsulSDConfigApplyConfiguration struct {
Server *string `json:"server,omitempty"`
TokenRef *v1.SecretKeySelector `json:"tokenRef,omitempty"`
Datacenter *string `json:"datacenter,omitempty"`
Namespace *string `json:"namespace,omitempty"`
Partition *string `json:"partition,omitempty"`
Scheme *string `json:"scheme,omitempty"`
Services []string `json:"services,omitempty"`
Tags []string `json:"tags,omitempty"`
TagSeparator *string `json:"tagSeparator,omitempty"`
NodeMeta map[string]string `json:"nodeMeta,omitempty"`
AllowStale *bool `json:"allowStale,omitempty"`
RefreshInterval *monitoringv1.Duration `json:"refreshInterval,omitempty"`
BasicAuth *applyconfigurationmonitoringv1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"`
Authorization *applyconfigurationmonitoringv1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"`
Oauth2 *applyconfigurationmonitoringv1.OAuth2ApplyConfiguration `json:"oauth2,omitempty"`
ProxyUrl *string `json:"proxyUrl,omitempty"`
NoProxy *string `json:"noProxy,omitempty"`
ProxyFromEnvironment *bool `json:"proxyFromEnvironment,omitempty"`
ProxyConnectHeader map[string]v1.SecretKeySelector `json:"proxyConnectHeader,omitempty"`
FollowRedirects *bool `json:"followRedirects,omitempty"`
EnableHttp2 *bool `json:"enableHTTP2,omitempty"`
TLSConfig *applyconfigurationmonitoringv1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"`
Server *string `json:"server,omitempty"`
TokenRef *v1.SecretKeySelector `json:"tokenRef,omitempty"`
Datacenter *string `json:"datacenter,omitempty"`
Namespace *string `json:"namespace,omitempty"`
Partition *string `json:"partition,omitempty"`
Scheme *string `json:"scheme,omitempty"`
Services []string `json:"services,omitempty"`
Tags []string `json:"tags,omitempty"`
TagSeparator *string `json:"tagSeparator,omitempty"`
NodeMeta map[string]string `json:"nodeMeta,omitempty"`
AllowStale *bool `json:"allowStale,omitempty"`
RefreshInterval *monitoringv1.Duration `json:"refreshInterval,omitempty"`
BasicAuth *applyconfigurationmonitoringv1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"`
Authorization *applyconfigurationmonitoringv1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"`
Oauth2 *applyconfigurationmonitoringv1.OAuth2ApplyConfiguration `json:"oauth2,omitempty"`
ProxyConfigApplyConfiguration `json:",inline"`
FollowRedirects *bool `json:"followRedirects,omitempty"`
EnableHttp2 *bool `json:"enableHTTP2,omitempty"`
TLSConfig *applyconfigurationmonitoringv1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"`
}
// ConsulSDConfigApplyConfiguration constructs an declarative configuration of the ConsulSDConfig type for use with
@ -185,44 +182,6 @@ func (b *ConsulSDConfigApplyConfiguration) WithOauth2(value *applyconfigurationm
return b
}
// WithProxyUrl sets the ProxyUrl 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 ProxyUrl field is set to the value of the last call.
func (b *ConsulSDConfigApplyConfiguration) WithProxyUrl(value string) *ConsulSDConfigApplyConfiguration {
b.ProxyUrl = &value
return b
}
// WithNoProxy sets the NoProxy 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 NoProxy field is set to the value of the last call.
func (b *ConsulSDConfigApplyConfiguration) WithNoProxy(value string) *ConsulSDConfigApplyConfiguration {
b.NoProxy = &value
return b
}
// WithProxyFromEnvironment sets the ProxyFromEnvironment 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 ProxyFromEnvironment field is set to the value of the last call.
func (b *ConsulSDConfigApplyConfiguration) WithProxyFromEnvironment(value bool) *ConsulSDConfigApplyConfiguration {
b.ProxyFromEnvironment = &value
return b
}
// WithProxyConnectHeader puts the entries into the ProxyConnectHeader field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the ProxyConnectHeader field,
// overwriting an existing map entries in ProxyConnectHeader field with the same key.
func (b *ConsulSDConfigApplyConfiguration) WithProxyConnectHeader(entries map[string]v1.SecretKeySelector) *ConsulSDConfigApplyConfiguration {
if b.ProxyConnectHeader == nil && len(entries) > 0 {
b.ProxyConnectHeader = make(map[string]v1.SecretKeySelector, len(entries))
}
for k, v := range entries {
b.ProxyConnectHeader[k] = v
}
return b
}
// WithFollowRedirects sets the FollowRedirects 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 FollowRedirects field is set to the value of the last call.

View file

@ -24,11 +24,12 @@ import (
// HTTPSDConfigApplyConfiguration represents an declarative configuration of the HTTPSDConfig type for use
// with apply.
type HTTPSDConfigApplyConfiguration struct {
URL *string `json:"url,omitempty"`
RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"`
BasicAuth *monitoringv1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"`
Authorization *monitoringv1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"`
TLSConfig *monitoringv1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"`
URL *string `json:"url,omitempty"`
RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"`
BasicAuth *monitoringv1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"`
Authorization *monitoringv1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"`
TLSConfig *monitoringv1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"`
ProxyConfigApplyConfiguration `json:",inline"`
}
// HTTPSDConfigApplyConfiguration constructs an declarative configuration of the HTTPSDConfig type for use with

View file

@ -0,0 +1,74 @@
// Copyright The prometheus-operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha1
import (
v1 "k8s.io/api/core/v1"
)
// ProxyConfigApplyConfiguration represents an declarative configuration of the ProxyConfig type for use
// with apply.
type ProxyConfigApplyConfiguration struct {
ProxyURL *string `json:"proxyUrl,omitempty"`
NoProxy *string `json:"noProxy,omitempty"`
ProxyFromEnvironment *bool `json:"proxyFromEnvironment,omitempty"`
ProxyConnectHeader map[string]v1.SecretKeySelector `json:"proxyConnectHeader,omitempty"`
}
// ProxyConfigApplyConfiguration constructs an declarative configuration of the ProxyConfig type for use with
// apply.
func ProxyConfig() *ProxyConfigApplyConfiguration {
return &ProxyConfigApplyConfiguration{}
}
// WithProxyURL sets the ProxyURL 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 ProxyURL field is set to the value of the last call.
func (b *ProxyConfigApplyConfiguration) WithProxyURL(value string) *ProxyConfigApplyConfiguration {
b.ProxyURL = &value
return b
}
// WithNoProxy sets the NoProxy 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 NoProxy field is set to the value of the last call.
func (b *ProxyConfigApplyConfiguration) WithNoProxy(value string) *ProxyConfigApplyConfiguration {
b.NoProxy = &value
return b
}
// WithProxyFromEnvironment sets the ProxyFromEnvironment 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 ProxyFromEnvironment field is set to the value of the last call.
func (b *ProxyConfigApplyConfiguration) WithProxyFromEnvironment(value bool) *ProxyConfigApplyConfiguration {
b.ProxyFromEnvironment = &value
return b
}
// WithProxyConnectHeader puts the entries into the ProxyConnectHeader field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the ProxyConnectHeader field,
// overwriting an existing map entries in ProxyConnectHeader field with the same key.
func (b *ProxyConfigApplyConfiguration) WithProxyConnectHeader(entries map[string]v1.SecretKeySelector) *ProxyConfigApplyConfiguration {
if b.ProxyConnectHeader == nil && len(entries) > 0 {
b.ProxyConnectHeader = make(map[string]v1.SecretKeySelector, len(entries))
}
for k, v := range entries {
b.ProxyConnectHeader[k] = v
}
return b
}

View file

@ -24,34 +24,35 @@ import (
// ScrapeConfigSpecApplyConfiguration represents an declarative configuration of the ScrapeConfigSpec type for use
// with apply.
type ScrapeConfigSpecApplyConfiguration struct {
StaticConfigs []StaticConfigApplyConfiguration `json:"staticConfigs,omitempty"`
FileSDConfigs []FileSDConfigApplyConfiguration `json:"fileSDConfigs,omitempty"`
HTTPSDConfigs []HTTPSDConfigApplyConfiguration `json:"httpSDConfigs,omitempty"`
KubernetesSDConfigs []KubernetesSDConfigApplyConfiguration `json:"kubernetesSDConfigs,omitempty"`
ConsulSDConfigs []ConsulSDConfigApplyConfiguration `json:"consulSDConfigs,omitempty"`
DNSSDConfigs []DNSSDConfigApplyConfiguration `json:"dnsSDConfigs,omitempty"`
EC2SDConfigs []EC2SDConfigApplyConfiguration `json:"ec2SDConfigs,omitempty"`
AzureSDConfigs []AzureSDConfigApplyConfiguration `json:"azureSDConfigs,omitempty"`
GCESDConfigs []GCESDConfigApplyConfiguration `json:"gceSDConfigs,omitempty"`
RelabelConfigs []*v1.RelabelConfig `json:"relabelings,omitempty"`
MetricsPath *string `json:"metricsPath,omitempty"`
ScrapeInterval *v1.Duration `json:"scrapeInterval,omitempty"`
ScrapeTimeout *v1.Duration `json:"scrapeTimeout,omitempty"`
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
TrackTimestampsStaleness *bool `json:"trackTimestampsStaleness,omitempty"`
HonorLabels *bool `json:"honorLabels,omitempty"`
Params map[string][]string `json:"params,omitempty"`
Scheme *string `json:"scheme,omitempty"`
BasicAuth *monitoringv1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"`
Authorization *monitoringv1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"`
TLSConfig *monitoringv1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,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"`
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
MetricRelabelConfigs []*v1.RelabelConfig `json:"metricRelabelings,omitempty"`
StaticConfigs []StaticConfigApplyConfiguration `json:"staticConfigs,omitempty"`
FileSDConfigs []FileSDConfigApplyConfiguration `json:"fileSDConfigs,omitempty"`
HTTPSDConfigs []HTTPSDConfigApplyConfiguration `json:"httpSDConfigs,omitempty"`
KubernetesSDConfigs []KubernetesSDConfigApplyConfiguration `json:"kubernetesSDConfigs,omitempty"`
ConsulSDConfigs []ConsulSDConfigApplyConfiguration `json:"consulSDConfigs,omitempty"`
DNSSDConfigs []DNSSDConfigApplyConfiguration `json:"dnsSDConfigs,omitempty"`
EC2SDConfigs []EC2SDConfigApplyConfiguration `json:"ec2SDConfigs,omitempty"`
AzureSDConfigs []AzureSDConfigApplyConfiguration `json:"azureSDConfigs,omitempty"`
GCESDConfigs []GCESDConfigApplyConfiguration `json:"gceSDConfigs,omitempty"`
RelabelConfigs []*v1.RelabelConfig `json:"relabelings,omitempty"`
MetricsPath *string `json:"metricsPath,omitempty"`
ScrapeInterval *v1.Duration `json:"scrapeInterval,omitempty"`
ScrapeTimeout *v1.Duration `json:"scrapeTimeout,omitempty"`
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
TrackTimestampsStaleness *bool `json:"trackTimestampsStaleness,omitempty"`
HonorLabels *bool `json:"honorLabels,omitempty"`
Params map[string][]string `json:"params,omitempty"`
Scheme *string `json:"scheme,omitempty"`
BasicAuth *monitoringv1.BasicAuthApplyConfiguration `json:"basicAuth,omitempty"`
Authorization *monitoringv1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"`
TLSConfig *monitoringv1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,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"`
KeepDroppedTargets *uint64 `json:"keepDroppedTargets,omitempty"`
MetricRelabelConfigs []*v1.RelabelConfig `json:"metricRelabelings,omitempty"`
ProxyConfigApplyConfiguration `json:",inline"`
}
// ScrapeConfigSpecApplyConfiguration constructs an declarative configuration of the ScrapeConfigSpec type for use with

View file

@ -245,6 +245,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &monitoringv1alpha1.PrometheusAgentApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("PrometheusAgentSpec"):
return &monitoringv1alpha1.PrometheusAgentSpecApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("ProxyConfig"):
return &monitoringv1alpha1.ProxyConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("PushoverConfig"):
return &monitoringv1alpha1.PushoverConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("Receiver"):

View file

@ -1,6 +1,8 @@
module github.com/prometheus-operator/prometheus-operator/pkg/client
go 1.19
go 1.21
toolchain go1.21.1
require (
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.70.0
@ -12,7 +14,7 @@ require (
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/go-logr/logr v1.3.0 // indirect
@ -32,6 +34,7 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus-operator/prometheus-operator v0.69.1 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sys v0.15.0 // indirect

View file

@ -1,7 +1,8 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI=
@ -17,6 +18,7 @@ github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
@ -33,6 +35,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@ -43,6 +46,7 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@ -57,13 +61,20 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus-operator/prometheus-operator v0.69.1 h1:pqNMssMBBaM6mYg7FKK7kQi9sIyWYCA33z5FSmmbybw=
github.com/prometheus-operator/prometheus-operator v0.69.1/go.mod h1:1GSjL8dKOO9be+b7aSowZo7cuTdsdTqLT3ZETktVqvU=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@ -72,6 +83,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
@ -123,6 +135,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View file

@ -2327,6 +2327,39 @@ func (cg *ConfigGenerator) generateScrapeConfig(
cfg = append(cfg, yaml.MapItem{Key: "scheme", Value: strings.ToLower(*sc.Spec.Scheme)})
}
if sc.Spec.ProxyConfig != nil {
if sc.Spec.ProxyConfig.ProxyURL != nil {
cfg = cg.WithMinimumVersion("2.43.0").AppendMapItem(cfg, "proxy_url", *sc.Spec.ProxyConfig.ProxyURL)
}
if sc.Spec.ProxyConfig.NoProxy != nil {
cfg = cg.WithMinimumVersion("2.43.0").AppendMapItem(cfg, "no_proxy", *sc.Spec.ProxyConfig.NoProxy)
}
if sc.Spec.ProxyConfig.ProxyFromEnvironment != nil {
cfg = cg.WithMinimumVersion("2.43.0").AppendMapItem(cfg, "proxy_from_environment", *sc.Spec.ProxyConfig.ProxyFromEnvironment)
}
if sc.Spec.ProxyConfig.ProxyConnectHeader != nil {
proxyConnectHeader := make(map[string]string, len(sc.Spec.ProxyConfig.ProxyConnectHeader))
for k, v := range sc.Spec.ProxyConfig.ProxyConnectHeader {
value, err := store.GetKey(ctx, sc.GetNamespace(), monitoringv1.SecretOrConfigMap{
Secret: &v,
})
if err != nil {
return cfg, fmt.Errorf("failed to read %s secret %s: %w", v.Name, jobName, err)
}
proxyConnectHeader[k] = value
}
cfg = cg.WithMinimumVersion("2.43.0").AppendMapItem(cfg, "proxy_connect_header", stringMapToMapSlice(proxyConnectHeader))
}
}
cfg = cg.addBasicAuthToYaml(cfg, fmt.Sprintf("scrapeconfig/%s/%s", sc.Namespace, sc.Name), store, sc.Spec.BasicAuth)
cfg = cg.addSafeAuthorizationToYaml(cfg, fmt.Sprintf("scrapeconfig/auth/%s/%s", sc.Namespace, sc.Name), store, sc.Spec.Authorization)
@ -2416,6 +2449,38 @@ func (cg *ConfigGenerator) generateScrapeConfig(
if config.TLSConfig != nil {
configs[i] = addSafeTLStoYaml(configs[i], sc.Namespace, *config.TLSConfig)
}
if config.ProxyConfig != nil {
if config.ProxyConfig.ProxyURL != nil {
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "proxy_url", *config.ProxyConfig.ProxyURL)
}
if config.ProxyConfig.NoProxy != nil {
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "no_proxy", *config.ProxyConfig.NoProxy)
}
if config.ProxyConfig.ProxyFromEnvironment != nil {
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "proxy_from_environment", *config.ProxyConfig.ProxyFromEnvironment)
}
if config.ProxyConfig.ProxyConnectHeader != nil {
proxyConnectHeader := make(map[string]string, len(config.ProxyConfig.ProxyConnectHeader))
for k, v := range config.ProxyConfig.ProxyConnectHeader {
value, err := store.GetKey(ctx, sc.GetNamespace(), monitoringv1.SecretOrConfigMap{
Secret: &v,
})
if err != nil {
return configs[i], fmt.Errorf("failed to read %s secret %s: %w", v.Name, jobName, err)
}
proxyConnectHeader[k] = value
}
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "proxy_connect_header", stringMapToMapSlice(proxyConnectHeader))
}
}
}
cfg = append(cfg, yaml.MapItem{
Key: "http_sd_configs",
@ -2569,46 +2634,36 @@ func (cg *ConfigGenerator) generateScrapeConfig(
})
}
if config.ProxyUrl != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "proxy_url",
Value: config.ProxyUrl,
})
}
if config.NoProxy != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "no_proxy",
Value: config.NoProxy,
})
}
if config.ProxyFromEnvironment != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "proxy_from_environment",
Value: config.ProxyFromEnvironment,
})
}
if config.ProxyConnectHeader != nil {
proxyConnectHeader := make(map[string]string, len(config.ProxyConnectHeader))
for k, v := range config.ProxyConnectHeader {
value, err := store.GetKey(ctx, sc.GetNamespace(), monitoringv1.SecretOrConfigMap{
Secret: &v,
})
if err != nil {
return cfg, fmt.Errorf("failed to read %s secret %s: %w", v.Name, jobName, err)
}
proxyConnectHeader[k] = value
if config.ProxyConfig != nil {
if config.ProxyConfig.ProxyURL != nil {
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "proxy_url", *config.ProxyConfig.ProxyURL)
}
configs[i] = append(configs[i], yaml.MapItem{
Key: "proxy_connect_header",
Value: stringMapToMapSlice(proxyConnectHeader),
})
if config.ProxyConfig.NoProxy != nil {
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "no_proxy", *config.ProxyConfig.NoProxy)
}
if config.ProxyConfig.ProxyFromEnvironment != nil {
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "proxy_from_environment", *config.ProxyConfig.ProxyFromEnvironment)
}
if config.ProxyConfig.ProxyConnectHeader != nil {
proxyConnectHeader := make(map[string]string, len(config.ProxyConfig.ProxyConnectHeader))
for k, v := range config.ProxyConfig.ProxyConnectHeader {
value, err := store.GetKey(ctx, sc.GetNamespace(), monitoringv1.SecretOrConfigMap{
Secret: &v,
})
if err != nil {
return configs[i], fmt.Errorf("failed to read %s secret %s: %w", v.Name, jobName, err)
}
proxyConnectHeader[k] = value
}
configs[i] = cg.WithMinimumVersion("2.43.0").AppendMapItem(configs[i], "proxy_connect_header", stringMapToMapSlice(proxyConnectHeader))
}
}
if config.FollowRedirects != nil {

View file

@ -4992,6 +4992,19 @@ func TestScrapeConfigSpecConfig(t *testing.T) {
{
URL: "http://localhost:9100/sd.json",
RefreshInterval: &refreshInterval,
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "foo",
},
Key: "proxy-header",
},
},
},
},
},
},
@ -5235,6 +5248,47 @@ func TestScrapeConfigSpecConfig(t *testing.T) {
},
golden: "ScrapeConfigSpecConfig_NonEmptyMetricRelabelConfig.golden",
},
{
name: "proxy_settings",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "foo",
},
Key: "proxy-header",
},
},
},
},
golden: "ScrapeConfigSpecConfig_ProxySettings.golden",
},
{
name: "proxy_settings_incompatible_prometheus_version",
patchProm: func(p *monitoringv1.Prometheus) {
p.Spec.CommonPrometheusFields.Version = "v2.42.0"
},
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "foo",
},
Key: "proxy-header",
},
},
},
},
golden: "ScrapeConfigSpecConfig_ProxySettingsIncompatiblePrometheusVersion.golden",
},
{
name: "dns_sd_config-srv-record",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
@ -5277,6 +5331,35 @@ func TestScrapeConfigSpecConfig(t *testing.T) {
}
cg := mustNewConfigGenerator(t, p)
c := fake.NewSimpleClientset(
&v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "default",
},
Data: map[string][]byte{
"proxy-header": []byte("value"),
"token": []byte("value"),
},
},
)
store := assets.NewStore(c.CoreV1(), c.CoreV1())
store.BasicAuthAssets = map[string]assets.BasicAuthCredentials{
"scrapeconfig/default/testscrapeconfig1": {
Username: "scrape-bob",
Password: "scrape-alice",
},
"scrapeconfig/default/testscrapeconfig1/httpsdconfig/0": {
Username: "http-sd-bob",
Password: "http-sd-alice",
},
}
store.TokenAssets = map[string]assets.Token{
"scrapeconfig/auth/default/testscrapeconfig1": assets.Token("scrape-secret"),
"scrapeconfig/auth/default/testscrapeconfig1/httpsdconfig/0": assets.Token("http-sd-secret"),
}
cfg, err := cg.GenerateServerConfiguration(
context.Background(),
p.Spec.EvaluationInterval,
@ -5290,22 +5373,7 @@ func TestScrapeConfigSpecConfig(t *testing.T) {
nil,
nil,
scs,
&assets.Store{
BasicAuthAssets: map[string]assets.BasicAuthCredentials{
"scrapeconfig/default/testscrapeconfig1": {
Username: "scrape-bob",
Password: "scrape-alice",
},
"scrapeconfig/default/testscrapeconfig1/httpsdconfig/0": {
Username: "http-sd-bob",
Password: "http-sd-alice",
},
},
TokenAssets: map[string]assets.Token{
"scrapeconfig/auth/default/testscrapeconfig1": assets.Token("scrape-secret"),
"scrapeconfig/auth/default/testscrapeconfig1/httpsdconfig/0": assets.Token("http-sd-secret"),
},
},
store,
nil,
nil,
nil,
@ -5353,17 +5421,19 @@ func TestScrapeConfigSpecConfigWithConsulSD(t *testing.T) {
"service": "service_name",
"name": "node_name",
},
AllowStale: ptr.To(false),
RefreshInterval: (*monitoringv1.Duration)(ptr.To("30s")),
ProxyUrl: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(true),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "foo",
AllowStale: ptr.To(false),
RefreshInterval: (*monitoringv1.Duration)(ptr.To("30s")),
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(true),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "foo",
},
Key: "proxy-header",
},
Key: "proxy-header",
},
},
FollowRedirects: ptr.To(true),

View file

@ -702,6 +702,12 @@ func (rs *ResourceSelector) SelectScrapeConfigs(ctx context.Context, listFn List
rejectFn(sc, err)
continue
}
if sc.Spec.ProxyConfig != nil {
if err = sc.Spec.ProxyConfig.Validate(ctx, rs.store, sc.GetNamespace()); err != nil {
rejectFn(sc, err)
continue
}
}
if err = validateRelabelConfigs(rs.p, sc.Spec.MetricRelabelConfigs); err != nil {
rejectFn(sc, fmt.Errorf("metricRelabelConfigs: %w", err))
@ -792,9 +798,9 @@ func (rs *ResourceSelector) validateConsulSDConfigs(ctx context.Context, sc *mon
}
}
for k, v := range config.ProxyConnectHeader {
if _, err := rs.store.GetSecretKey(context.Background(), sc.GetNamespace(), v); err != nil {
return fmt.Errorf("[%d]: header[%s]: %w", i, k, err)
if config.ProxyConfig != nil {
if err := config.ProxyConfig.Validate(ctx, rs.store, sc.GetNamespace()); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
}
}
@ -816,6 +822,12 @@ func (rs *ResourceSelector) validateHTTPSDConfigs(ctx context.Context, sc *monit
if err := rs.store.AddSafeTLSConfig(ctx, sc.GetNamespace(), config.TLSConfig); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
if config.ProxyConfig != nil {
if err := config.ProxyConfig.Validate(ctx, rs.store, sc.GetNamespace()); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
}
}
return nil

View file

@ -1153,6 +1153,105 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
selected: false,
},
{
scenario: "valid proxy config",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.ProxyConfig = &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
},
}
},
selected: true,
},
{
scenario: "invalid proxy config with proxyConnectHeaders but no proxyUrl defined or proxyFromEnvironment set to true",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.ProxyConfig = &monitoringv1alpha1.ProxyConfig{
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
},
}
},
selected: false,
},
{
scenario: "invalid proxy config with proxy from environment set to true but proxyUrl defined",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.ProxyConfig = &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
ProxyFromEnvironment: ptr.To(true),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
},
}
},
selected: false,
},
{
scenario: "invalid proxy config with proxyFromEnvironment set to true but noProxy defined",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.ProxyConfig = &monitoringv1alpha1.ProxyConfig{
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(true),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
},
}
},
selected: false,
},
{
scenario: "invalid proxy config with invalid secret key",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.ProxyConfig = &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "invalid-key",
},
},
}
},
selected: false,
},
{
scenario: "invalid proxy config with noProxy defined and but no proxyUrl defined",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.ProxyConfig = &monitoringv1alpha1.ProxyConfig{
NoProxy: ptr.To("0.0.0.0"),
}
},
selected: false,
},
{
scenario: "HTTP SD config with valid secret ref",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
@ -1191,6 +1290,76 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
selected: false,
},
{
scenario: "HTTP SD config with valid proxy settings",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.HTTPSDConfigs = []monitoringv1alpha1.HTTPSDConfig{
{
URL: "http://example.com",
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
},
},
},
}
},
selected: true,
},
{
scenario: "HTTP SD config with invalid proxy settings",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.HTTPSDConfigs = []monitoringv1alpha1.HTTPSDConfig{
{
URL: "http://example.com",
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
ProxyFromEnvironment: ptr.To(true),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
},
},
},
}
},
selected: false,
},
{
scenario: "HTTP SD proxy config with invalid secret key",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.HTTPSDConfigs = []monitoringv1alpha1.HTTPSDConfig{
{
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "invalid-key",
},
},
},
},
}
},
selected: false,
},
{
scenario: "Kubernetes SD config with invalid label",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
@ -1282,6 +1451,38 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
selected: true,
},
{
scenario: "Consul SD proxy config with invalid secret key",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.ConsulSDConfigs = []monitoringv1alpha1.ConsulSDConfig{
{
Server: "example.com",
TokenRef: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
},
{
ProxyConfig: &monitoringv1alpha1.ProxyConfig{
ProxyURL: ptr.To("http://no-proxy.com"),
NoProxy: ptr.To("0.0.0.0"),
ProxyFromEnvironment: ptr.To(false),
ProxyConnectHeader: map[string]v1.SecretKeySelector{
"header": {
LocalObjectReference: v1.LocalObjectReference{
Name: "foo",
},
Key: "invalid-key",
},
},
},
},
}
},
selected: false,
},
{
scenario: "DNS SD config with port for type other than SRV record",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {

View file

@ -9,3 +9,8 @@ scrape_configs:
http_sd_configs:
- url: http://localhost:9100/sd.json
refresh_interval: 5m
proxy_url: http://no-proxy.com
no_proxy: 0.0.0.0
proxy_from_environment: false
proxy_connect_header:
header: value

View file

@ -0,0 +1,13 @@
global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: default/test
prometheus_replica: $(POD_NAME)
scrape_configs:
- job_name: scrapeConfig/default/testscrapeconfig1
proxy_url: http://no-proxy.com
no_proxy: 0.0.0.0
proxy_from_environment: false
proxy_connect_header:
header: value

View file

@ -0,0 +1,8 @@
global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: default/test
prometheus_replica: $(POD_NAME)
scrape_configs:
- job_name: scrapeConfig/default/testscrapeconfig1