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

feat: add support for DigitalOcean SD ()

Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
This commit is contained in:
Jayapriya Pai 2024-01-20 01:30:55 +05:30 committed by GitHub
parent 35532ddf64
commit 57e4f8f576
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1987 additions and 5 deletions

152
Documentation/api.md generated
View file

@ -7346,7 +7346,7 @@ be ignored. A null or empty list means only match against labelSelector.</p>
<h3 id="monitoring.coreos.com/v1.Duration">Duration
(<code>string</code> alias)</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.AlertmanagerEndpoints">AlertmanagerEndpoints</a>, <a href="#monitoring.coreos.com/v1.AlertmanagerGlobalConfig">AlertmanagerGlobalConfig</a>, <a href="#monitoring.coreos.com/v1.CommonPrometheusFields">CommonPrometheusFields</a>, <a href="#monitoring.coreos.com/v1.Endpoint">Endpoint</a>, <a href="#monitoring.coreos.com/v1.MetadataConfig">MetadataConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpoint">PodMetricsEndpoint</a>, <a href="#monitoring.coreos.com/v1.ProbeSpec">ProbeSpec</a>, <a href="#monitoring.coreos.com/v1.PrometheusSpec">PrometheusSpec</a>, <a href="#monitoring.coreos.com/v1.PrometheusTracingConfig">PrometheusTracingConfig</a>, <a href="#monitoring.coreos.com/v1.QuerySpec">QuerySpec</a>, <a href="#monitoring.coreos.com/v1.RemoteReadSpec">RemoteReadSpec</a>, <a href="#monitoring.coreos.com/v1.RemoteWriteSpec">RemoteWriteSpec</a>, <a href="#monitoring.coreos.com/v1.Rule">Rule</a>, <a href="#monitoring.coreos.com/v1.RuleGroup">RuleGroup</a>, <a href="#monitoring.coreos.com/v1.TSDBSpec">TSDBSpec</a>, <a href="#monitoring.coreos.com/v1.ThanosRulerSpec">ThanosRulerSpec</a>, <a href="#monitoring.coreos.com/v1.ThanosSpec">ThanosSpec</a>, <a href="#monitoring.coreos.com/v1alpha1.AzureSDConfig">AzureSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.DNSSDConfig">DNSSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.EC2SDConfig">EC2SDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.FileSDConfig">FileSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.GCESDConfig">GCESDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.OpenStackSDConfig">OpenStackSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.AlertmanagerEndpoints">AlertmanagerEndpoints</a>, <a href="#monitoring.coreos.com/v1.AlertmanagerGlobalConfig">AlertmanagerGlobalConfig</a>, <a href="#monitoring.coreos.com/v1.CommonPrometheusFields">CommonPrometheusFields</a>, <a href="#monitoring.coreos.com/v1.Endpoint">Endpoint</a>, <a href="#monitoring.coreos.com/v1.MetadataConfig">MetadataConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpoint">PodMetricsEndpoint</a>, <a href="#monitoring.coreos.com/v1.ProbeSpec">ProbeSpec</a>, <a href="#monitoring.coreos.com/v1.PrometheusSpec">PrometheusSpec</a>, <a href="#monitoring.coreos.com/v1.PrometheusTracingConfig">PrometheusTracingConfig</a>, <a href="#monitoring.coreos.com/v1.QuerySpec">QuerySpec</a>, <a href="#monitoring.coreos.com/v1.RemoteReadSpec">RemoteReadSpec</a>, <a href="#monitoring.coreos.com/v1.RemoteWriteSpec">RemoteWriteSpec</a>, <a href="#monitoring.coreos.com/v1.Rule">Rule</a>, <a href="#monitoring.coreos.com/v1.RuleGroup">RuleGroup</a>, <a href="#monitoring.coreos.com/v1.TSDBSpec">TSDBSpec</a>, <a href="#monitoring.coreos.com/v1.ThanosRulerSpec">ThanosRulerSpec</a>, <a href="#monitoring.coreos.com/v1.ThanosSpec">ThanosSpec</a>, <a href="#monitoring.coreos.com/v1alpha1.AzureSDConfig">AzureSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.DNSSDConfig">DNSSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">DigitalOceanSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.EC2SDConfig">EC2SDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.FileSDConfig">FileSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.GCESDConfig">GCESDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.OpenStackSDConfig">OpenStackSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
</p>
<div>
<p>Duration is a valid time duration that can be parsed by Prometheus model.ParseDuration() function.
@ -8483,7 +8483,7 @@ Examples: <code>30s</code>, <code>1m</code>, <code>1h20m15s</code>, <code>15d</c
<h3 id="monitoring.coreos.com/v1.OAuth2">OAuth2
</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.Endpoint">Endpoint</a>, <a href="#monitoring.coreos.com/v1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpoint">PodMetricsEndpoint</a>, <a href="#monitoring.coreos.com/v1.ProbeSpec">ProbeSpec</a>, <a href="#monitoring.coreos.com/v1.RemoteReadSpec">RemoteReadSpec</a>, <a href="#monitoring.coreos.com/v1.RemoteWriteSpec">RemoteWriteSpec</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1beta1.HTTPConfig">HTTPConfig</a>)
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.Endpoint">Endpoint</a>, <a href="#monitoring.coreos.com/v1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpoint">PodMetricsEndpoint</a>, <a href="#monitoring.coreos.com/v1.ProbeSpec">ProbeSpec</a>, <a href="#monitoring.coreos.com/v1.RemoteReadSpec">RemoteReadSpec</a>, <a href="#monitoring.coreos.com/v1.RemoteWriteSpec">RemoteWriteSpec</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">DigitalOceanSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1beta1.HTTPConfig">HTTPConfig</a>)
</p>
<div>
<p>OAuth2 configures OAuth2 settings.</p>
@ -12889,7 +12889,7 @@ Alertmanager.</p>
<h3 id="monitoring.coreos.com/v1.SafeAuthorization">SafeAuthorization
</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.AlertmanagerEndpoints">AlertmanagerEndpoints</a>, <a href="#monitoring.coreos.com/v1.Authorization">Authorization</a>, <a href="#monitoring.coreos.com/v1.Endpoint">Endpoint</a>, <a href="#monitoring.coreos.com/v1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpoint">PodMetricsEndpoint</a>, <a href="#monitoring.coreos.com/v1.ProbeSpec">ProbeSpec</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>, <a href="#monitoring.coreos.com/v1beta1.HTTPConfig">HTTPConfig</a>)
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.AlertmanagerEndpoints">AlertmanagerEndpoints</a>, <a href="#monitoring.coreos.com/v1.Authorization">Authorization</a>, <a href="#monitoring.coreos.com/v1.Endpoint">Endpoint</a>, <a href="#monitoring.coreos.com/v1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpoint">PodMetricsEndpoint</a>, <a href="#monitoring.coreos.com/v1.ProbeSpec">ProbeSpec</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">DigitalOceanSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>, <a href="#monitoring.coreos.com/v1beta1.HTTPConfig">HTTPConfig</a>)
</p>
<div>
<p>SafeAuthorization specifies a subset of the Authorization struct, that is
@ -12935,7 +12935,7 @@ Kubernetes core/v1.SecretKeySelector
<h3 id="monitoring.coreos.com/v1.SafeTLSConfig">SafeTLSConfig
</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpointTLSConfig">PodMetricsEndpointTLSConfig</a>, <a href="#monitoring.coreos.com/v1.ProbeTLSConfig">ProbeTLSConfig</a>, <a href="#monitoring.coreos.com/v1.TLSConfig">TLSConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.EmailConfig">EmailConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.OpenStackSDConfig">OpenStackSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>, <a href="#monitoring.coreos.com/v1beta1.EmailConfig">EmailConfig</a>, <a href="#monitoring.coreos.com/v1beta1.HTTPConfig">HTTPConfig</a>)
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1.PodMetricsEndpointTLSConfig">PodMetricsEndpointTLSConfig</a>, <a href="#monitoring.coreos.com/v1.ProbeTLSConfig">ProbeTLSConfig</a>, <a href="#monitoring.coreos.com/v1.TLSConfig">TLSConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">DigitalOceanSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.EmailConfig">EmailConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPConfig">HTTPConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.OpenStackSDConfig">OpenStackSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>, <a href="#monitoring.coreos.com/v1beta1.EmailConfig">EmailConfig</a>, <a href="#monitoring.coreos.com/v1beta1.HTTPConfig">HTTPConfig</a>)
</p>
<div>
<p>SafeTLSConfig specifies safe TLS configuration parameters.</p>
@ -16952,6 +16952,20 @@ ScrapeConfigSpec
</tr>
<tr>
<td>
<code>digitalOceanSDConfigs</code><br/>
<em>
<a href="#monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">
[]DigitalOceanSDConfig
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>DigitalOceanSDConfigs defines a list of DigitalOcean service discovery configurations.</p>
</td>
</tr>
<tr>
<td>
<code>relabelings</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.RelabelConfig">
@ -17831,6 +17845,120 @@ int
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">DigitalOceanSDConfig
</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
</p>
<div>
<p>DigitalOceanSDConfig allow retrieving scrape targets from DigitalOcean&rsquo;s Droplets API.
This service discovery uses the public IPv4 address by default, by that can be changed with relabeling
See <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config">https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config</a></p>
</div>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>authorization</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.SafeAuthorization">
SafeAuthorization
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Authorization header configuration to authenticate against the DigitalOcean API.
Cannot be set at the same time as <code>oauth2</code>.</p>
</td>
</tr>
<tr>
<td>
<code>oauth2</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.OAuth2">
OAuth2
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Optional OAuth 2.0 configuration.
Cannot be set at the same time as <code>authorization</code>.</p>
</td>
</tr>
<tr>
<td>
<code>followRedirects</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Configure whether HTTP requests follow HTTP 3xx redirects.</p>
</td>
</tr>
<tr>
<td>
<code>enableHTTP2</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to enable HTTP2.</p>
</td>
</tr>
<tr>
<td>
<code>tlsConfig</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.SafeTLSConfig">
SafeTLSConfig
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>TLS configuration applying to the target HTTP endpoint.</p>
</td>
</tr>
<tr>
<td>
<code>port</code><br/>
<em>
int
</em>
</td>
<td>
<em>(Optional)</em>
<p>The port to scrape metrics from.</p>
</td>
</tr>
<tr>
<td>
<code>refreshInterval</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.Duration">
Duration
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Refresh interval to re-read the instance list.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.DiscordConfig">DiscordConfig
</h3>
<p>
@ -21388,7 +21516,7 @@ If set, the value should be greater than 60 (seconds). Otherwise it will be equa
<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.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1alpha1.ConsulSDConfig">ConsulSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">DigitalOceanSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.HTTPSDConfig">HTTPSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.KubernetesSDConfig">KubernetesSDConfig</a>, <a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
</p>
<div>
</div>
@ -22372,6 +22500,20 @@ HTTPConfig
</tr>
<tr>
<td>
<code>digitalOceanSDConfigs</code><br/>
<em>
<a href="#monitoring.coreos.com/v1alpha1.DigitalOceanSDConfig">
[]DigitalOceanSDConfig
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>DigitalOceanSDConfigs defines a list of DigitalOcean service discovery configurations.</p>
</td>
</tr>
<tr>
<td>
<code>relabelings</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.RelabelConfig">

308
bundle.yaml generated
View file

@ -33838,6 +33838,314 @@ spec:
- server
type: object
type: array
digitalOceanSDConfigs:
description: DigitalOceanSDConfigs defines a list of DigitalOcean
service discovery configurations.
items:
description: DigitalOceanSDConfig allow retrieving scrape targets
from DigitalOcean's Droplets API. This service discovery uses
the public IPv4 address by default, by that can be changed with
relabeling See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config
properties:
authorization:
description: Authorization header configuration to authenticate
against the DigitalOcean API. Cannot be set at the same time
as `oauth2`.
properties:
credentials:
description: Selects a key of a Secret in the namespace
that contains the credentials for authentication.
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
type:
description: "Defines the authentication type. The value
is case-insensitive. \n \"Basic\" is not a supported value.
\n Default: \"Bearer\""
type: string
type: object
enableHTTP2:
description: Whether to enable HTTP2.
type: boolean
followRedirects:
description: Configure whether HTTP requests follow HTTP 3xx
redirects.
type: boolean
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
oauth2:
description: Optional OAuth 2.0 configuration. Cannot be set
at the same time as `authorization`.
properties:
clientId:
description: '`clientId` specifies a key of a Secret or
ConfigMap containing the OAuth2 client''s ID.'
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
clientSecret:
description: '`clientSecret` specifies a key of a Secret
containing the OAuth2 client''s 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
endpointParams:
additionalProperties:
type: string
description: '`endpointParams` configures the HTTP parameters
to append to the token URL.'
type: object
scopes:
description: '`scopes` defines the OAuth2 scopes used for
the token request.'
items:
type: string
type: array
tokenUrl:
description: '`tokenURL` configures the URL to fetch the
token from.'
minLength: 1
type: string
required:
- clientId
- clientSecret
- tokenUrl
type: object
port:
description: The port to scrape metrics from.
type: integer
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: Refresh interval to re-read the instance list.
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
tlsConfig:
description: TLS configuration applying to the target HTTP endpoint.
properties:
ca:
description: Certificate authority used when verifying server
certificates.
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
cert:
description: Client certificate to present when doing client-authentication.
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
insecureSkipVerify:
description: Disable target certificate validation.
type: boolean
keySecret:
description: Secret containing the client key file for the
targets.
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
serverName:
description: Used to verify the hostname for the targets.
type: string
type: object
type: object
type: array
dnsSDConfigs:
description: DNSSDConfigs defines a list of DNS service discovery
configurations.

