Skip to content

Commit df33bbc

Browse files
authored
Merge pull request #697 from Ankit152/obo-fix
Fixing rhobs dependency and inline parameter issues
2 parents 0c4c9f2 + 7a1150b commit df33bbc

6 files changed

Lines changed: 122 additions & 64 deletions

File tree

controllers/addon/monitoring_federation_reconciler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func (r *monitoringFederationReconciler) ensureDeletionOfUnwantedMonitoringFeder
323323
continue
324324
}
325325

326-
if err := client.IgnoreNotFound(r.client.Delete(ctx, serviceMonitor)); err != nil {
326+
if err := client.IgnoreNotFound(r.client.Delete(ctx, &serviceMonitor)); err != nil {
327327
return fmt.Errorf("could not remove monitoring federation ServiceMonitor: %w", err)
328328
}
329329
if err := client.IgnoreNotFound(r.client.Delete(ctx, &corev1.Secret{
@@ -350,7 +350,7 @@ func (r *monitoringFederationReconciler) ensureDeletionOfUnwantedMonitoringFeder
350350
func (r *monitoringFederationReconciler) getOwnedServiceMonitorsViaCommonLabels(
351351
ctx context.Context,
352352
c client.Client,
353-
addon *addonsv1alpha1.Addon) ([]*monitoringv1.ServiceMonitor, error) {
353+
addon *addonsv1alpha1.Addon) ([]monitoringv1.ServiceMonitor, error) {
354354
selector := controllers.CommonLabelsAsLabelSelector(addon)
355355

356356
list := &monitoringv1.ServiceMonitorList{}

controllers/addon/monitoring_federation_reconciler_test.go

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -324,31 +324,51 @@ func TestEnsureMonitoringFederation_MonitoringPresentInSpec_SMPresentInCluster(t
324324
controllers.AddCommonLabels(serviceMonitor, addon)
325325
err := controllerutil.SetControllerReference(addon, serviceMonitor, r.scheme)
326326
assert.NoError(t, err)
327+
328+
var scheme monitoringv1.Scheme
329+
scheme = "https"
327330
// inject expected ServiceMonitor spec into response
328331
serviceMonitor.Spec = monitoringv1.ServiceMonitorSpec{
329332
Endpoints: []monitoringv1.Endpoint{
330333
{
331-
Authorization: &monitoringv1.SafeAuthorization{Type: "Bearer", Credentials: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: "addon-foo-bearertoken-secret"}, Key: "token"}},
332-
HonorLabels: true,
333-
Port: "portName",
334-
Path: "/federate",
335-
Scheme: "https",
334+
HTTPConfigWithProxyAndTLSFiles: monitoringv1.HTTPConfigWithProxyAndTLSFiles{
335+
HTTPConfigWithTLSFiles: monitoringv1.HTTPConfigWithTLSFiles{
336+
HTTPConfigWithoutTLS: monitoringv1.HTTPConfigWithoutTLS{
337+
Authorization: &monitoringv1.SafeAuthorization{
338+
Type: "Bearer",
339+
Credentials: &corev1.SecretKeySelector{
340+
LocalObjectReference: corev1.LocalObjectReference{
341+
Name: "addon-foo-bearertoken-secret",
342+
},
343+
Key: "token",
344+
},
345+
},
346+
},
347+
TLSConfig: &monitoringv1.TLSConfig{
348+
TLSFilesConfig: monitoringv1.TLSFilesConfig{
349+
CAFile: "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt",
350+
},
351+
SafeTLSConfig: monitoringv1.SafeTLSConfig{
352+
ServerName: ptr.To(fmt.Sprintf(
353+
"prometheus.%s.svc",
354+
addon.Spec.Monitoring.Federation.Namespace,
355+
)),
356+
},
357+
},
358+
},
359+
},
360+
361+
HonorLabels: true,
362+
Port: "portName",
363+
Path: "/federate",
364+
Scheme: &scheme,
336365
Params: map[string][]string{
337366
"match[]": {
338367
`ALERTS{alertstate="firing"}`,
339368
`{__name__="foo"}`,
340369
},
341370
},
342371
Interval: "30s",
343-
TLSConfig: &monitoringv1.TLSConfig{
344-
CAFile: "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt",
345-
SafeTLSConfig: monitoringv1.SafeTLSConfig{
346-
ServerName: ptr.To(fmt.Sprintf(
347-
"prometheus.%s.svc",
348-
addon.Spec.Monitoring.Federation.Namespace,
349-
)),
350-
},
351-
},
352372
},
353373
},
354374
NamespaceSelector: monitoringv1.NamespaceSelector{
@@ -592,7 +612,7 @@ func TestEnsureDeletionOfMonitoringFederation_MonitoringFullyMissingInSpec_Prese
592612
addon := testutil.NewTestAddonWithoutNamespace()
593613

594614
serviceMonitorsInCluster := &monitoringv1.ServiceMonitorList{
595-
Items: []*monitoringv1.ServiceMonitor{
615+
Items: []monitoringv1.ServiceMonitor{
596616
{
597617
ObjectMeta: metav1.ObjectMeta{
598618
Name: "foo",
@@ -667,11 +687,11 @@ func TestEnsureDeletionOfMonitoringFederation_MonitoringFullyPresentInSpec_Prese
667687
addon := testutil.NewTestAddonWithMonitoringFederation()
668688

669689
serviceMonitorsInCluster := &monitoringv1.ServiceMonitorList{
670-
Items: []*monitoringv1.ServiceMonitor{
671-
testServiceMonitor(addon),
690+
Items: []monitoringv1.ServiceMonitor{
691+
*testServiceMonitor(addon),
672692
},
673693
}
674-
controllers.AddCommonLabels(serviceMonitorsInCluster.Items[0], addon)
694+
controllers.AddCommonLabels(&serviceMonitorsInCluster.Items[0], addon)
675695

676696
c.On("List", testutil.IsContext, mock.IsType(&monitoringv1.ServiceMonitorList{}), mock.Anything).
677697
Run(func(args mock.Arguments) {

controllers/addon/utils.go

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,9 @@ func GetMonitoringFederationServiceMonitorEndpoints(addon *addonsv1alpha1.Addon,
494494
const cacert = "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt"
495495

496496
tlsConfig := &monitoringv1.TLSConfig{
497-
CAFile: cacert,
497+
TLSFilesConfig: monitoringv1.TLSFilesConfig{
498+
CAFile: cacert,
499+
},
498500
SafeTLSConfig: monitoringv1.SafeTLSConfig{
499501
ServerName: ptr.To(fmt.Sprintf("prometheus.%s.svc", addon.Spec.Monitoring.Federation.Namespace)),
500502
},
@@ -507,15 +509,24 @@ func GetMonitoringFederationServiceMonitorEndpoints(addon *addonsv1alpha1.Addon,
507509
}
508510
auth := &monitoringv1.SafeAuthorization{Type: "Bearer", Credentials: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: bearertokensecret.Name}, Key: "token"}}
509511

512+
var scheme monitoringv1.Scheme
513+
scheme = "https"
514+
510515
return []monitoringv1.Endpoint{{
511-
Authorization: auth,
512-
HonorLabels: true,
513-
Port: addon.Spec.Monitoring.Federation.PortName,
514-
Path: "/federate",
515-
Scheme: "https",
516-
Interval: "30s",
517-
TLSConfig: tlsConfig,
518-
Params: map[string][]string{"match[]": matchParams},
516+
HTTPConfigWithProxyAndTLSFiles: monitoringv1.HTTPConfigWithProxyAndTLSFiles{
517+
HTTPConfigWithTLSFiles: monitoringv1.HTTPConfigWithTLSFiles{
518+
HTTPConfigWithoutTLS: monitoringv1.HTTPConfigWithoutTLS{
519+
Authorization: auth,
520+
},
521+
TLSConfig: tlsConfig,
522+
},
523+
},
524+
HonorLabels: true,
525+
Port: addon.Spec.Monitoring.Federation.PortName,
526+
Path: "/federate",
527+
Scheme: &scheme,
528+
Interval: "30s",
529+
Params: map[string][]string{"match[]": matchParams},
519530
}}
520531
}
521532

go.mod

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ require (
1414
github.com/mt-sre/devkube v0.7.1
1515
github.com/novln/docker-parser v1.0.0
1616
github.com/openshift/addon-operator/apis v0.0.0-20231110045543-dd01f2f5c184
17-
github.com/openshift/api v0.0.0-20260224223200-1105fd4ecddf
17+
github.com/openshift/api v3.9.0+incompatible
1818
github.com/operator-framework/api v0.40.0
19-
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0
19+
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.89.0
2020
github.com/prometheus/client_golang v1.23.2
2121
github.com/prometheus/client_model v0.6.2
2222
github.com/prometheus/common v0.67.5
2323
github.com/prometheus/prometheus v1.8.2-0.20211105201321-411021ada9ab
24-
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.75.2-rhobs1
25-
github.com/rhobs/observability-operator v0.4.0
24+
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.89.0-rhobs1
25+
github.com/rhobs/observability-operator/pkg/apis v0.0.0-20251009091129-76135c924ed6
2626
github.com/sethvargo/go-retry v0.3.0
2727
github.com/stretchr/testify v1.11.1
2828
k8s.io/api v0.35.1
@@ -49,10 +49,11 @@ require (
4949
github.com/cespare/xxhash/v2 v2.3.0 // indirect
5050
github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f // indirect
5151
github.com/dennwc/varint v1.0.0 // indirect
52+
github.com/edsrzf/mmap-go v1.2.0 // indirect
5253
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
5354
github.com/envoyproxy/go-control-plane/envoy v1.35.0 // indirect
5455
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
55-
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
56+
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
5657
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
5758
github.com/fsnotify/fsnotify v1.9.0 // indirect
5859
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -86,7 +87,9 @@ require (
8687
github.com/jpillora/backoff v1.0.0 // indirect
8788
github.com/json-iterator/go v1.1.12 // indirect
8889
github.com/kylelemons/godebug v1.1.0 // indirect
90+
github.com/mattn/go-colorable v0.1.14 // indirect
8991
github.com/mattn/go-isatty v0.0.20 // indirect
92+
github.com/mitchellh/mapstructure v1.5.0 // indirect
9093
github.com/moby/spdystream v0.5.0 // indirect
9194
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
9295
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
@@ -117,7 +120,7 @@ require (
117120
golang.org/x/term v0.39.0 // indirect
118121
golang.org/x/text v0.33.0 // indirect
119122
golang.org/x/time v0.14.0 // indirect
120-
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
123+
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
121124
google.golang.org/genproto/googleapis/api v0.0.0-20260202165425-ce8ad4cf556b // indirect
122125
google.golang.org/genproto/googleapis/rpc v0.0.0-20260202165425-ce8ad4cf556b // indirect
123126
google.golang.org/protobuf v1.36.11 // indirect
@@ -130,3 +133,5 @@ require (
130133
sigs.k8s.io/randfill v1.0.0 // indirect
131134
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
132135
)
136+
137+
replace github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20260225105806-8713f3f64bcf

go.sum

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1
404404
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
405405
github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts=
406406
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
407-
github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ=
408-
github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q=
407+
github.com/edsrzf/mmap-go v1.2.0 h1:hXLYlkbaPzt1SaQk+anYwKSRNhufIDCchSPkUD6dD84=
408+
github.com/edsrzf/mmap-go v1.2.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q=
409409
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
410410
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
411411
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
@@ -430,8 +430,8 @@ github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2T
430430
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
431431
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
432432
github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
433-
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
434-
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
433+
github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls=
434+
github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
435435
github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU=
436436
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
437437
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
@@ -1001,8 +1001,9 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
10011001
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
10021002
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
10031003
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
1004-
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
10051004
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
1005+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
1006+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
10061007
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
10071008
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
10081009
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@@ -1144,8 +1145,8 @@ github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqi
11441145
github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo=
11451146
github.com/openshift/addon-operator/apis v0.0.0-20231110045543-dd01f2f5c184 h1:P93o33VcHaOTjOTm6/UojtJdr1qLc2U7vPMBno39rdc=
11461147
github.com/openshift/addon-operator/apis v0.0.0-20231110045543-dd01f2f5c184/go.mod h1:JS2tbakhIZRgBiULsIUSHGsdz7G/Vylvg1mqI1TlXzs=
1147-
github.com/openshift/api v0.0.0-20260224223200-1105fd4ecddf h1:SFNdep5KzLfujA4ZwNb5tSns3rNb3fy2B2bVnCNYH5M=
1148-
github.com/openshift/api v0.0.0-20260224223200-1105fd4ecddf/go.mod h1:ZYAxo9t1AALeEotN07tNzIvqqqWSxcZIqMUKnY/xCeQ=
1148+
github.com/openshift/api v0.0.0-20260225105806-8713f3f64bcf h1:k7GwOMUZcKWhy80OtDCiu6Dq0Uklr7OopipwnPAKHUk=
1149+
github.com/openshift/api v0.0.0-20260225105806-8713f3f64bcf/go.mod h1:ZYAxo9t1AALeEotN07tNzIvqqqWSxcZIqMUKnY/xCeQ=
11491150
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
11501151
github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w=
11511152
github.com/opentracing-contrib/go-stdlib v1.0.0 h1:TBS7YuVotp8myLon4Pv7BtCBzOTo1DeZCld0Z63mW2w=
@@ -1196,8 +1197,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH
11961197
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
11971198
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
11981199
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
1199-
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0 h1:tRwEFYFg+To2TGnibGl8dHBCh8Z/BVNKnXj2O5Za/2M=
1200-
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.76.0/go.mod h1:Rd8YnCqz+2FYsiGmE2DMlaLjQRB4v2jFNnzCt9YY4IM=
1200+
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.89.0 h1:nZ9Ov2SbA8pWcyWKpf6AbQipG5Negg5CfDKWOEtnnwc=
1201+
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.89.0/go.mod h1:IJwk1oNs212afqGbNnE84GAB95OHtJR/BuI1rKESiYk=
12011202
github.com/prometheus/alertmanager v0.20.0/go.mod h1:9g2i48FAyZW6BtbsnvHtMHQXl2aVtrORKwKVCQ+nbrg=
12021203
github.com/prometheus/alertmanager v0.23.0/go.mod h1:0MLTrjQI8EuVmvykEhcfr/7X0xmaDAZrqMgxIq3OXHk=
12031204
github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -1263,10 +1264,10 @@ github.com/prometheus/prometheus v1.8.2-0.20211105201321-411021ada9ab/go.mod h1:
12631264
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
12641265
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
12651266
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
1266-
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.75.2-rhobs1 h1:y9Cmq1S26FSVKJKY5fwQ7rG8JyLnFKKa2KpQJReOOWw=
1267-
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.75.2-rhobs1/go.mod h1:iFg19KNtxmInR5wz2wKHE6jXoPdfjPqgKS2OO64gs9k=
1268-
github.com/rhobs/observability-operator v0.4.0 h1:V/vTuKq1T4NmjaPqJgEqdzcbzXLCitXanMA12YwwqjA=
1269-
github.com/rhobs/observability-operator v0.4.0/go.mod h1:LZyHiQUqJEP711/dNLnsCUVrto82YU7GxgY4bCz7T4Q=
1267+
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.89.0-rhobs1 h1:e2ZFNrG7m7YE7SQCI0Ic/6rhEH8NCBEylA6+kpJQLWg=
1268+
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.89.0-rhobs1/go.mod h1:n3FXshd/fzRA5gzdmNQFI2td0KZ5GRj5RRZghYPNHvw=
1269+
github.com/rhobs/observability-operator/pkg/apis v0.0.0-20251009091129-76135c924ed6 h1:f+J6l48RMDomN9YrDxd0cZVo7+L+a/TCzH6ycat5tMI=
1270+
github.com/rhobs/observability-operator/pkg/apis v0.0.0-20251009091129-76135c924ed6/go.mod h1:bNP815/mCv8ydNQ2Q3a9gqlx9b2XouWa6hws9vthq78=
12701271
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
12711272
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
12721273
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
@@ -1901,8 +1902,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
19011902
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
19021903
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
19031904
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1904-
gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw=
1905-
gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
1905+
gomodules.xyz/jsonpatch/v2 v2.5.0 h1:JELs8RLM12qJGXU4u/TO3V25KW8GreMKl9pdkk14RM0=
1906+
gomodules.xyz/jsonpatch/v2 v2.5.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY=
19061907
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
19071908
gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
19081909
gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU=

integration/monitoring_federation_test.go

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,30 +227,51 @@ func validateMonitoringFederationServiceMonitor(t *testing.T, ctx context.Contex
227227
Namespace: monitoringNamespaceName,
228228
}, currentServiceMonitor)
229229
require.NoError(t, err, "could not get monitoring federation ServiceMonitor %s", serviceMonitorName)
230+
231+
var scheme monitoringv1.Scheme
232+
scheme = "https"
233+
230234
assert.Equal(t, monitoringv1.ServiceMonitorSpec{
231235
Endpoints: []monitoringv1.Endpoint{
232236
{
233-
Authorization: &monitoringv1.SafeAuthorization{Type: "Bearer", Credentials: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: fmt.Sprintf("%s-bearertoken-secret", addon.Name)}, Key: "token"}},
234-
HonorLabels: true,
235-
Port: "https",
236-
Path: "/federate",
237-
Scheme: "https",
237+
HTTPConfigWithProxyAndTLSFiles: monitoringv1.HTTPConfigWithProxyAndTLSFiles{
238+
HTTPConfigWithTLSFiles: monitoringv1.HTTPConfigWithTLSFiles{
239+
HTTPConfigWithoutTLS: monitoringv1.HTTPConfigWithoutTLS{
240+
Authorization: &monitoringv1.SafeAuthorization{
241+
Type: "Bearer",
242+
Credentials: &corev1.SecretKeySelector{
243+
LocalObjectReference: corev1.LocalObjectReference{
244+
Name: fmt.Sprintf("%s-bearertoken-secret", addon.Name),
245+
},
246+
Key: "token",
247+
},
248+
},
249+
},
250+
TLSConfig: &monitoringv1.TLSConfig{
251+
TLSFilesConfig: monitoringv1.TLSFilesConfig{
252+
CAFile: "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt",
253+
},
254+
SafeTLSConfig: monitoringv1.SafeTLSConfig{
255+
ServerName: ptr.To(fmt.Sprintf(
256+
"prometheus.%s.svc",
257+
addon.Spec.Monitoring.Federation.Namespace,
258+
)),
259+
},
260+
},
261+
},
262+
},
263+
264+
HonorLabels: true,
265+
Port: "https",
266+
Path: "/federate",
267+
Scheme: &scheme,
238268
Params: map[string][]string{
239269
"match[]": {
240270
`ALERTS{alertstate="firing"}`,
241271
`{__name__="some_timeseries"}`,
242272
},
243273
},
244274
Interval: "30s",
245-
TLSConfig: &monitoringv1.TLSConfig{
246-
CAFile: "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt",
247-
SafeTLSConfig: monitoringv1.SafeTLSConfig{
248-
ServerName: ptr.To(fmt.Sprintf(
249-
"prometheus.%s.svc",
250-
addon.Spec.Monitoring.Federation.Namespace,
251-
)),
252-
},
253-
},
254275
},
255276
},
256277
NamespaceSelector: monitoringv1.NamespaceSelector{

0 commit comments

Comments
 (0)