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

Merge pull request from slashpai/openstack

feat: add OpenStack SD support in ScrapeConfig
This commit is contained in:
Simon Pasquier 2023-12-19 08:48:14 +01:00 committed by GitHub
commit 27f76054cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 2070 additions and 2 deletions

288
Documentation/api.md generated
View file

@ -7296,7 +7296,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.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.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.
@ -12815,7 +12815,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.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.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.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>
@ -16805,6 +16805,20 @@ ScrapeConfigSpec
</tr>
<tr>
<td>
<code>openstackSDConfigs</code><br/>
<em>
<a href="#monitoring.coreos.com/v1alpha1.OpenStackSDConfig">
[]OpenStackSDConfig
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>OpenStackSDConfigs defines a list of OpenStack service discovery configurations.</p>
</td>
</tr>
<tr>
<td>
<code>relabelings</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.RelabelConfig">
@ -18894,6 +18908,262 @@ string
</tr>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.OpenStackSDConfig">OpenStackSDConfig
</h3>
<p>
(<em>Appears on:</em><a href="#monitoring.coreos.com/v1alpha1.ScrapeConfigSpec">ScrapeConfigSpec</a>)
</p>
<div>
<p>OpenStackSDConfig allow retrieving scrape targets from OpenStack Nova instances.
See <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config">https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config</a></p>
</div>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>role</code><br/>
<em>
string
</em>
</td>
<td>
<p>The OpenStack role of entities that should be discovered.</p>
</td>
</tr>
<tr>
<td>
<code>region</code><br/>
<em>
string
</em>
</td>
<td>
<p>The OpenStack Region.</p>
</td>
</tr>
<tr>
<td>
<code>identityEndpoint</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>IdentityEndpoint specifies the HTTP endpoint that is required to work with
the Identity API of the appropriate version.</p>
</td>
</tr>
<tr>
<td>
<code>username</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Username is required if using Identity V2 API. Consult with your provider&rsquo;s
control panel to discover your account&rsquo;s username.
In Identity V3, either userid or a combination of username
and domainId or domainName are needed</p>
</td>
</tr>
<tr>
<td>
<code>userid</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>UserID</p>
</td>
</tr>
<tr>
<td>
<code>password</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#secretkeyselector-v1-core">
Kubernetes core/v1.SecretKeySelector
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>Password for the Identity V2 and V3 APIs. Consult with your provider&rsquo;s
control panel to discover your account&rsquo;s preferred method of authentication.</p>
</td>
</tr>
<tr>
<td>
<code>domainName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>At most one of domainId and domainName must be provided if using username
with Identity V3. Otherwise, either are optional.</p>
</td>
</tr>
<tr>
<td>
<code>domainID</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>DomainID</p>
</td>
</tr>
<tr>
<td>
<code>projectName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>The ProjectId and ProjectName fields are optional for the Identity V2 API.
Some providers allow you to specify a ProjectName instead of the ProjectId.
Some require both. Your provider&rsquo;s authentication policies will determine
how these fields influence authentication.</p>
</td>
</tr>
<tr>
<td>
<code>projectID</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>ProjectID</p>
</td>
</tr>
<tr>
<td>
<code>applicationCredentialName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>The ApplicationCredentialID or ApplicationCredentialName fields are
required if using an application credential to authenticate. Some providers
allow you to create an application credential to authenticate rather than a
password.</p>
</td>
</tr>
<tr>
<td>
<code>applicationCredentialId</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>ApplicationCredentialID</p>
</td>
</tr>
<tr>
<td>
<code>applicationCredentialSecret</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#secretkeyselector-v1-core">
Kubernetes core/v1.SecretKeySelector
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>The applicationCredentialSecret field is required if using an application
credential to authenticate.</p>
</td>
</tr>
<tr>
<td>
<code>allTenants</code><br/>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether the service discovery should list all instances for all projects.
It is only relevant for the &lsquo;instance&rsquo; role and usually requires admin permissions.</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>
<tr>
<td>
<code>port</code><br/>
<em>
int
</em>
</td>
<td>
<em>(Optional)</em>
<p>The port to scrape metrics from. If using the public IP address, this must
instead be specified in the relabeling rule.</p>
</td>
</tr>
<tr>
<td>
<code>availability</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>Availability of the endpoint to connect to.</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>
</tbody>
</table>
<h3 id="monitoring.coreos.com/v1alpha1.OpsGenieConfig">OpsGenieConfig
</h3>
<p>
@ -21723,6 +21993,20 @@ HTTPConfig
</tr>
<tr>
<td>
<code>openstackSDConfigs</code><br/>
<em>
<a href="#monitoring.coreos.com/v1alpha1.OpenStackSDConfig">
[]OpenStackSDConfig
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>OpenStackSDConfigs defines a list of OpenStack service discovery configurations.</p>
</td>
</tr>
<tr>
<td>
<code>relabelings</code><br/>
<em>
<a href="#monitoring.coreos.com/v1.RelabelConfig">

249
bundle.yaml generated
View file

@ -34415,6 +34415,255 @@ spec:
IP and domain names can contain port numbers. \n It requires Prometheus
>= v2.43.0."
type: string
openstackSDConfigs:
description: OpenStackSDConfigs defines a list of OpenStack service
discovery configurations.
items:
description: OpenStackSDConfig allow retrieving scrape targets from
OpenStack Nova instances. See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config
properties:
allTenants:
description: Whether the service discovery should list all instances
for all projects. It is only relevant for the 'instance' role
and usually requires admin permissions.
type: boolean
applicationCredentialId:
description: ApplicationCredentialID
type: string
applicationCredentialName:
description: The ApplicationCredentialID or ApplicationCredentialName
fields are required if using an application credential to
authenticate. Some providers allow you to create an application
credential to authenticate rather than a password.
type: string
applicationCredentialSecret:
description: The applicationCredentialSecret field is required
if using an application credential to authenticate.
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
availability:
description: Availability of the endpoint to connect to.
enum:
- Public
- public
- Admin
- admin
- Internal
- internal
type: string
domainID:
description: DomainID
type: string
domainName:
description: At most one of domainId and domainName must be
provided if using username with Identity V3. Otherwise, either
are optional.
type: string
identityEndpoint:
description: IdentityEndpoint specifies the HTTP endpoint that
is required to work with the Identity API of the appropriate
version.
type: string
password:
description: Password for the Identity V2 and V3 APIs. Consult
with your provider's control panel to discover your account's
preferred method of 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
port:
description: The port to scrape metrics from. If using the public
IP address, this must instead be specified in the relabeling
rule.
type: integer
projectID:
description: ProjectID
type: string
projectName:
description: The ProjectId and ProjectName fields are optional
for the Identity V2 API. Some providers allow you to specify
a ProjectName instead of the ProjectId. Some require both.
Your provider's authentication policies will determine how
these fields influence authentication.
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
region:
description: The OpenStack Region.
minLength: 1
type: string
role:
description: The OpenStack role of entities that should be discovered.
enum:
- Instance
- instance
- Hypervisor
- hypervisor
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
userid:
description: UserID
type: string
username:
description: Username is required if using Identity V2 API.
Consult with your provider's control panel to discover your
account's username. In Identity V3, either userid or a combination
of username and domainId or domainName are needed
type: string
required:
- region
- role
type: object
type: array
params:
additionalProperties:
items:

View file

@ -1234,6 +1234,255 @@ spec:
IP and domain names can contain port numbers. \n It requires Prometheus
>= v2.43.0."
type: string
openstackSDConfigs:
description: OpenStackSDConfigs defines a list of OpenStack service
discovery configurations.
items:
description: OpenStackSDConfig allow retrieving scrape targets from
OpenStack Nova instances. See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config
properties:
allTenants:
description: Whether the service discovery should list all instances
for all projects. It is only relevant for the 'instance' role
and usually requires admin permissions.
type: boolean
applicationCredentialId:
description: ApplicationCredentialID
type: string
applicationCredentialName:
description: The ApplicationCredentialID or ApplicationCredentialName
fields are required if using an application credential to
authenticate. Some providers allow you to create an application
credential to authenticate rather than a password.
type: string
applicationCredentialSecret:
description: The applicationCredentialSecret field is required
if using an application credential to authenticate.
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
availability:
description: Availability of the endpoint to connect to.
enum:
- Public
- public
- Admin
- admin
- Internal
- internal
type: string
domainID:
description: DomainID
type: string
domainName:
description: At most one of domainId and domainName must be
provided if using username with Identity V3. Otherwise, either
are optional.
type: string
identityEndpoint:
description: IdentityEndpoint specifies the HTTP endpoint that
is required to work with the Identity API of the appropriate
version.
type: string
password:
description: Password for the Identity V2 and V3 APIs. Consult
with your provider's control panel to discover your account's
preferred method of 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
port:
description: The port to scrape metrics from. If using the public
IP address, this must instead be specified in the relabeling
rule.
type: integer
projectID:
description: ProjectID
type: string
projectName:
description: The ProjectId and ProjectName fields are optional
for the Identity V2 API. Some providers allow you to specify
a ProjectName instead of the ProjectId. Some require both.
Your provider's authentication policies will determine how
these fields influence authentication.
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
region:
description: The OpenStack Region.
minLength: 1
type: string
role:
description: The OpenStack role of entities that should be discovered.
enum:
- Instance
- instance
- Hypervisor
- hypervisor
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
userid:
description: UserID
type: string
username:
description: Username is required if using Identity V2 API.
Consult with your provider's control panel to discover your
account's username. In Identity V3, either userid or a combination
of username and domainId or domainName are needed
type: string
required:
- region
- role
type: object
type: array
params:
additionalProperties:
items:

View file

@ -1235,6 +1235,255 @@ spec:
IP and domain names can contain port numbers. \n It requires Prometheus
>= v2.43.0."
type: string
openstackSDConfigs:
description: OpenStackSDConfigs defines a list of OpenStack service
discovery configurations.
items:
description: OpenStackSDConfig allow retrieving scrape targets from
OpenStack Nova instances. See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config
properties:
allTenants:
description: Whether the service discovery should list all instances
for all projects. It is only relevant for the 'instance' role
and usually requires admin permissions.
type: boolean
applicationCredentialId:
description: ApplicationCredentialID
type: string
applicationCredentialName:
description: The ApplicationCredentialID or ApplicationCredentialName
fields are required if using an application credential to
authenticate. Some providers allow you to create an application
credential to authenticate rather than a password.
type: string
applicationCredentialSecret:
description: The applicationCredentialSecret field is required
if using an application credential to authenticate.
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
availability:
description: Availability of the endpoint to connect to.
enum:
- Public
- public
- Admin
- admin
- Internal
- internal
type: string
domainID:
description: DomainID
type: string
domainName:
description: At most one of domainId and domainName must be
provided if using username with Identity V3. Otherwise, either
are optional.
type: string
identityEndpoint:
description: IdentityEndpoint specifies the HTTP endpoint that
is required to work with the Identity API of the appropriate
version.
type: string
password:
description: Password for the Identity V2 and V3 APIs. Consult
with your provider's control panel to discover your account's
preferred method of 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
port:
description: The port to scrape metrics from. If using the public
IP address, this must instead be specified in the relabeling
rule.
type: integer
projectID:
description: ProjectID
type: string
projectName:
description: The ProjectId and ProjectName fields are optional
for the Identity V2 API. Some providers allow you to specify
a ProjectName instead of the ProjectId. Some require both.
Your provider's authentication policies will determine how
these fields influence authentication.
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
region:
description: The OpenStack Region.
minLength: 1
type: string
role:
description: The OpenStack role of entities that should be discovered.
enum:
- Instance
- instance
- Hypervisor
- hypervisor
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
userid:
description: UserID
type: string
username:
description: Username is required if using Identity V2 API.
Consult with your provider's control panel to discover your
account's username. In Identity V3, either userid or a combination
of username and domainId or domainName are needed
type: string
required:
- region
- role
type: object
type: array
params:
additionalProperties:
items:

View file