View file

@ -602,6 +602,314 @@ spec:
- server
type: object
type: array
digitalOceanSDConfigs:
description: DigitalOceanSDConfigs defines a list of DigitalOcean
service discovery configurations.
items:
description: DigitalOceanSDConfig allow retrieving scrape targets
from DigitalOcean's Droplets API. This service discovery uses
the public IPv4 address by default, by that can be changed with
relabeling See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config
properties:
authorization:
description: Authorization header configuration to authenticate
against the DigitalOcean API. Cannot be set at the same time
as `oauth2`.
properties:
credentials:
description: Selects a key of a Secret in the namespace
that contains the credentials for authentication.
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
type:
description: "Defines the authentication type. The value
is case-insensitive. \n \"Basic\" is not a supported value.
\n Default: \"Bearer\""
type: string
type: object
enableHTTP2:
description: Whether to enable HTTP2.
type: boolean
followRedirects:
description: Configure whether HTTP requests follow HTTP 3xx
redirects.
type: boolean
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
oauth2:
description: Optional OAuth 2.0 configuration. Cannot be set
at the same time as `authorization`.
properties:
clientId:
description: '`clientId` specifies a key of a Secret or
ConfigMap containing the OAuth2 client''s ID.'
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
clientSecret:
description: '`clientSecret` specifies a key of a Secret
containing the OAuth2 client''s 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
endpointParams:
additionalProperties:
type: string
description: '`endpointParams` configures the HTTP parameters
to append to the token URL.'
type: object
scopes:
description: '`scopes` defines the OAuth2 scopes used for
the token request.'
items:
type: string
type: array
tokenUrl:
description: '`tokenURL` configures the URL to fetch the
token from.'
minLength: 1
type: string
required:
- clientId
- clientSecret
- tokenUrl
type: object
port:
description: The port to scrape metrics from.
type: integer
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: Refresh interval to re-read the instance list.
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
tlsConfig:
description: TLS configuration applying to the target HTTP endpoint.
properties:
ca:
description: Certificate authority used when verifying server
certificates.
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
cert:
description: Client certificate to present when doing client-authentication.
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
insecureSkipVerify:
description: Disable target certificate validation.
type: boolean
keySecret:
description: Secret containing the client key file for the
targets.
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
serverName:
description: Used to verify the hostname for the targets.
type: string
type: object
type: object
type: array
dnsSDConfigs:
description: DNSSDConfigs defines a list of DNS service discovery
configurations.

