Skip to content

MON-4413: support MessageVersion v2.0 for remote-write#2977

Open
simonpasquier wants to merge 2 commits into
openshift:mainfrom
simonpasquier:MON-4413
Open

MON-4413: support MessageVersion v2.0 for remote-write#2977
simonpasquier wants to merge 2 commits into
openshift:mainfrom
simonpasquier:MON-4413

Conversation

@simonpasquier

Copy link
Copy Markdown
Contributor

No description provided.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 29, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@simonpasquier: This pull request references MON-4413 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@simonpasquier
simonpasquier requested a review from slashpai June 29, 2026 14:52
@openshift-ci
openshift-ci Bot requested a review from jan--f June 29, 2026 14:53
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds MessageVersion to RemoteWriteSpec, documents supported values, validates cluster and user workload configurations, and propagates the value into generated Prometheus remote-write specs. Tests cover validation, manifest generation, and an end-to-end V2.0 scenario with isolated per-subtest resources. The Go toolchain directive is updated to 1.26.0.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: jan--f, slashpai

🚥 Pre-merge checks | ✅ 11 | ❌ 4

❌ Failed checks (4 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, so the required Telemetry report section and fenced block are missing. Add the Telemetry report section with the required telemetry_report code block, or note why the template section is not applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Microshift Test Compatibility ⚠️ Warning The new remote-write subtest is unguarded and relies on openshift-monitoring/Prometheus CRs and prometheus-k8s replicas, which MicroShift doesn’t provide. Add a MicroShift skip/tag or runtime IsMicroShiftCluster() guard, or rewrite the test to avoid monitoring-stack resources and multi-replica assumptions.
Single Node Openshift (Sno) Test Compatibility ⚠️ Warning TestPrometheusRemoteWrite hardcodes checks for prometheus-k8s-0 and -1 and lacks any SNO skip; it will fail on single-replica clusters. Add a [Skipped:SingleReplicaTopology] label or runtime SNO guard (IsSingleNode/skipOnSingleNodeTopology) before running the remote-write checks.
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding support for remote-write MessageVersion v2.0.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR adds only static table-driven t.Run names; no new Ginkgo It/Describe/Context/When titles with dynamic content were introduced.
Test Structure And Quality ✅ Passed New e2e/unit tests use t.Cleanup and bounded Poll/WaitFor* timeouts; no Ginkgo-style structural issues or cleanup gaps found.
Topology-Aware Scheduling Compatibility ✅ Passed Only remote-write messageVersion validation/propagation changed; no node selectors, anti-affinity, spread constraints, or topology-based replica logic were added.
Ote Binary Stdout Contract ✅ Passed No changed process-level code writes to stdout; the new e2e/test and validation code only adds config handling, and the suite entrypoint remains unchanged.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new remote-write subtest uses cluster DNS/service routes and self-signed certs only; no IPv4-only assumptions or public internet access were added.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret-comparison code was added; the diff only adds remote-write messageVersion/docs/tests.
Container-Privileges ✅ Passed Touched files only add remote-write MessageVersion handling; no privileged, hostPID/hostNetwork/hostIPC, or allowPrivilegeEscalation settings were introduced.
No-Sensitive-Data-In-Logs ✅ Passed PASS: The diff adds no new logging; touched code only validates/propagates MessageVersion and refactors e2e setup, with no t.Log/printf/klog or secret/token output added.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: de809eda-88a6-4407-93c8-178995765434

📥 Commits

Reviewing files that changed from the base of the PR and between 2b502a5 and d2152d4.

📒 Files selected for processing (9)
  • Documentation/api.md
  • Documentation/openshiftdocs/modules/remotewritespec.adoc
  • go.mod
  • pkg/manifests/config.go
  • pkg/manifests/config_test.go
  • pkg/manifests/manifests.go
  • pkg/manifests/manifests_test.go
  • pkg/manifests/types.go
  • test/e2e/prometheus_test.go

Comment on lines +3563 to +3564
if target.MessageVersion != "" {
rwConf.MessageVersion = new(monv1.RemoteWriteMessageVersion(target.MessageVersion))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant manifest code and the enum/type definitions referenced by the review comment.
sed -n '3548,3575p' pkg/manifests/manifests.go
printf '\n--- types ---\n'
sed -n '840,915p' pkg/manifests/types.go
printf '\n--- tests ---\n'
sed -n '1440,1510p' pkg/manifests/manifests_test.go

printf '\n--- search for MessageVersion usages ---\n'
rg -n "MessageVersion" pkg/manifests -g'*.go'

Repository: openshift/cluster-monitoring-operator

Length of output: 8841


Materialize the enum value before taking its address. new(monv1.RemoteWriteMessageVersion(target.MessageVersion)) does not compile, and the empty-string path leaves MessageVersion nil instead of applying the documented V1.0 default.

Suggested fix
-		if target.MessageVersion != "" {
-			rwConf.MessageVersion = new(monv1.RemoteWriteMessageVersion(target.MessageVersion))
-		}
+		version := monv1.RemoteWriteMessageVersion1_0
+		if target.MessageVersion != "" {
+			version = monv1.RemoteWriteMessageVersion(target.MessageVersion)
+		}
+		rwConf.MessageVersion = &version
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if target.MessageVersion != "" {
rwConf.MessageVersion = new(monv1.RemoteWriteMessageVersion(target.MessageVersion))
version := monv1.RemoteWriteMessageVersion1_0
if target.MessageVersion != "" {
version = monv1.RemoteWriteMessageVersion(target.MessageVersion)
}
rwConf.MessageVersion = &version

Comment thread test/e2e/prometheus_test.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 23e11d7b-b150-49dc-8855-70fc2112b880

📥 Commits

Reviewing files that changed from the base of the PR and between d2152d4 and c6fc9df.

📒 Files selected for processing (9)
  • Documentation/api.md
  • Documentation/openshiftdocs/modules/remotewritespec.adoc
  • go.mod
  • pkg/manifests/config.go
  • pkg/manifests/config_test.go
  • pkg/manifests/manifests.go
  • pkg/manifests/manifests_test.go
  • pkg/manifests/types.go
  • test/e2e/prometheus_test.go
✅ Files skipped from review due to trivial changes (2)
  • Documentation/openshiftdocs/modules/remotewritespec.adoc
  • Documentation/api.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • go.mod
  • pkg/manifests/manifests.go
  • pkg/manifests/config_test.go
  • test/e2e/prometheus_test.go
  • pkg/manifests/config.go
  • pkg/manifests/types.go

{
name: "V1.0 is passed through",
messageVersion: "V1.0",
expectedVersion: new(monv1.RemoteWriteMessageVersion1_0),

@coderabbitai coderabbitai Bot Jun 29, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Checking for the invalid new(...) pattern in this test file:"
rg -n 'new\(monv1\.RemoteWriteMessageVersion[12]_0\)' pkg/manifests/manifests_test.go

echo
echo "Inspecting the enum declarations to confirm these identifiers are values, not types:"
fd '^types\.go$' . | while read -r f; do
  rg -n -C2 'RemoteWriteMessageVersion1_0|RemoteWriteMessageVersion2_0|type RemoteWriteMessageVersion' "$f" || true
done

Repository: openshift/cluster-monitoring-operator

Length of output: 454


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Locate the enum declarations:"
rg -n -C3 'type RemoteWriteMessageVersion|RemoteWriteMessageVersion1_0|RemoteWriteMessageVersion2_0' pkg

echo
echo "Show the surrounding lines in the defining file:"
file=$(rg -l 'RemoteWriteMessageVersion1_0|RemoteWriteMessageVersion2_0' pkg | head -n 1)
if [ -n "${file:-}" ]; then
  sed -n '1,220p' "$file" | nl -ba | sed -n '/RemoteWriteMessageVersion1_0/,+20p;/RemoteWriteMessageVersion2_0/,+20p;/type RemoteWriteMessageVersion/,+20p'
fi

Repository: openshift/cluster-monitoring-operator

Length of output: 1071


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Search the repo for the enum type and constant declarations:"
rg -n -C2 'type RemoteWriteMessageVersion|RemoteWriteMessageVersion1_0|RemoteWriteMessageVersion2_0' .

echo
echo "If found, show the surrounding lines with plain sed:"
file=$(rg -l 'RemoteWriteMessageVersion1_0|RemoteWriteMessageVersion2_0' . | head -n 1 || true)
if [ -n "${file:-}" ]; then
  echo "File: $file"
  sed -n '1,260p' "$file"
fi

Repository: openshift/cluster-monitoring-operator

Length of output: 14531


new(...) needs a type, not the enum value monv1.RemoteWriteMessageVersion1_0 and monv1.RemoteWriteMessageVersion2_0 are constants, so these two cases won’t compile. Use a typed local variable or ptr.To(...) instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure abut this?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Reviewed expressions:"
rg -n -C2 'new\(monv1\.RemoteWriteMessageVersion[12]_0\)' pkg/manifests/manifests_test.go

echo
echo "Resolved dependency declarations/usages:"
rg -n -C3 'type RemoteWriteMessageVersion\b|RemoteWriteMessageVersion1_0\b|RemoteWriteMessageVersion2_0\b' \
  vendor $(go env GOPATH 2>/dev/null)/pkg/mod 2>/dev/null || true

Length of output: 6246


@machine424 Yes. The dependency declaration was not present in the available sandbox paths, but the issue follows directly from Go syntax: new accepts a type, whereas RemoteWriteMessageVersion1_0 and RemoteWriteMessageVersion2_0 are enum values/constants.

These expressions therefore fail with an error equivalent to “RemoteWriteMessageVersion1_0 is not a type”:

new(monv1.RemoteWriteMessageVersion1_0)

Since ptr is already imported in this file, the straightforward correction is:

expectedVersion: ptr.To(monv1.RemoteWriteMessageVersion1_0),

and equivalently for RemoteWriteMessageVersion2_0.


🧬 Code Graph Analysis Results

pkg/manifests/manifests.go

  • Lines 1324-1353 — (*Factory) SharingConfig(...)

    func (f *Factory) SharingConfig(
    	promHost, amHost, thanosHost *url.URL,
    	alertmanagerUserWorkloadHost, alertmanagerTenancyHost string,
    ) *v1.ConfigMap {
    	data := map[string]string{}
    
    	// Configmap keys need to include "public" to indicate that they are public values.
    	// See https://bugzilla.redhat.com/show_bug.cgi?id=1807100.
    	if promHost != nil {
    		data["prometheusPublicURL"] = fmt.Sprintf("%s://%s", promHost.Scheme, promHost.Host)
    	}
    
    	if amHost != nil {
    		data["alertmanagerPublicURL"] = fmt.Sprintf("%s://%s", amHost.Scheme, amHost.Host)
    	}
    
    	if thanosHost != nil {
    		data["thanosPublicURL"] = fmt.Sprintf("%s://%s", thanosHost.Scheme, thanosHost.Host)
    	}
    	data["alertmanagerUserWorkloadHost"] = alertmanagerUserWorkloadHost
    	data["alertmanagerTenancyHost"] = alertmanagerTenancyHost
    
    	return &v1.ConfigMap{
    		ObjectMeta: metav1.ObjectMeta{
    			Name:      sharedConfigMap,
    			Namespace: configManagedNamespace,
    		},
    		Data: data,
    	}
    }
  • Lines 2215-2265 — (*Factory) PrometheusOperatorAdmissionWebhookDeployment()

    func (f *Factory) PrometheusOperatorAdmissionWebhookDeployment() (*appsv1.Deployment, error) {
    	d, err := f.NewDeployment(f.assets.MustNewAssetSlice(AdmissionWebhookDeployment))
    	if err != nil {
    		return nil, err
    	}
    
    	if len(f.config.ClusterMonitoringConfiguration.PrometheusOperatorConfig.NodeSelector) > 0 {
    		d.Spec.Template.Spec.NodeSelector = f.config.ClusterMonitoringConfiguration.PrometheusOperatorConfig.NodeSelector
    	}
    
    	if len(f.config.ClusterMonitoringConfiguration.PrometheusOperatorConfig.Tolerations) > 0 {
    		d.Spec.Template.Spec.Tolerations = f.config.ClusterMonitoringConfiguration.PrometheusOperatorConfig.Tolerations
    	}
    
    	if len(f.config.ClusterMonitoringConfiguration.PrometheusOperatorAdmissionWebhookConfig.TopologySpreadConstraints) > 0 {
    		d.Spec.Template.Spec.TopologySpreadConstraints =
    			f.config.ClusterMonitoringConfiguration.PrometheusOperatorAdmissionWebhookConfig.TopologySpreadConstraints
    	}
    
    	for i, container := range d.Spec.Template.Spec.Containers {
    		switch container.Name {
    		case "prometheus-operator-admission-webhook":
    			d.Spec.Template.Spec.Containers[i].Image = f.config.Images.PrometheusOperatorAdmissionWebhook
    
    			if f.config.ClusterMonitoringConfiguration.PrometheusOperatorAdmissionWebhookConfig.Resources != nil {
    				d.Spec.Template.Spec.Containers[i].Resources = *f.config.ClusterMonitoringConfiguration.PrometheusOperatorAdmissionWebhookConfig.Resources
    			}
    
    			args := d.Spec.Template.Spec.Containers[i].Args
    			if f.config.ClusterMonitoringConfiguration.PrometheusOperatorConfig.LogLevel != "" {
    				args = append(args, fmt.Sprintf("--log-level=%s", f.config.ClusterMonitoringConfiguration.PrometheusOperatorConfig.LogLevel))
    			}
    
    			// The admission webhook supports only TLS versions >= 1.2.
    			tlsVersionEnforcer := &minTLSVersionEnforcer{
    				atLeast: tls.VersionTLS12,
    				inner:   f.APIServerConfig,
    			}
    			args = f.setTLSSecurityConfigurationWithMinTLSVersion(
    				args,
    				PrometheusOperatorWebTLSCipherSuitesFlag,
    				PrometheusOperatorWebTLSMinTLSVersionFlag,
    				tlsVersionEnforcer,
    			)
    			d.Spec.Template.Spec.Containers[i].Args = args
    		}
    	}
    	d.Namespace = f.namespace
    
    	return d, nil
    }
  • Lines 2391-2398 — (*minTLSVersionEnforcer) MinTLSVersion()

    func (m *minTLSVersionEnforcer) MinTLSVersion() string {
    	v := m.inner.MinTLSVersion()
    	if crypto.TLSVersionOrDie(v) < m.atLeast {
    		return crypto.TLSVersionToNameOrDie(m.atLeast)
    	}
    
    	return v
    }
  • Lines 1214-1257 — (*Factory) ThanosRulerAlertmanagerConfigSecret()

    func (f *Factory) ThanosRulerAlertmanagerConfigSecret() (*v1.Secret, error) {
    	s, err := f.NewSecret(f.assets.MustNewAssetSlice(ThanosRulerAlertmanagerConfigSecret))
    	if err != nil {
    		return nil, err
    	}
    
    	var alertingConfiguration thanosAlertingConfiguration
    	err = yaml2.Unmarshal([]byte(s.StringData["alertmanagers.yaml"]), &alertingConfiguration)
    	if err != nil {
    		return nil, err
    	}
    
    	if f.config.UserWorkloadConfiguration.Alertmanager.Enabled {
    		alertingConfiguration.Alertmanagers[0].HTTPConfig.TLSConfig.ServerName = fmt.Sprintf(
    			"%s.%s.svc",
    			userWorkloadAlertmanagerService,
    			f.namespaceUserWorkload,
    		)
    		alertingConfiguration.Alertmanagers[0].StaticConfigs = []string{
    			fmt.Sprintf(
    				"dnssrv+_web._tcp.alertmanager-operated.%s.svc",
    				f.namespaceUserWorkload,
    			),
    		}
    	} else if !f.config.ClusterMonitoringConfiguration.AlertmanagerMainConfig.IsEnabled() {
    		alertingConfiguration.Alertmanagers = []thanosAlertmanagerConfiguration{}
    	}
    
    	additionalConfigs, err := f.ConvertToThanosAlertmanagerConfiguration(f.config.GetThanosRulerAlertmanagerConfigs())
    	if err != nil {
    		return nil, err
    	}
    
    	alertingConfiguration.Alertmanagers = append(alertingConfiguration.Alertmanagers, additionalConfigs...)
    
    	b, err := yaml2.Marshal(alertingConfiguration)
    	if err != nil {
    		return nil, err
    	}
    
    	s.StringData["alertmanagers.yaml"] = string(b)
    
    	return s, nil
    }

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@simonpasquier

Copy link
Copy Markdown
Contributor Author

/verified by CI
/retest-required

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jun 30, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@simonpasquier: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI
/retest-required

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-ovn-techpreview

@danielmellado danielmellado left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, thanks!

Comment thread pkg/manifests/manifests.go
Comment thread test/e2e/prometheus_test.go
Comment thread go.mod
@simonpasquier

Copy link
Copy Markdown
Contributor Author

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 16, 2026
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Jul 16, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e4b61cb4-f2b1-4abf-9bcc-5d41356f4a53

📥 Commits

Reviewing files that changed from the base of the PR and between 75bdf87 and 7456481.

📒 Files selected for processing (2)
  • test/e2e/framework/prometheus.go
  • test/e2e/prometheus_test.go

CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
Image: image,
Replicas: &replicas,
Replicas: new(int32(1)),

@coderabbitai coderabbitai Bot Jul 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# This must return no matches after the fix.
rg -n 'new\(int32\(1\)\)' test/e2e/framework/prometheus.go

Repository: openshift/cluster-monitoring-operator

Length of output: 224


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,120p' test/e2e/framework/prometheus.go

Repository: openshift/cluster-monitoring-operator

Length of output: 3706


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import re
from pathlib import Path

p = Path('test/e2e/framework/prometheus.go')
text = p.read_text()
print('ptr import present:', 'ptr "' in text or '\tptr' in text or re.search(r'\bptr\b', text) is not None)
print('new(int32(1)) present:', 'new(int32(1))' in text)
PY

Repository: openshift/cluster-monitoring-operator

Length of output: 228


Use ptr.To(int32(1)) for Replicas new takes a type, so new(int32(1)) is invalid Go syntax. ptr.To(int32(1)) is already imported and fits here.

Proposed fix
-				Replicas:                  new(int32(1)),
+				Replicas:                  ptr.To(int32(1)),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Replicas: new(int32(1)),
Replicas: ptr.To(int32(1)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you really sure about this??

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@machine424 Yes — the concern is valid. I should have been more precise in the wording: new takes a type, so new(int32) would be valid (but yields a zero-valued *int32). new(int32(1)) is invalid because int32(1) is a value conversion expression, not a type.

For the required value of 1, either of these is valid:

Replicas: ptr.To(int32(1)),
replicas := int32(1)
Replicas: &replicas,

Since ptr is already imported and used in this file, ptr.To(int32(1)) is the concise appropriate replacement.

Comment thread test/e2e/prometheus_test.go Outdated
@danielmellado

Copy link
Copy Markdown
Contributor

/lgtm

@danielmellado

Copy link
Copy Markdown
Contributor

Thanks Simon ;)

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2026
@danielmellado

Copy link
Copy Markdown
Contributor

/retest-required

@machine424 machine424 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, just some propositions.

Comment thread pkg/manifests/config_test.go Outdated
},
{
name: "cluster monitoring: V1.0 is valid",
config: "prometheusK8s:\n remoteWrite:\n - url: http://example.com\n messageVersion: V1.0\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we format these as multiline strings instead? It would make them more readable for humans :)

SafeAuthorization: *target.Authorization,
}
}
if target.MessageVersion != "" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think CMO should enforce the default version value in case prometheus-operator starts using v2 as the default one or if prometheus changes the default value to v2.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, the operator assumes no default and delegates to Prometheus. I assume that changing the default in Prometheus will only happen in a new major version at which time we would make the proper decision anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the operator assumes no default

This isn't quite right: it needs to rely on the Prometheus default value to make some decisions anyway though it won't explicitly set the parameter in the generated configuration if unset in the resource.

@machine424 machine424 Jul 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but I still think that being explicit on CMO side (like we already do for other defaults) is safer and should cost nothing.

{
name: "V1.0 is passed through",
messageVersion: "V1.0",
expectedVersion: new(monv1.RemoteWriteMessageVersion1_0),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure abut this?

CommonPrometheusFields: monitoringv1.CommonPrometheusFields{
Image: image,
Replicas: &replicas,
Replicas: new(int32(1)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you really sure about this??

Comment thread go.mod
module github.com/openshift/cluster-monitoring-operator

go 1.25.0
go 1.26.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this was needed for some new syntax or sth :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep and coding assistants are confused by the new syntax as they lack 1.26 knowledge :)

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2026
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
// WaitForPrometheusUpdate reads the current generation from the given
// Prometheus resource and polls the Kubernetes API until the resource's
// generation is incremented and it matches with the status observedGeneration.
func (f Framework) WaitForPrometheusUpdate(ctx context.Context, p *monitoringv1.Prometheus) error {

@machine424 machine424 Jul 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is only needed for a "clearer failure message" (even though the more explicit would be in the pods logs).
Otherwise the config propagation delay would be absorbed into the remoteWriteCheckMetrics 6 min wait window.

(I like the idea of WaitForPrometheusUpdate's generations comparisons, I may use it for a new test )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct this is to distinguish between "the CMO config couldn't be applied" (for instance a secret ref is invalid) vs. "the config is applied but it didn't produce the expected result".

@machine424 machine424 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/hold
we can always follow up.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2026
@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danielmellado, machine424, simonpasquier

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [danielmellado,machine424,simonpasquier]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/hold cancel

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 20, 2026
@simonpasquier

Copy link
Copy Markdown
Contributor Author

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 20, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@simonpasquier: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD e42163e and 2 for PR HEAD 62964dc in total

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/test e2e-hypershift-conformance

2 similar comments
@danielmellado

Copy link
Copy Markdown
Contributor

/test e2e-hypershift-conformance

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/test e2e-hypershift-conformance

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 77ac57e and 1 for PR HEAD 62964dc in total

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/test e2e-hypershift-conformance

@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@simonpasquier: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/test images

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-ovn-upgrade

@simonpasquier

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-ovn-techpreview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants