Skip to content

Commit a99de28

Browse files
committed
Bring back service monitor config properties
1 parent fe8db29 commit a99de28

File tree

2 files changed

+49
-13
lines changed

2 files changed

+49
-13
lines changed

api/v1/coherence_types.go

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,10 +1514,22 @@ type ServiceMonitorSpec struct {
15141514
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
15151515
// +optional
15161516
ScrapeTimeout monitoringv1.Duration `json:"scrapeTimeout,omitempty"`
1517+
// TLS configuration to use when scraping the endpoint
1518+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
1519+
// +optional
1520+
TLSConfig *monitoringv1.TLSConfig `json:"tlsConfig,omitempty"`
15171521
// File to read bearer token for scraping targets.
1522+
//
15181523
// Deprecated: use `authorization` instead.
15191524
// +optional
15201525
BearerTokenFile string `json:"bearerTokenFile,omitempty"`
1526+
// Secret to mount to read bearer token for scraping targets. The secret
1527+
// needs to be in the same namespace as the service monitor and accessible by
1528+
// the Prometheus Operator.
1529+
//
1530+
// Deprecated: use `authorization` instead.
1531+
// +optional
1532+
BearerTokenSecret *corev1.SecretKeySelector `json:"bearerTokenSecret,omitempty"`
15211533
// `authorization` configures the Authorization header credentials to use when
15221534
// scraping the target.
15231535
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
@@ -1534,6 +1546,11 @@ type ServiceMonitorSpec struct {
15341546
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
15351547
// +optional
15361548
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
1549+
// BasicAuth allow an endpoint to authenticate over basic authentication
1550+
// More info: https://prometheus.io/docs/operating/configuration/#endpoints
1551+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
1552+
// +optional
1553+
BasicAuth *monitoringv1.BasicAuth `json:"basicAuth,omitempty"`
15371554
// MetricRelabelings to apply to samples before ingestion.
15381555
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
15391556
// +listType=atomic
@@ -1545,8 +1562,10 @@ type ServiceMonitorSpec struct {
15451562
// +listType=atomic
15461563
// +optional
15471564
Relabelings []monitoringv1.RelabelConfig `json:"relabelings,omitempty"`
1548-
1549-
monitoringv1.HTTPConfigWithProxyAndTLSFiles `json:",inline"`
1565+
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
1566+
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
1567+
// +optional
1568+
ProxyURL *string `json:"proxyURL,omitempty"`
15501569
}
15511570

15521571
func (in *ServiceMonitorSpec) CreateServiceMonitor() monitoringv1.ServiceMonitorSpec {
@@ -1568,17 +1587,29 @@ func (in *ServiceMonitorSpec) CreateEndpoint() monitoringv1.Endpoint {
15681587
}
15691588

15701589
return monitoringv1.Endpoint{
1571-
Path: in.Path,
1572-
Scheme: in.Scheme,
1573-
Params: in.Params,
1574-
Interval: in.Interval,
1575-
ScrapeTimeout: in.ScrapeTimeout,
1576-
BearerTokenFile: in.BearerTokenFile,
1577-
HonorLabels: in.HonorLabels,
1578-
HonorTimestamps: in.HonorTimestamps,
1579-
MetricRelabelConfigs: in.MetricRelabelings,
1580-
RelabelConfigs: in.Relabelings,
1581-
HTTPConfigWithProxyAndTLSFiles: in.HTTPConfigWithProxyAndTLSFiles,
1590+
Path: in.Path,
1591+
Scheme: in.Scheme,
1592+
Params: in.Params,
1593+
Interval: in.Interval,
1594+
ScrapeTimeout: in.ScrapeTimeout,
1595+
BearerTokenFile: in.BearerTokenFile,
1596+
HonorLabels: in.HonorLabels,
1597+
HonorTimestamps: in.HonorTimestamps,
1598+
MetricRelabelConfigs: in.MetricRelabelings,
1599+
RelabelConfigs: in.Relabelings,
1600+
HTTPConfigWithProxyAndTLSFiles: monitoringv1.HTTPConfigWithProxyAndTLSFiles{
1601+
HTTPConfigWithTLSFiles: monitoringv1.HTTPConfigWithTLSFiles{
1602+
TLSConfig: in.TLSConfig,
1603+
HTTPConfigWithoutTLS: monitoringv1.HTTPConfigWithoutTLS{
1604+
Authorization: in.Authorization,
1605+
BasicAuth: in.BasicAuth,
1606+
BearerTokenSecret: in.BearerTokenSecret,
1607+
},
1608+
},
1609+
ProxyConfig: monitoringv1.ProxyConfig{
1610+
ProxyURL: in.ProxyURL,
1611+
},
1612+
},
15821613
}
15831614
}
15841615

@@ -2058,6 +2089,7 @@ type ServiceSpec struct {
20582089
// +optional
20592090
ClusterIPs []string `json:"clusterIPs,omitempty"`
20602091
// LoadBalancerIP is the IP address of the load balancer
2092+
//
20612093
// Deprecated: This field is deprecated in the Kubernetes API.
20622094
// +optional
20632095
LoadBalancerIP *string `json:"loadBalancerIP,omitempty"`

docs/about/04_coherence_spec.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,14 +1004,18 @@ m| scheme | HTTP scheme to use for scraping. See https://github.com/prometheus-o
10041004
m| params | Optional HTTP URL parameters See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| map[string][]string | false
10051005
m| interval | Interval at which metrics should be scraped See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| monitoringv1.Duration | false
10061006
m| scrapeTimeout | Timeout after which the scrape is ended See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| monitoringv1.Duration | false
1007+
m| tlsConfig | TLS configuration to use when scraping the endpoint See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| *monitoringv1.TLSConfig | false
10071008
m| bearerTokenFile | File to read bearer token for scraping targets. Deprecated: use `authorization` instead. m| string | false
1009+
m| bearerTokenSecret | Secret to mount to read bearer token for scraping targets. The secret needs to be in the same namespace as the service monitor and accessible by the Prometheus Operator. Deprecated: use `authorization` instead. m| *https://{k8s-doc-link}/#secretkeyselector-v1-core[corev1.SecretKeySelector] | false
10081010
m| authorization | `authorization` configures the Authorization header credentials to use when scraping the target. See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint +
10091011
+
10101012
Cannot be set at the same time as `basicAuth`, or `oauth2`. m| *monitoringv1.SafeAuthorization | false
10111013
m| honorLabels | HonorLabels chooses the metric labels on collisions with target labels. See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| bool | false
10121014
m| honorTimestamps | HonorTimestamps controls whether Prometheus respects the timestamps present in scraped data. See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| *bool | false
1015+
m| basicAuth | BasicAuth allow an endpoint to authenticate over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| *monitoringv1.BasicAuth | false
10131016
m| metricRelabelings | MetricRelabelings to apply to samples before ingestion. See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| []monitoringv1.RelabelConfig | false
10141017
m| relabelings | Relabelings to apply to samples before scraping. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| []monitoringv1.RelabelConfig | false
1018+
m| proxyURL | ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint. See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint m| *string | false
10151019
|===
10161020
10171021
<<Table of Contents,Back to TOC>>

0 commit comments

Comments
 (0)