View file

@ -603,6 +603,314 @@ spec:
- server
type: object
type: array
digitalOceanSDConfigs:
description: DigitalOceanSDConfigs defines a list of DigitalOcean
service discovery configurations.
items:
description: DigitalOceanSDConfig allow retrieving scrape targets
from DigitalOcean's Droplets API. This service discovery uses
the public IPv4 address by default, by that can be changed with
relabeling See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config
properties:
authorization:
description: Authorization header configuration to authenticate
against the DigitalOcean API. Cannot be set at the same time
as `oauth2`.
properties:
credentials:
description: Selects a key of a Secret in the namespace
that contains the credentials for authentication.
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
type:
description: "Defines the authentication type. The value
is case-insensitive. \n \"Basic\" is not a supported value.
\n Default: \"Bearer\""
type: string
type: object
enableHTTP2:
description: Whether to enable HTTP2.
type: boolean
followRedirects:
description: Configure whether HTTP requests follow HTTP 3xx
redirects.
type: boolean
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
oauth2:
description: Optional OAuth 2.0 configuration. Cannot be set
at the same time as `authorization`.
properties:
clientId:
description: '`clientId` specifies a key of a Secret or
ConfigMap containing the OAuth2 client''s ID.'
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
clientSecret:
description: '`clientSecret` specifies a key of a Secret
containing the OAuth2 client''s 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
endpointParams:
additionalProperties:
type: string
description: '`endpointParams` configures the HTTP parameters
to append to the token URL.'
type: object
scopes:
description: '`scopes` defines the OAuth2 scopes used for
the token request.'
items:
type: string
type: array
tokenUrl:
description: '`tokenURL` configures the URL to fetch the
token from.'
minLength: 1
type: string
required:
- clientId
- clientSecret
- tokenUrl
type: object
port:
description: The port to scrape metrics from.
type: integer
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: Refresh interval to re-read the instance list.
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
tlsConfig:
description: TLS configuration applying to the target HTTP endpoint.
properties:
ca:
description: Certificate authority used when verifying server
certificates.
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
cert:
description: Client certificate to present when doing client-authentication.
properties:
configMap:
description: ConfigMap containing data to use for the
targets.
properties:
key:
description: The key to select.
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 ConfigMap or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
secret:
description: Secret containing data to use for the targets.
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
type: object
insecureSkipVerify:
description: Disable target certificate validation.
type: boolean
keySecret:
description: Secret containing the client key file for the
targets.
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
serverName:
description: Used to verify the hostname for the targets.
type: string
type: object
type: object
type: array
dnsSDConfigs:
description: DNSSDConfigs defines a list of DNS service discovery
configurations.

View file

