Skip to content

Commit 748f5c9

Browse files
committed
seMON-4126: set fallbackScrapeProtocol: 'PrometheusText1.0.0' as default for all UWM Prometheus targets for backward compatibility with Prometheus v2 until a better migration process is available
1 parent 89b863e commit 748f5c9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

assets/prometheus-user-workload/prometheus.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ spec:
260260
operator: In
261261
values:
262262
- leaf-prometheus
263+
scrapeClasses:
264+
- default: true
265+
fallbackScrapeProtocol: PrometheusText1.0.0
266+
name: global-config
263267
scrapeConfigNamespaceSelector: null
264268
scrapeConfigSelector: null
265269
secrets:

jsonnet/components/prometheus-user-workload.libsonnet

+9
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,15 @@ function(params)
581581
],
582582
},
583583
],
584+
// As we do not have control over the targets, this is meant to maintain the v2 behavior.
585+
// We will discuss later whether and how we want to enable the v3 behavior.
586+
scrapeClasses: [
587+
{
588+
name: 'global-config',
589+
default: true,
590+
fallbackScrapeProtocol: 'PrometheusText1.0.0',
591+
},
592+
],
584593
volumes+: [
585594
{
586595
name: $.trustedCaBundle.metadata.name,

pkg/manifests/manifests_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,11 @@ func TestPrometheusUserWorkloadConfiguration(t *testing.T) {
17191719
if !volumeMountsConfigured(container.VolumeMounts, volumeName) {
17201720
t.Fatalf("trusted CA bundle volume mount for %s is not configured correctly", container.Name)
17211721
}
1722+
1723+
// The FallbackScrapeProtocol default scrape class is set as expected.
1724+
require.Len(t, p.Spec.ScrapeClasses, 1)
1725+
require.Equal(t, p.Spec.ScrapeClasses[0].Default, ptr.To(true))
1726+
require.Equal(t, p.Spec.ScrapeClasses[0].FallbackScrapeProtocol, ptr.To(monv1.PrometheusText1_0_0))
17221727
}
17231728

17241729
func TestPrometheusQueryLogFileConfig(t *testing.T) {

0 commit comments

Comments
 (0)