Skip to content

Commit 954304f

Browse files
committed
fix prom api breaking changes
1 parent fd32f75 commit 954304f

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

internal/controller/consoleplugin/consoleplugin_objects.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (b *builder) serviceMonitor() *monitoringv1.ServiceMonitor {
125125
{
126126
Port: metricsPortName,
127127
Interval: "15s",
128-
Scheme: "https",
128+
Scheme: ptr.To(monitoringv1.SchemeHTTPS),
129129
TLSConfig: &monitoringv1.TLSConfig{
130130
SafeTLSConfig: monitoringv1.SafeTLSConfig{
131131
ServerName: ptr.To(serverName),

internal/controller/ebpf/agent_metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (c *AgentController) promServiceMonitoring(target *flowslatest.FlowCollecto
104104
{
105105
Port: "metrics",
106106
Interval: "30s",
107-
Scheme: scheme,
107+
Scheme: &scheme,
108108
TLSConfig: smTLS,
109109
},
110110
},

internal/controller/flp/flp_common_objects.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func serviceMonitor(desired *flowslatest.FlowCollectorSpec, smName, svcName, nam
359359
{
360360
Port: prometheusPortName,
361361
Interval: "15s",
362-
Scheme: scheme,
362+
Scheme: &scheme,
363363
TLSConfig: smTLS,
364364
HonorLabels: true,
365365
// Relabel for Thanos multi-tenant endpoint, which requires having the namespace label

internal/controller/flp/flp_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/netobserv/network-observability-operator/internal/pkg/helper"
1616
"github.com/netobserv/network-observability-operator/internal/pkg/manager/status"
1717
"github.com/netobserv/network-observability-operator/internal/pkg/metrics/alerts"
18+
v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
1819

1920
"github.com/stretchr/testify/assert"
2021
appsv1 "k8s.io/api/apps/v1"
@@ -555,7 +556,7 @@ func TestServiceMonitorChanged(t *testing.T) {
555556
// Check scheme changed
556557
b, _ = newMonolithBuilder(info.NewInstance(image2, status.Instance{}), &cfg, b.flowMetrics, nil, nil)
557558
fourth := b.serviceMonitor()
558-
fourth.Spec.Endpoints[0].Scheme = "https"
559+
fourth.Spec.Endpoints[0].Scheme = ptr.To(v1.SchemeHTTPS)
559560

560561
report = helper.NewChangeReport("")
561562
assert.True(helper.ServiceMonitorChanged(third, fourth, &report))

internal/pkg/helper/monitoring.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ func GetSecretOrConfigMap(file *flowslatest.FileReference) monitoringv1.SecretOr
2828
}
2929
}
3030

31-
func GetServiceMonitorTLSConfig(tls *flowslatest.ServerTLS, serverName string, isDownstream bool) (string, *monitoringv1.TLSConfig) {
31+
func GetServiceMonitorTLSConfig(tls *flowslatest.ServerTLS, serverName string, isDownstream bool) (monitoringv1.Scheme, *monitoringv1.TLSConfig) {
3232
if tls.Type == flowslatest.ServerTLSAuto {
3333
if isDownstream {
34-
return "https", &monitoringv1.TLSConfig{
34+
return monitoringv1.SchemeHTTPS, &monitoringv1.TLSConfig{
3535
SafeTLSConfig: monitoringv1.SafeTLSConfig{
3636
ServerName: ptr.To(serverName),
3737
},
3838
CAFile: "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt",
3939
}
4040
}
4141
// Upstream prometheus disallows CAFile
42-
return "https", &monitoringv1.TLSConfig{
42+
return monitoringv1.SchemeHTTPS, &monitoringv1.TLSConfig{
4343
SafeTLSConfig: monitoringv1.SafeTLSConfig{
4444
ServerName: ptr.To(serverName),
4545
CA: monitoringv1.SecretOrConfigMap{
@@ -64,8 +64,8 @@ func GetServiceMonitorTLSConfig(tls *flowslatest.ServerTLS, serverName string, i
6464
if !tls.InsecureSkipVerify && tls.ProvidedCaFile != nil && tls.ProvidedCaFile.File != "" {
6565
tlsOut.SafeTLSConfig.CA = GetSecretOrConfigMap(tls.ProvidedCaFile)
6666
}
67-
return "https", &tlsOut
67+
return monitoringv1.SchemeHTTPS, &tlsOut
6868
}
6969

70-
return "http", nil
70+
return monitoringv1.SchemeHTTP, nil
7171
}

0 commit comments

Comments
 (0)