@ -664,6 +664,343 @@
},
"type": "array"
},
"digitalOceanSDConfigs": {
"description": "DigitalOceanSDConfigs defines a list of DigitalOcean service discovery configurations.",
"items": {
"description": "DigitalOceanSDConfig allow retrieving scrape targets from DigitalOcean's Droplets API. This service discovery uses the public IPv4 address by default, by that can be changed with relabeling See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config",
"properties": {
"authorization": {
"description": "Authorization header configuration to authenticate against the DigitalOcean API. Cannot be set at the same time as `oauth2`.",
"properties": {
"credentials": {
"description": "Selects a key of a Secret in the namespace that contains the credentials for authentication.",
"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"
},
"type": {
"description": "Defines the authentication type. The value is case-insensitive. \n \"Basic\" is not a supported value. \n Default: \"Bearer\"",
"type": "string"
}
},
"type": "object"
},
"enableHTTP2": {
"description": "Whether to enable HTTP2.",
"type": "boolean"
},
"followRedirects": {
"description": "Configure whether HTTP requests follow HTTP 3xx redirects.",
"type": "boolean"
},
"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"
},
"oauth2": {
"description": "Optional OAuth 2.0 configuration. Cannot be set at the same time as `authorization`.",
"properties": {
"clientId": {
"description": "`clientId` specifies a key of a Secret or ConfigMap containing the OAuth2 client's ID.",
"properties": {
"configMap": {
"description": "ConfigMap containing data to use for the targets.",
"properties": {
"key": {
"description": "The key to select.",
"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 ConfigMap or its key must be defined",
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"secret": {
"description": "Secret containing data to use for the targets.",
"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"
}
},
"type": "object"
},
"clientSecret": {
"description": "`clientSecret` specifies a key of a Secret containing the OAuth2 client's 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"
},
"endpointParams": {
"additionalProperties": {
"type": "string"
},
"description": "`endpointParams` configures the HTTP parameters to append to the token URL.",
"type": "object"
},
"scopes": {
"description": "`scopes` defines the OAuth2 scopes used for the token request.",
"items": {
"type": "string"
},
"type": "array"
},
"tokenUrl": {
"description": "`tokenURL` configures the URL to fetch the token from.",
"minLength": 1,
"type": "string"
}
},
"required": [
"clientId",
"clientSecret",
"tokenUrl"
],
"type": "object"
},
"port": {
"description": "The port to scrape metrics from.",
"type": "integer"
},
"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": "Refresh interval to re-read the instance list.",
"pattern": "^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$",
"type": "string"
},
"tlsConfig": {
"description": "TLS configuration applying to the target HTTP endpoint.",
"properties": {
"ca": {
"description": "Certificate authority used when verifying server certificates.",
"properties": {
"configMap": {
"description": "ConfigMap containing data to use for the targets.",
"properties": {
"key": {
"description": "The key to select.",
"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 ConfigMap or its key must be defined",
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"secret": {
"description": "Secret containing data to use for the targets.",
"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"
}
},
"type": "object"
},
"cert": {
"description": "Client certificate to present when doing client-authentication.",
"properties": {
"configMap": {
"description": "ConfigMap containing data to use for the targets.",
"properties": {
"key": {
"description": "The key to select.",
"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 ConfigMap or its key must be defined",
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"secret": {
"description": "Secret containing data to use for the targets.",
"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"
}
},
"type": "object"
},
"insecureSkipVerify": {
"description": "Disable target certificate validation.",
"type": "boolean"
},
"keySecret": {
"description": "Secret containing the client key file for the targets.",
"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"
},
"serverName": {
"description": "Used to verify the hostname for the targets.",
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"type": "array"
},
"dnsSDConfigs": {
"description": "DNSSDConfigs defines a list of DNS service discovery configurations.",
"items": {

View file

@ -142,6 +142,9 @@ type ScrapeConfigSpec struct {
// OpenStackSDConfigs defines a list of OpenStack service discovery configurations.
// +optional
OpenStackSDConfigs []OpenStackSDConfig `json:"openstackSDConfigs,omitempty"`
// DigitalOceanSDConfigs defines a list of DigitalOcean service discovery configurations.
// +optional
DigitalOceanSDConfigs []DigitalOceanSDConfig `json:"digitalOceanSDConfigs,omitempty"`
// 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.
@ -622,6 +625,39 @@ type OpenStackSDConfig struct {
TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"`
}
// DigitalOceanSDConfig allow retrieving scrape targets from DigitalOcean's Droplets API.
// This service discovery uses the public IPv4 address by default, by that can be changed with relabeling
// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#digitalocean_sd_config
// +k8s:openapi-gen=true
type DigitalOceanSDConfig struct {
// Authorization header configuration to authenticate against the DigitalOcean API.
// Cannot be set at the same time as `oauth2`.
// +optional
Authorization *v1.SafeAuthorization `json:"authorization,omitempty"`
// Optional OAuth 2.0 configuration.
// Cannot be set at the same time as `authorization`.
// +optional
OAuth2 *v1.OAuth2 `json:"oauth2,omitempty"`
// ProxyConfig allows customizing the proxy behaviour for this scrape config.
// +optional
*ProxyConfig `json:",inline"`
// Configure whether HTTP requests follow HTTP 3xx redirects.
// +optional
FollowRedirects *bool `json:"followRedirects,omitempty"`
// Whether to enable HTTP2.
// +optional
EnableHTTP2 *bool `json:"enableHTTP2,omitempty"`
// TLS configuration applying to the target HTTP endpoint.
// +optional
TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"`
// The port to scrape metrics from.
// +optional
Port *int `json:"port,omitempty"`
// Refresh interval to re-read the instance list.
// +optional
RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"`
}
type ProxyConfig struct {
// `proxyURL` defines the HTTP proxy server to use.
//

View file

@ -343,6 +343,61 @@ func (in *DayOfMonthRange) DeepCopy() *DayOfMonthRange {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DigitalOceanSDConfig) DeepCopyInto(out *DigitalOceanSDConfig) {
*out = *in
if in.Authorization != nil {
in, out := &in.Authorization, &out.Authorization
*out = new(monitoringv1.SafeAuthorization)
(*in).DeepCopyInto(*out)
}
if in.OAuth2 != nil {
in, out := &in.OAuth2, &out.OAuth2
*out = new(monitoringv1.OAuth2)
(*in).DeepCopyInto(*out)
}
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
*out = new(bool)
**out = **in
}
if in.EnableHTTP2 != nil {
in, out := &in.EnableHTTP2, &out.EnableHTTP2
*out = new(bool)
**out = **in
}
if in.TLSConfig != nil {
in, out := &in.TLSConfig, &out.TLSConfig
*out = new(monitoringv1.SafeTLSConfig)
(*in).DeepCopyInto(*out)
}
if in.Port != nil {
in, out := &in.Port, &out.Port
*out = new(int)
**out = **in
}
if in.RefreshInterval != nil {
in, out := &in.RefreshInterval, &out.RefreshInterval
*out = new(monitoringv1.Duration)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DigitalOceanSDConfig.
func (in *DigitalOceanSDConfig) DeepCopy() *DigitalOceanSDConfig {
if in == nil {
return nil
}
out := new(DigitalOceanSDConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DiscordConfig) DeepCopyInto(out *DiscordConfig) {
*out = *in
@ -1572,6 +1627,13 @@ func (in *ScrapeConfigSpec) DeepCopyInto(out *ScrapeConfigSpec) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.DigitalOceanSDConfigs != nil {
in, out := &in.DigitalOceanSDConfigs, &out.DigitalOceanSDConfigs
*out = make([]DigitalOceanSDConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.RelabelConfigs != nil {
in, out := &in.RelabelConfigs, &out.RelabelConfigs
*out = make([]*monitoringv1.RelabelConfig, len(*in))

View file

@ -0,0 +1,97 @@
// 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 (
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
v1 "github.com/prometheus-operator/prometheus-operator/pkg/client/applyconfiguration/monitoring/v1"
)
// DigitalOceanSDConfigApplyConfiguration represents an declarative configuration of the DigitalOceanSDConfig type for use
// with apply.
type DigitalOceanSDConfigApplyConfiguration struct {
Authorization *v1.SafeAuthorizationApplyConfiguration `json:"authorization,omitempty"`
OAuth2 *v1.OAuth2ApplyConfiguration `json:"oauth2,omitempty"`
ProxyConfigApplyConfiguration `json:",inline"`
FollowRedirects *bool `json:"followRedirects,omitempty"`
EnableHTTP2 *bool `json:"enableHTTP2,omitempty"`
TLSConfig *v1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"`
Port *int `json:"port,omitempty"`
RefreshInterval *monitoringv1.Duration `json:"refreshInterval,omitempty"`
}
// DigitalOceanSDConfigApplyConfiguration constructs an declarative configuration of the DigitalOceanSDConfig type for use with
// apply.
func DigitalOceanSDConfig() *DigitalOceanSDConfigApplyConfiguration {
return &DigitalOceanSDConfigApplyConfiguration{}
}
// WithAuthorization sets the Authorization 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 Authorization field is set to the value of the last call.
func (b *DigitalOceanSDConfigApplyConfiguration) WithAuthorization(value *v1.SafeAuthorizationApplyConfiguration) *DigitalOceanSDConfigApplyConfiguration {
b.Authorization = value
return b
}
// WithOAuth2 sets the OAuth2 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 OAuth2 field is set to the value of the last call.
func (b *DigitalOceanSDConfigApplyConfiguration) WithOAuth2(value *v1.OAuth2ApplyConfiguration) *DigitalOceanSDConfigApplyConfiguration {
b.OAuth2 = value
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.
func (b *DigitalOceanSDConfigApplyConfiguration) WithFollowRedirects(value bool) *DigitalOceanSDConfigApplyConfiguration {
b.FollowRedirects = &value
return b
}
// WithEnableHTTP2 sets the EnableHTTP2 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 EnableHTTP2 field is set to the value of the last call.
func (b *DigitalOceanSDConfigApplyConfiguration) WithEnableHTTP2(value bool) *DigitalOceanSDConfigApplyConfiguration {
b.EnableHTTP2 = &value
return b
}
// WithTLSConfig sets the TLSConfig 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 TLSConfig field is set to the value of the last call.
func (b *DigitalOceanSDConfigApplyConfiguration) WithTLSConfig(value *v1.SafeTLSConfigApplyConfiguration) *DigitalOceanSDConfigApplyConfiguration {
b.TLSConfig = value
return b
}
// WithPort sets the Port 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 Port field is set to the value of the last call.
func (b *DigitalOceanSDConfigApplyConfiguration) WithPort(value int) *DigitalOceanSDConfigApplyConfiguration {
b.Port = &value
return b
}
// WithRefreshInterval sets the RefreshInterval 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 RefreshInterval field is set to the value of the last call.
func (b *DigitalOceanSDConfigApplyConfiguration) WithRefreshInterval(value monitoringv1.Duration) *DigitalOceanSDConfigApplyConfiguration {
b.RefreshInterval = &value
return b
}

View file

@ -34,6 +34,7 @@ type ScrapeConfigSpecApplyConfiguration struct {
AzureSDConfigs []AzureSDConfigApplyConfiguration `json:"azureSDConfigs,omitempty"`
GCESDConfigs []GCESDConfigApplyConfiguration `json:"gceSDConfigs,omitempty"`
OpenStackSDConfigs []OpenStackSDConfigApplyConfiguration `json:"openstackSDConfigs,omitempty"`
DigitalOceanSDConfigs []DigitalOceanSDConfigApplyConfiguration `json:"digitalOceanSDConfigs,omitempty"`
RelabelConfigs []*v1.RelabelConfig `json:"relabelings,omitempty"`
MetricsPath *string `json:"metricsPath,omitempty"`
ScrapeInterval *v1.Duration `json:"scrapeInterval,omitempty"`
@ -193,6 +194,19 @@ func (b *ScrapeConfigSpecApplyConfiguration) WithOpenStackSDConfigs(values ...*O
return b
}
// WithDigitalOceanSDConfigs adds the given value to the DigitalOceanSDConfigs field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the DigitalOceanSDConfigs field.
func (b *ScrapeConfigSpecApplyConfiguration) WithDigitalOceanSDConfigs(values ...*DigitalOceanSDConfigApplyConfiguration) *ScrapeConfigSpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithDigitalOceanSDConfigs")
}
b.DigitalOceanSDConfigs = append(b.DigitalOceanSDConfigs, *values[i])
}
return b
}
// WithRelabelConfigs adds the given value to the RelabelConfigs field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the RelabelConfigs field.

View file

@ -205,6 +205,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &monitoringv1alpha1.ConsulSDConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("DayOfMonthRange"):
return &monitoringv1alpha1.DayOfMonthRangeApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("DigitalOceanSDConfig"):
return &monitoringv1alpha1.DigitalOceanSDConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("DiscordConfig"):
return &monitoringv1alpha1.DiscordConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("DNSSDConfig"):

View file

@ -3108,6 +3108,52 @@ func (cg *ConfigGenerator) generateScrapeConfig(
})
}
// DigitalOceanSDConfig
if len(sc.Spec.DigitalOceanSDConfigs) > 0 {
configs := make([][]yaml.MapItem, len(sc.Spec.DigitalOceanSDConfigs))
for i, config := range sc.Spec.DigitalOceanSDConfigs {
assetStoreKey := fmt.Sprintf("scrapeconfig/%s/%s/digitaloceansdconfig/%d", sc.GetNamespace(), sc.GetName(), i)
configs[i] = cg.addSafeAuthorizationToYaml(configs[i], fmt.Sprintf("scrapeconfig/auth/%s/%s/digitaloceansdconfig/%d", sc.GetNamespace(), sc.GetName(), i), store, config.Authorization)
configs[i] = cg.addOAuth2ToYaml(configs[i], config.OAuth2, store.OAuth2Assets, assetStoreKey)
configs[i] = cg.addProxyConfigtoYaml(ctx, configs[i], sc.GetNamespace(), store, config.ProxyConfig)
if config.FollowRedirects != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "follow_redirects",
Value: config.FollowRedirects,
})
}
if config.EnableHTTP2 != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "enable_http2",
Value: config.EnableHTTP2,
})
}
if config.TLSConfig != nil {
configs[i] = addSafeTLStoYaml(configs[i], sc.GetNamespace(), *config.TLSConfig)
}
if config.Port != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "port",
Value: config.Port,
})
}
if config.RefreshInterval != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "refresh_interval",
Value: config.RefreshInterval,
})
}
}
cfg = append(cfg, yaml.MapItem{
Key: "digitalocean_sd_configs",
Value: configs,
})
}
if sc.Spec.MetricRelabelConfigs != nil {
cfg = append(cfg, yaml.MapItem{Key: "metric_relabel_configs", Value: generateRelabelConfig(labeler.GetRelabelingConfigs(sc.TypeMeta, sc.ObjectMeta, sc.Spec.MetricRelabelConfigs))})
}

View file

@ -6375,6 +6375,177 @@ func TestScrapeConfigSpecConfigWithOpenStackSD(t *testing.T) {
}
}
func TestScrapeConfigSpecConfigWithDigitalOceanSD(t *testing.T) {
for _, tc := range []struct {
name string
scSpec monitoringv1alpha1.ScrapeConfigSpec
golden string
}{
{
name: "digitalocean_sd_config",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
DigitalOceanSDConfigs: []monitoringv1alpha1.DigitalOceanSDConfig{
{
Authorization: &monitoringv1.SafeAuthorization{
Credentials: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "credential",
},
},
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: "secret",
},
Key: "proxy-header",
},
},
},
FollowRedirects: ptr.To(true),
EnableHTTP2: ptr.To(true),
Port: ptr.To(9100),
RefreshInterval: (*monitoringv1.Duration)(ptr.To("30s")),
},
},
},
golden: "ScrapeConfigSpecConfig_DigitalOceanSD.golden",
},
{
name: "digitalocean_sd_config_oauth",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
DigitalOceanSDConfigs: []monitoringv1alpha1.DigitalOceanSDConfig{
{
OAuth2: &monitoringv1.OAuth2{
ClientID: monitoringv1.SecretOrConfigMap{
ConfigMap: &v1.ConfigMapKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "oauth2",
},
Key: "client_id",
},
},
ClientSecret: v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "oauth2",
},
Key: "client_secret",
},
TokenURL: "http://test.url",
Scopes: []string{"scope 1", "scope 2"},
EndpointParams: map[string]string{
"param1": "value1",
"param2": "value2",
},
},
},
},
},
golden: "ScrapeConfigSpecConfig_DigitalOceanSD_with_OAuth.golden",
}, {
name: "digitalocean_sd_config_tls",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
DigitalOceanSDConfigs: []monitoringv1alpha1.DigitalOceanSDConfig{
{
Authorization: &monitoringv1.SafeAuthorization{
Credentials: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "credential",
},
},
TLSConfig: &monitoringv1.SafeTLSConfig{
CA: monitoringv1.SecretOrConfigMap{
Secret: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret-ca",
},
},
},
Cert: monitoringv1.SecretOrConfigMap{
Secret: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret-cert",
},
},
},
KeySecret: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key",
},
},
},
},
},
golden: "ScrapeConfigSpecConfig_DigitalOceanSD_with_TLSConfig.golden",
}} {
t.Run(tc.name, func(t *testing.T) {
c := fake.NewSimpleClientset(
&v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "secret",
Namespace: "default",
},
Data: map[string][]byte{
"proxy-header": []byte("value"),
"token": []byte("value"),
"credential": []byte("value"),
},
},
)
store := assets.NewStore(c.CoreV1(), c.CoreV1())
store.OAuth2Assets = map[string]assets.OAuth2Credentials{
"scrapeconfig/default/testscrapeconfig1/digitaloceansdconfig/0": {
ClientID: "client-id",
ClientSecret: "client-secret",
},
}
scs := map[string]*monitoringv1alpha1.ScrapeConfig{
"sc": {
ObjectMeta: metav1.ObjectMeta{
Name: "testscrapeconfig1",
Namespace: "default",
},
Spec: tc.scSpec,
},
}
p := defaultPrometheus()
cg := mustNewConfigGenerator(t, p)
cfg, err := cg.GenerateServerConfiguration(
context.Background(),
p.Spec.EvaluationInterval,
p.Spec.QueryLogFile,
nil,
nil,
p.Spec.TSDB,
nil,
nil,
nil,
nil,
nil,
scs,
store,
nil,
nil,
nil,
nil,
)
require.NoError(t, err)
golden.Assert(t, string(cfg), tc.golden)
})
}
}
func TestTracingConfig(t *testing.T) {
samplingTwo := resource.MustParse("0.5")
testCases := []struct {

View file

@ -758,6 +758,10 @@ func (rs *ResourceSelector) SelectScrapeConfigs(ctx context.Context, listFn List
continue
}
if err = rs.validateDigitalOceanSDConfigs(ctx, sc); err != nil {
rejectFn(sc, fmt.Errorf("digitalOceanSDConfigs: %w", err))
continue
}
res[scName] = sc
}
@ -947,3 +951,29 @@ func (rs *ResourceSelector) validateOpenStackSDConfigs(ctx context.Context, sc *
}
return nil
}
func (rs *ResourceSelector) validateDigitalOceanSDConfigs(ctx context.Context, sc *monitoringv1alpha1.ScrapeConfig) error {
for i, config := range sc.Spec.DigitalOceanSDConfigs {
configAuthKey := fmt.Sprintf("scrapeconfig/auth/%s/%s/digitaloceansdconfig/%d", sc.GetNamespace(), sc.GetName(), i)
if err := rs.store.AddSafeAuthorizationCredentials(ctx, sc.GetNamespace(), config.Authorization, configAuthKey); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
configKey := fmt.Sprintf("scrapeconfig/%s/%s/digitaloceansdconfig/%d", sc.GetNamespace(), sc.GetName(), i)
if err := rs.store.AddOAuth2(ctx, sc.GetNamespace(), config.OAuth2, configKey); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
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 := validateProxyConfig(ctx, config.ProxyConfig, rs.store, sc.GetNamespace()); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
}
}
return nil
}