@ -1326,6 +1326,276 @@
"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"
},
"openstackSDConfigs": {
"description": "OpenStackSDConfigs defines a list of OpenStack service discovery configurations.",
"items": {
"description": "OpenStackSDConfig allow retrieving scrape targets from OpenStack Nova instances. See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config",
"properties": {
"allTenants": {
"description": "Whether the service discovery should list all instances for all projects. It is only relevant for the 'instance' role and usually requires admin permissions.",
"type": "boolean"
},
"applicationCredentialId": {
"description": "ApplicationCredentialID",
"type": "string"
},
"applicationCredentialName": {
"description": "The ApplicationCredentialID or ApplicationCredentialName fields are required if using an application credential to authenticate. Some providers allow you to create an application credential to authenticate rather than a password.",
"type": "string"
},
"applicationCredentialSecret": {
"description": "The applicationCredentialSecret field is required if using an application credential to authenticate.",
"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"
},
"availability": {
"description": "Availability of the endpoint to connect to.",
"enum": [
"Public",
"public",
"Admin",
"admin",
"Internal",
"internal"
],
"type": "string"
},
"domainID": {
"description": "DomainID",
"type": "string"
},
"domainName": {
"description": "At most one of domainId and domainName must be provided if using username with Identity V3. Otherwise, either are optional.",
"type": "string"
},
"identityEndpoint": {
"description": "IdentityEndpoint specifies the HTTP endpoint that is required to work with the Identity API of the appropriate version.",
"type": "string"
},
"password": {
"description": "Password for the Identity V2 and V3 APIs. Consult with your provider's control panel to discover your account's preferred method of 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"
},
"port": {
"description": "The port to scrape metrics from. If using the public IP address, this must instead be specified in the relabeling rule.",
"type": "integer"
},
"projectID": {
"description": "ProjectID",
"type": "string"
},
"projectName": {
"description": "The ProjectId and ProjectName fields are optional for the Identity V2 API. Some providers allow you to specify a ProjectName instead of the ProjectId. Some require both. Your provider's authentication policies will determine how these fields influence authentication.",
"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"
},
"region": {
"description": "The OpenStack Region.",
"minLength": 1,
"type": "string"
},
"role": {
"description": "The OpenStack role of entities that should be discovered.",
"enum": [
"Instance",
"instance",
"Hypervisor",
"hypervisor"
],
"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"
},
"userid": {
"description": "UserID",
"type": "string"
},
"username": {
"description": "Username is required if using Identity V2 API. Consult with your provider's control panel to discover your account's username. In Identity V3, either userid or a combination of username and domainId or domainName are needed",
"type": "string"
}
},
"required": [
"region",
"role"
],
"type": "object"
},
"type": "array"
},
"params": {
"additionalProperties": {
"items": {

View file

@ -123,6 +123,9 @@ type ScrapeConfigSpec struct {
// GCESDConfigs defines a list of GCE service discovery configurations.
// +optional
GCESDConfigs []GCESDConfig `json:"gceSDConfigs,omitempty"`
// OpenStackSDConfigs defines a list of OpenStack service discovery configurations.
// +optional
OpenStackSDConfigs []OpenStackSDConfig `json:"openstackSDConfigs,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.
@ -479,6 +482,84 @@ type GCESDConfig struct {
TagSeparator *string `json:"tagSeparator,omitempty"`
}
// OpenStackSDConfig allow retrieving scrape targets from OpenStack Nova instances.
// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#openstack_sd_config
// +k8s:openapi-gen=true
type OpenStackSDConfig struct {
// The OpenStack role of entities that should be discovered.
// +kubebuilder:validation:Enum=Instance;instance;Hypervisor;hypervisor
// +required
Role string `json:"role"`
// The OpenStack Region.
// +kubebuilder:validation:MinLength:=1
// +required
Region string `json:"region"`
// IdentityEndpoint specifies the HTTP endpoint that is required to work with
// the Identity API of the appropriate version.
// +optional
IdentityEndpoint *string `json:"identityEndpoint,omitempty"`
// Username is required if using Identity V2 API. Consult with your provider's
// control panel to discover your account's username.
// In Identity V3, either userid or a combination of username
// and domainId or domainName are needed
// +optional
Username *string `json:"username,omitempty"`
// UserID
// +optional
UserID *string `json:"userid,omitempty"`
// Password for the Identity V2 and V3 APIs. Consult with your provider's
// control panel to discover your account's preferred method of authentication.
// +optional
Password *corev1.SecretKeySelector `json:"password,omitempty"`
// At most one of domainId and domainName must be provided if using username
// with Identity V3. Otherwise, either are optional.
// +optional
DomainName *string `json:"domainName,omitempty"`
// DomainID
// +optional
DomainID *string `json:"domainID,omitempty"`
// The ProjectId and ProjectName fields are optional for the Identity V2 API.
// Some providers allow you to specify a ProjectName instead of the ProjectId.
// Some require both. Your provider's authentication policies will determine
// how these fields influence authentication.
// +optional
ProjectName *string `json:"projectName,omitempty"`
// ProjectID
// +optional
ProjectID *string `json:"projectID,omitempty"`
// The ApplicationCredentialID or ApplicationCredentialName fields are
// required if using an application credential to authenticate. Some providers
// allow you to create an application credential to authenticate rather than a
// password.
// +optional
ApplicationCredentialName *string `json:"applicationCredentialName,omitempty"`
// ApplicationCredentialID
// +optional
ApplicationCredentialID *string `json:"applicationCredentialId,omitempty"`
// The applicationCredentialSecret field is required if using an application
// credential to authenticate.
// +optional
ApplicationCredentialSecret *corev1.SecretKeySelector `json:"applicationCredentialSecret,omitempty"`
// Whether the service discovery should list all instances for all projects.
// It is only relevant for the 'instance' role and usually requires admin permissions.
// +optional
AllTenants *bool `json:"allTenants,omitempty"`
// Refresh interval to re-read the instance list.
// +optional
RefreshInterval *v1.Duration `json:"refreshInterval,omitempty"`
// The port to scrape metrics from. If using the public IP address, this must
// instead be specified in the relabeling rule.
// +optional
Port *int `json:"port"`
// Availability of the endpoint to connect to.
// +kubebuilder:validation:Enum=Public;public;Admin;admin;Internal;internal
// +optional
Availability *string `json:"availability,omitempty"`
// TLS configuration applying to the target HTTP endpoint.
// +optional
TLSConfig *v1.SafeTLSConfig `json:"tlsConfig,omitempty"`
}
type ProxyConfig struct {
// `proxyURL` defines the HTTP proxy server to use.
//

View file

@ -788,6 +788,101 @@ func (in *MuteTimeInterval) DeepCopy() *MuteTimeInterval {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpenStackSDConfig) DeepCopyInto(out *OpenStackSDConfig) {
*out = *in
if in.IdentityEndpoint != nil {
in, out := &in.IdentityEndpoint, &out.IdentityEndpoint
*out = new(string)
**out = **in
}
if in.Username != nil {
in, out := &in.Username, &out.Username
*out = new(string)
**out = **in
}
if in.UserID != nil {
in, out := &in.UserID, &out.UserID
*out = new(string)
**out = **in
}
if in.Password != nil {
in, out := &in.Password, &out.Password
*out = new(corev1.SecretKeySelector)
(*in).DeepCopyInto(*out)
}
if in.DomainName != nil {
in, out := &in.DomainName, &out.DomainName
*out = new(string)
**out = **in
}
if in.DomainID != nil {
in, out := &in.DomainID, &out.DomainID
*out = new(string)
**out = **in
}
if in.ProjectName != nil {
in, out := &in.ProjectName, &out.ProjectName
*out = new(string)
**out = **in
}
if in.ProjectID != nil {
in, out := &in.ProjectID, &out.ProjectID
*out = new(string)
**out = **in
}
if in.ApplicationCredentialName != nil {
in, out := &in.ApplicationCredentialName, &out.ApplicationCredentialName
*out = new(string)
**out = **in
}
if in.ApplicationCredentialID != nil {
in, out := &in.ApplicationCredentialID, &out.ApplicationCredentialID
*out = new(string)
**out = **in
}
if in.ApplicationCredentialSecret != nil {
in, out := &in.ApplicationCredentialSecret, &out.ApplicationCredentialSecret
*out = new(corev1.SecretKeySelector)
(*in).DeepCopyInto(*out)
}
if in.AllTenants != nil {
in, out := &in.AllTenants, &out.AllTenants
*out = new(bool)
**out = **in
}
if in.RefreshInterval != nil {
in, out := &in.RefreshInterval, &out.RefreshInterval
*out = new(monitoringv1.Duration)
**out = **in
}
if in.Port != nil {
in, out := &in.Port, &out.Port
*out = new(int)
**out = **in
}
if in.Availability != nil {
in, out := &in.Availability, &out.Availability
*out = new(string)
**out = **in
}
if in.TLSConfig != nil {
in, out := &in.TLSConfig, &out.TLSConfig
*out = new(monitoringv1.SafeTLSConfig)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackSDConfig.
func (in *OpenStackSDConfig) DeepCopy() *OpenStackSDConfig {
if in == nil {
return nil
}
out := new(OpenStackSDConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OpsGenieConfig) DeepCopyInto(out *OpsGenieConfig) {
*out = *in
@ -1375,6 +1470,13 @@ func (in *ScrapeConfigSpec) DeepCopyInto(out *ScrapeConfigSpec) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.OpenStackSDConfigs != nil {
in, out := &in.OpenStackSDConfigs, &out.OpenStackSDConfigs
*out = make([]OpenStackSDConfig, 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,196 @@
// 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"
applyconfigurationmonitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/client/applyconfiguration/monitoring/v1"
v1 "k8s.io/api/core/v1"
)
// OpenStackSDConfigApplyConfiguration represents an declarative configuration of the OpenStackSDConfig type for use
// with apply.
type OpenStackSDConfigApplyConfiguration struct {
Role *string `json:"role,omitempty"`
Region *string `json:"region,omitempty"`
IdentityEndpoint *string `json:"identityEndpoint,omitempty"`
Username *string `json:"username,omitempty"`
UserID *string `json:"userid,omitempty"`
Password *v1.SecretKeySelector `json:"password,omitempty"`
DomainName *string `json:"domainName,omitempty"`
DomainID *string `json:"domainID,omitempty"`
ProjectName *string `json:"projectName,omitempty"`
ProjectID *string `json:"projectID,omitempty"`
ApplicationCredentialName *string `json:"applicationCredentialName,omitempty"`
ApplicationCredentialID *string `json:"applicationCredentialId,omitempty"`
ApplicationCredentialSecret *v1.SecretKeySelector `json:"applicationCredentialSecret,omitempty"`
AllTenants *bool `json:"allTenants,omitempty"`
RefreshInterval *monitoringv1.Duration `json:"refreshInterval,omitempty"`
Port *int `json:"port,omitempty"`
Availability *string `json:"availability,omitempty"`
TLSConfig *applyconfigurationmonitoringv1.SafeTLSConfigApplyConfiguration `json:"tlsConfig,omitempty"`
}
// OpenStackSDConfigApplyConfiguration constructs an declarative configuration of the OpenStackSDConfig type for use with
// apply.
func OpenStackSDConfig() *OpenStackSDConfigApplyConfiguration {
return &OpenStackSDConfigApplyConfiguration{}
}
// WithRole sets the Role 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 Role field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithRole(value string) *OpenStackSDConfigApplyConfiguration {
b.Role = &value
return b
}
// WithRegion sets the Region 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 Region field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithRegion(value string) *OpenStackSDConfigApplyConfiguration {
b.Region = &value
return b
}
// WithIdentityEndpoint sets the IdentityEndpoint 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 IdentityEndpoint field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithIdentityEndpoint(value string) *OpenStackSDConfigApplyConfiguration {
b.IdentityEndpoint = &value
return b
}
// WithUsername sets the Username 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 Username field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithUsername(value string) *OpenStackSDConfigApplyConfiguration {
b.Username = &value
return b
}
// WithUserID sets the UserID 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 UserID field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithUserID(value string) *OpenStackSDConfigApplyConfiguration {
b.UserID = &value
return b
}
// WithPassword sets the Password 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 Password field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithPassword(value v1.SecretKeySelector) *OpenStackSDConfigApplyConfiguration {
b.Password = &value
return b
}
// WithDomainName sets the DomainName 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 DomainName field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithDomainName(value string) *OpenStackSDConfigApplyConfiguration {
b.DomainName = &value
return b
}
// WithDomainID sets the DomainID 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 DomainID field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithDomainID(value string) *OpenStackSDConfigApplyConfiguration {
b.DomainID = &value
return b
}
// WithProjectName sets the ProjectName 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 ProjectName field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithProjectName(value string) *OpenStackSDConfigApplyConfiguration {
b.ProjectName = &value
return b
}
// WithProjectID sets the ProjectID 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 ProjectID field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithProjectID(value string) *OpenStackSDConfigApplyConfiguration {
b.ProjectID = &value
return b
}
// WithApplicationCredentialName sets the ApplicationCredentialName 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 ApplicationCredentialName field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithApplicationCredentialName(value string) *OpenStackSDConfigApplyConfiguration {
b.ApplicationCredentialName = &value
return b
}
// WithApplicationCredentialID sets the ApplicationCredentialID 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 ApplicationCredentialID field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithApplicationCredentialID(value string) *OpenStackSDConfigApplyConfiguration {
b.ApplicationCredentialID = &value
return b
}
// WithApplicationCredentialSecret sets the ApplicationCredentialSecret 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 ApplicationCredentialSecret field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithApplicationCredentialSecret(value v1.SecretKeySelector) *OpenStackSDConfigApplyConfiguration {
b.ApplicationCredentialSecret = &value
return b
}
// WithAllTenants sets the AllTenants 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 AllTenants field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithAllTenants(value bool) *OpenStackSDConfigApplyConfiguration {
b.AllTenants = &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 *OpenStackSDConfigApplyConfiguration) WithRefreshInterval(value monitoringv1.Duration) *OpenStackSDConfigApplyConfiguration {
b.RefreshInterval = &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 *OpenStackSDConfigApplyConfiguration) WithPort(value int) *OpenStackSDConfigApplyConfiguration {
b.Port = &value
return b
}
// WithAvailability sets the Availability 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 Availability field is set to the value of the last call.
func (b *OpenStackSDConfigApplyConfiguration) WithAvailability(value string) *OpenStackSDConfigApplyConfiguration {
b.Availability = &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 *OpenStackSDConfigApplyConfiguration) WithTLSConfig(value *applyconfigurationmonitoringv1.SafeTLSConfigApplyConfiguration) *OpenStackSDConfigApplyConfiguration {
b.TLSConfig = value
return b
}

View file

@ -33,6 +33,7 @@ type ScrapeConfigSpecApplyConfiguration struct {
EC2SDConfigs []EC2SDConfigApplyConfiguration `json:"ec2SDConfigs,omitempty"`
AzureSDConfigs []AzureSDConfigApplyConfiguration `json:"azureSDConfigs,omitempty"`
GCESDConfigs []GCESDConfigApplyConfiguration `json:"gceSDConfigs,omitempty"`
OpenStackSDConfigs []OpenStackSDConfigApplyConfiguration `json:"openstackSDConfigs,omitempty"`
RelabelConfigs []*v1.RelabelConfig `json:"relabelings,omitempty"`
MetricsPath *string `json:"metricsPath,omitempty"`
ScrapeInterval *v1.Duration `json:"scrapeInterval,omitempty"`
@ -178,6 +179,19 @@ func (b *ScrapeConfigSpecApplyConfiguration) WithGCESDConfigs(values ...*GCESDCo
return b
}
// WithOpenStackSDConfigs adds the given value to the OpenStackSDConfigs 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 OpenStackSDConfigs field.
func (b *ScrapeConfigSpecApplyConfiguration) WithOpenStackSDConfigs(values ...*OpenStackSDConfigApplyConfiguration) *ScrapeConfigSpecApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOpenStackSDConfigs")
}
b.OpenStackSDConfigs = append(b.OpenStackSDConfigs, *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

@ -235,6 +235,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &monitoringv1alpha1.MSTeamsConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("MuteTimeInterval"):
return &monitoringv1alpha1.MuteTimeIntervalApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("OpenStackSDConfig"):
return &monitoringv1alpha1.OpenStackSDConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("OpsGenieConfig"):
return &monitoringv1alpha1.OpsGenieConfigApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("OpsGenieConfigResponder"):

View file

@ -2746,6 +2746,7 @@ func (cg *ConfigGenerator) generateScrapeConfig(
}
if config.AccessKey != nil && config.SecretKey != nil {
value, err := store.GetKey(ctx, sc.GetNamespace(), monitoringv1.SecretOrConfigMap{
Secret: config.AccessKey,
})
@ -2941,6 +2942,152 @@ func (cg *ConfigGenerator) generateScrapeConfig(
})
}
// OpenStackSDConfig
if len(sc.Spec.OpenStackSDConfigs) > 0 {
configs := make([][]yaml.MapItem, len(sc.Spec.OpenStackSDConfigs))
for i, config := range sc.Spec.OpenStackSDConfigs {
configs[i] = []yaml.MapItem{
{
Key: "role",
Value: strings.ToLower(config.Role),
},
}
configs[i] = append(configs[i], yaml.MapItem{
Key: "region",
Value: config.Region,
})
if config.IdentityEndpoint != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "identity_endpoint",
Value: config.IdentityEndpoint,
})
}
if config.Username != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "username",
Value: config.Username,
})
}
if config.UserID != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "userid",
Value: config.UserID,
})
}
if config.Password != nil {
password, err := store.GetKey(ctx, sc.GetNamespace(), monitoringv1.SecretOrConfigMap{
Secret: config.Password,
})
if err != nil {
return cfg, fmt.Errorf("failed to read %s secret %s: %w", config.Password.Name, jobName, err)
}
configs[i] = append(configs[i], yaml.MapItem{
Key: "password",
Value: password,
})
}
if config.DomainName != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "domain_name",
Value: config.DomainName,
})
}
if config.DomainID != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "domain_id",
Value: config.DomainID,
})
}
if config.ProjectName != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "project_name",
Value: config.ProjectName,
})
}
if config.ProjectID != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "project_id",
Value: config.ProjectID,
})
}
if config.ApplicationCredentialName != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "application_credential_name",
Value: config.ApplicationCredentialName,
})
}
if config.ApplicationCredentialID != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "application_credential_id",
Value: config.ApplicationCredentialID,
})
}
if config.ApplicationCredentialSecret != nil {
secret, err := store.GetKey(ctx, sc.GetNamespace(), monitoringv1.SecretOrConfigMap{
Secret: config.ApplicationCredentialSecret,
})
if err != nil {
return cfg, fmt.Errorf("failed to read %s secret %s: %w", config.ApplicationCredentialSecret.Name, jobName, err)
}
configs[i] = append(configs[i], yaml.MapItem{
Key: "application_credential_secret",
Value: secret,
})
}
if config.AllTenants != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "all_tenants",
Value: config.AllTenants,
})
}
if config.RefreshInterval != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "refresh_interval",
Value: config.RefreshInterval,
})
}
if config.Port != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "port",
Value: config.Port,
})
}
if config.Availability != nil {
configs[i] = append(configs[i], yaml.MapItem{
Key: "availability",
Value: config.Availability,
})
}
if config.TLSConfig != nil {
configs[i] = addSafeTLStoYaml(configs[i], sc.Namespace, *config.TLSConfig)
}
}
cfg = append(cfg, yaml.MapItem{
Key: "openstack_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

@ -5951,6 +5951,116 @@ func TestScrapeConfigSpecConfigWithGCESD(t *testing.T) {
}
}
func TestScrapeConfigSpecConfigWithOpenStackSD(t *testing.T) {
c := fake.NewSimpleClientset(
&v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "openstack-access-secret",
Namespace: "default",
},
Data: map[string][]byte{
"password": []byte("password"),
"applicationCredentialsSecret": []byte("application-credentials"),
},
},
)
for _, tc := range []struct {
name string
scSpec monitoringv1alpha1.ScrapeConfigSpec
golden string
expectedErr bool
}{
{
name: "openstack_sd_config_valid",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
OpenStackSDConfigs: []monitoringv1alpha1.OpenStackSDConfig{
{
Role: "Instance",
Region: "region-1",
IdentityEndpoint: ptr.To("http://identity.example.com:5000/v2.0"),
Username: ptr.To("nova-user-1"),
Password: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "openstack-access-secret",
},
Key: "password",
},
DomainName: ptr.To("devops-project-1"),
RefreshInterval: (*monitoringv1.Duration)(ptr.To("30s")),
Port: ptr.To(9100),
},
},
},
golden: "ScrapeConfigSpecConfig_OpenStackSDConfigValid.golden",
},
{
name: "openstack_sd_config_invalid_secret_ref",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
OpenStackSDConfigs: []monitoringv1alpha1.OpenStackSDConfig{
{
Role: "Instance",
Region: "region-1",
ApplicationCredentialSecret: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "openstack-access-secret",
},
Key: "invalid-key",
},
},
},
},
expectedErr: true,
},
{
name: "openstack_sd_config_empty",
scSpec: monitoringv1alpha1.ScrapeConfigSpec{
OpenStackSDConfigs: []monitoringv1alpha1.OpenStackSDConfig{},
},
golden: "ScrapeConfigSpecConfig_OpenStackSDConfigEmpty.golden",
},
} {
t.Run(tc.name, func(t *testing.T) {
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,
assets.NewStore(c.CoreV1(), c.CoreV1()),
nil,
nil,
nil,
nil,
)
if tc.expectedErr {
require.Error(t, err)
return
}
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

@ -744,6 +744,11 @@ func (rs *ResourceSelector) SelectScrapeConfigs(ctx context.Context, listFn List
continue
}
if err = rs.validateOpenStackSDConfigs(ctx, sc); err != nil {
rejectFn(sc, fmt.Errorf("openstackSDConfigs: %w", err))
continue
}
res[scName] = sc
}
@ -886,3 +891,20 @@ func (rs *ResourceSelector) validateAzureSDConfigs(ctx context.Context, sc *moni
}
return nil
}
func (rs *ResourceSelector) validateOpenStackSDConfigs(ctx context.Context, sc *monitoringv1alpha1.ScrapeConfig) error {
for i, config := range sc.Spec.OpenStackSDConfigs {
if config.Password != nil {
if _, err := rs.store.GetSecretKey(ctx, sc.GetNamespace(), *config.Password); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
}
if config.ApplicationCredentialSecret != nil {
if _, err := rs.store.GetSecretKey(ctx, sc.GetNamespace(), *config.ApplicationCredentialSecret); err != nil {
return fmt.Errorf("[%d]: %w", i, err)
}
}
}
return nil
}

View file

@ -1655,6 +1655,74 @@ func TestSelectScrapeConfigs(t *testing.T) {
},
selected: false,
},
{
scenario: "OpenStack SD config with valid secret ref",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.OpenStackSDConfigs = []monitoringv1alpha1.OpenStackSDConfig{
{
Role: "Instance",
Region: "RegionOne",
Password: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key1",
},
ApplicationCredentialSecret: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key2",
},
},
}
},
selected: true,
},
{
scenario: "OpenStack SD config with invalid secret ref for password",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.OpenStackSDConfigs = []monitoringv1alpha1.OpenStackSDConfig{
{
Password: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "invalid",
},
Key: "key1",
},
},
}
},
selected: false,
},
{
scenario: "OpenStack SD config with invalid secret ref for application credentials",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.OpenStackSDConfigs = []monitoringv1alpha1.OpenStackSDConfig{
{
ApplicationCredentialSecret: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: "secret",
},
Key: "key3",
},
},
}
},
selected: false,
},
{
scenario: "OpenStack SD config with no secret ref provided",
updateSpec: func(sc *monitoringv1alpha1.ScrapeConfigSpec) {
sc.OpenStackSDConfigs = []monitoringv1alpha1.OpenStackSDConfig{
{
Role: "hypervisor",
Region: "RegionTwo",
},
}
},
selected: true,
},
} {
t.Run(tc.scenario, func(t *testing.T) {
cs := fake.NewSimpleClientset(

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

View file

@ -0,0 +1,17 @@
global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: default/test
prometheus_replica: $(POD_NAME)
scrape_configs:
- job_name: scrapeConfig/default/testscrapeconfig1
openstack_sd_configs:
- role: instance
region: region-1
identity_endpoint: http://identity.example.com:5000/v2.0
username: nova-user-1
password: password
domain_name: devops-project-1
refresh_interval: 30s
port: 9100