Skip to content

Commit 57249f5

Browse files
committed
Update ServiceMonitorSpec for compatibility with the latest Prometheus Operator changes
1 parent 8ff6592 commit 57249f5

File tree

4 files changed

+89
-42
lines changed

4 files changed

+89
-42
lines changed

api/v1/coherence_types.go

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
2+
* Copyright (c) 2020, 2026, Oracle and/or its affiliates.
33
* Licensed under the Universal Permissive License v 1.0 as shown at
44
* http://oss.oracle.com/licenses/upl.
55
*/
@@ -1514,20 +1514,10 @@ 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"`
15211517
// File to read bearer token for scraping targets.
15221518
// Deprecated: use `authorization` instead.
15231519
// +optional
15241520
BearerTokenFile string `json:"bearerTokenFile,omitempty"`
1525-
// Secret to mount to read bearer token for scraping targets. The secret
1526-
// needs to be in the same namespace as the service monitor and accessible by
1527-
// the Prometheus Operator.
1528-
// Deprecated: use `authorization` instead.
1529-
// +optional
1530-
BearerTokenSecret *corev1.SecretKeySelector `json:"bearerTokenSecret,omitempty"`
15311521
// `authorization` configures the Authorization header credentials to use when
15321522
// scraping the target.
15331523
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
@@ -1544,11 +1534,6 @@ type ServiceMonitorSpec struct {
15441534
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
15451535
// +optional
15461536
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
1547-
// BasicAuth allow an endpoint to authenticate over basic authentication
1548-
// More info: https://prometheus.io/docs/operating/configuration/#endpoints
1549-
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
1550-
// +optional
1551-
BasicAuth *monitoringv1.BasicAuth `json:"basicAuth,omitempty"`
15521537
// MetricRelabelings to apply to samples before ingestion.
15531538
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
15541539
// +listType=atomic
@@ -1560,10 +1545,11 @@ type ServiceMonitorSpec struct {
15601545
// +listType=atomic
15611546
// +optional
15621547
Relabelings []monitoringv1.RelabelConfig `json:"relabelings,omitempty"`
1563-
// ProxyURL eg http://proxyserver:2195 Directs scrapes to proxy through this endpoint.
1564-
// See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api-reference/api.md#endpoint
1565-
// +optional
1566-
ProxyURL *string `json:"proxyURL,omitempty"`
1548+
// TODO: VP
1549+
// HTTPConfigWithProxyAndTLSFiles defines the configuration for the HTTP client
1550+
// with proxy configuration and TLS configuration. It is used for
1551+
// ServiceMonitor endpoints.
1552+
HTTPConfigWithProxyAndTLSFiles monitoringv1.HTTPConfigWithProxyAndTLSFiles `json:",inline"`
15671553
}
15681554

15691555
func (in *ServiceMonitorSpec) CreateServiceMonitor() monitoringv1.ServiceMonitorSpec {
@@ -1585,22 +1571,17 @@ func (in *ServiceMonitorSpec) CreateEndpoint() monitoringv1.Endpoint {
15851571
}
15861572

15871573
return monitoringv1.Endpoint{
1588-
Path: in.Path,
1589-
Scheme: in.Scheme,
1590-
Params: in.Params,
1591-
Interval: in.Interval,
1592-
ScrapeTimeout: in.ScrapeTimeout,
1593-
TLSConfig: in.TLSConfig,
1594-
BearerTokenFile: in.BearerTokenFile,
1595-
BearerTokenSecret: in.BearerTokenSecret,
1596-
HonorLabels: in.HonorLabels,
1597-
HonorTimestamps: in.HonorTimestamps,
1598-
BasicAuth: in.BasicAuth,
1599-
MetricRelabelConfigs: in.MetricRelabelings,
1600-
RelabelConfigs: in.Relabelings,
1601-
ProxyConfig: monitoringv1.ProxyConfig{
1602-
ProxyURL: in.ProxyURL,
1603-
},
1574+
Path: in.Path,
1575+
Scheme: in.Scheme,
1576+
Params: in.Params,
1577+
Interval: in.Interval,
1578+
ScrapeTimeout: in.ScrapeTimeout,
1579+
BearerTokenFile: in.BearerTokenFile,
1580+
HonorLabels: in.HonorLabels,
1581+
HonorTimestamps: in.HonorTimestamps,
1582+
MetricRelabelConfigs: in.MetricRelabelings,
1583+
RelabelConfigs: in.Relabelings,
1584+
HTTPConfigWithProxyAndTLSFiles: in.HTTPConfigWithProxyAndTLSFiles,
16041585
}
16051586
}
16061587

docs/about/04_coherence_spec.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,18 +1004,14 @@ 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
10081007
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
10101008
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 +
10111009
+
10121010
Cannot be set at the same time as `basicAuth`, or `oauth2`. m| *monitoringv1.SafeAuthorization | false
10131011
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
10141012
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
10161013
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
10171014
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
10191015
|===
10201016
10211017
<<Table of Contents,Back to TOC>>

go.mod

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ require (
1717
github.com/go-test/deep v1.1.1
1818
github.com/onsi/gomega v1.39.0
1919
github.com/pkg/errors v0.9.1
20-
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.87.1
21-
github.com/prometheus-operator/prometheus-operator/pkg/client v0.87.1
20+
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.88.0
21+
github.com/prometheus-operator/prometheus-operator/pkg/client v0.88.0
2222
github.com/spf13/cobra v1.10.2
2323
github.com/spf13/pflag v1.0.10
2424
github.com/spf13/viper v1.21.0
@@ -35,11 +35,14 @@ require (
3535

3636
require (
3737
cel.dev/expr v0.25.1 // indirect
38+
github.com/NYTimes/gziphandler v1.1.1 // indirect
3839
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
3940
github.com/beorn7/perks v1.0.1 // indirect
4041
github.com/blang/semver/v4 v4.0.0 // indirect
4142
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
4243
github.com/cespare/xxhash/v2 v2.3.0 // indirect
44+
github.com/coreos/go-semver v0.3.1 // indirect
45+
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
4346
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
4447
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
4548
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
@@ -62,15 +65,19 @@ require (
6265
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
6366
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
6467
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
68+
github.com/gogo/protobuf v1.3.2 // indirect
69+
github.com/golang/protobuf v1.5.4 // indirect
6570
github.com/google/btree v1.1.3 // indirect
6671
github.com/google/cel-go v0.26.1 // indirect
6772
github.com/google/gnostic-models v0.7.1 // indirect
6873
github.com/google/go-cmp v0.7.0 // indirect
6974
github.com/google/uuid v1.6.0 // indirect
7075
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
76+
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
7177
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.5 // indirect
7278
github.com/inconshreveable/mousetrap v1.1.0 // indirect
7379
github.com/json-iterator/go v1.1.12 // indirect
80+
github.com/kylelemons/godebug v1.1.0 // indirect
7481
github.com/moby/spdystream v0.5.0 // indirect
7582
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
7683
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
@@ -88,7 +95,11 @@ require (
8895
github.com/stoewer/go-strcase v1.3.1 // indirect
8996
github.com/subosito/gotenv v1.6.0 // indirect
9097
github.com/x448/float16 v0.8.4 // indirect
98+
go.etcd.io/etcd/api/v3 v3.6.7 // indirect
99+
go.etcd.io/etcd/client/pkg/v3 v3.6.7 // indirect
100+
go.etcd.io/etcd/client/v3 v3.6.7 // indirect
91101
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
102+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.64.0 // indirect
92103
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.64.0 // indirect
93104
go.opentelemetry.io/otel v1.39.0 // indirect
94105
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
@@ -101,6 +112,7 @@ require (
101112
go.uber.org/zap v1.27.1 // indirect
102113
go.yaml.in/yaml/v2 v2.4.3 // indirect
103114
go.yaml.in/yaml/v3 v3.0.4 // indirect
115+
golang.org/x/crypto v0.47.0 // indirect
104116
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect
105117
golang.org/x/net v0.49.0 // indirect
106118
golang.org/x/oauth2 v0.34.0 // indirect
@@ -116,11 +128,13 @@ require (
116128
google.golang.org/protobuf v1.36.11 // indirect
117129
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
118130
gopkg.in/inf.v0 v0.9.1 // indirect
131+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
119132
gopkg.in/yaml.v2 v2.4.0 // indirect
120133
gopkg.in/yaml.v3 v3.0.1 // indirect
121134
k8s.io/apiserver v0.35.0 // indirect
122135
k8s.io/component-base v0.35.0 // indirect
123136
k8s.io/klog/v2 v2.130.1 // indirect
137+
k8s.io/kms v0.35.0 // indirect
124138
k8s.io/kube-openapi v0.0.0-20251125145642-4e65d59e963e // indirect
125139
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect
126140
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect

0 commit comments

Comments
 (0)