View file

@ -1914,6 +1914,60 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
selected: true,
},
{
scenario: "DigitalOcean SD config with valid TLS Config",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.DigitalOceanSDConfigs = []monitoringv1alpha1.DigitalOceanSDConfig{
{
TLSConfig: &monitoringv1.SafeTLSConfig{
CA: monitoringv1.SecretOrConfigMap{
Secret: &v1.SecretKeySelector{
Key: "ca",
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
},
},
Cert: monitoringv1.SecretOrConfigMap{
Secret: &v1.SecretKeySelector{
Key: "cert",
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
},
},
KeySecret: &v1.SecretKeySelector{
Key: "key",
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
},
},
},
}
},
selected: true,
},
{
scenario: "DigitalOcean SD config with invalid TLS config with invalid CA data",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.DigitalOceanSDConfigs = []monitoringv1alpha1.DigitalOceanSDConfig{
{
TLSConfig: &monitoringv1.SafeTLSConfig{
CA: monitoringv1.SecretOrConfigMap{
Secret: &v1.SecretKeySelector{
Key: "invalid_ca",
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
},
},
},
},
}
},
selected: false,
},
} {
t.Run(tc.scenario, func(t *testing.T) {
cs := fake.NewSimpleClientset(

View file

@ -0,0 +1,24 @@
global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: default/test
prometheus_replica: $(POD_NAME)
scrape_configs:
- job_name: scrapeConfig/default/testscrapeconfig1
digitalocean_sd_configs:
- authorization:
type: Bearer
proxy_url: http://no-proxy.com
no_proxy: 0.0.0.0
proxy_from_environment: true
proxy_connect_header:
header: value
follow_redirects: true
enable_http2: true
port: 9100
refresh_interval: 30s
relabel_configs:
- source_labels:
- job
target_label: __tmp_prometheus_job_name

View file

@ -0,0 +1,23 @@
global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: default/test
prometheus_replica: $(POD_NAME)
scrape_configs:
- job_name: scrapeConfig/default/testscrapeconfig1
digitalocean_sd_configs:
- oauth2:
client_id: client-id
client_secret: client-secret
token_url: http://test.url
scopes:
- scope 1
- scope 2
endpoint_params:
param1: value1
param2: value2
relabel_configs:
- source_labels:
- job
target_label: __tmp_prometheus_job_name

View file

@ -0,0 +1,20 @@
global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: default/test
prometheus_replica: $(POD_NAME)
scrape_configs:
- job_name: scrapeConfig/default/testscrapeconfig1
digitalocean_sd_configs:
- authorization:
type: Bearer
tls_config:
insecure_skip_verify: false
ca_file: /etc/prometheus/certs/secret_default_secret-ca_
cert_file: /etc/prometheus/certs/secret_default_secret-cert_
key_file: /etc/prometheus/certs/secret_default_secret_key
relabel_configs:
- source_labels:
- job
target_label: __tmp_prometheus_job_name