-
Notifications
You must be signed in to change notification settings - Fork 471
Revert "TRT-2817: Revert "Merge pull request #2279 from nbottari9/1814-duplicate-warning"" #2322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 1 commit into
openshift:main
from
hongkailiu:revert-2320-revert-oc-2279
Jul 29, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| package recommend | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| configv1 "github.com/openshift/api/config/v1" | ||
| "github.com/openshift/api/features" | ||
| ) | ||
|
|
||
| func TestIsAcceptRisksEnabled(t *testing.T) { | ||
|
|
||
| for _, testCase := range []struct { | ||
| name string | ||
| featureGateConfig *configv1.FeatureGate | ||
| expected bool | ||
| }{ | ||
| { | ||
| name: "no feature gates", | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is enabled", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.22.0", | ||
| Enabled: []configv1.FeatureGateAttributes{ | ||
| { | ||
| Name: features.FeatureGateClusterUpdateAcceptRisks, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| expected: true, | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is explicitly disabled", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.22.0", | ||
| Disabled: []configv1.FeatureGateAttributes{ | ||
| { | ||
| Name: features.FeatureGateClusterUpdateAcceptRisks, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is not explicitly enabled or disabled", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.22.0", | ||
| Enabled: []configv1.FeatureGateAttributes{}, | ||
| Disabled: []configv1.FeatureGateAttributes{}, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: "ClusterUpdateAcceptRisks feature gate is enabled for a different cluster version", | ||
| featureGateConfig: &configv1.FeatureGate{ | ||
| Status: configv1.FeatureGateStatus{ | ||
| FeatureGates: []configv1.FeatureGateDetails{ | ||
| { | ||
| Version: "4.21.0", | ||
| Enabled: []configv1.FeatureGateAttributes{ | ||
| { | ||
| Name: features.FeatureGateClusterUpdateAcceptRisks, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| } { | ||
| t.Run(testCase.name, func(t *testing.T) { | ||
| actual := isAcceptRisksEnabled(testCase.featureGateConfig, "4.22.0") | ||
|
|
||
| if actual != testCase.expected { | ||
| t.Errorf("%v != %v", actual, testCase.expected) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestIsHypershiftEnabled(t *testing.T) { | ||
| for _, testCase := range []struct { | ||
| name string | ||
| infrastructure *configv1.Infrastructure | ||
| expected bool | ||
| }{ | ||
| { | ||
| name: "no infrastructure", | ||
| }, | ||
| { | ||
| name: "hypershift enabled", | ||
| infrastructure: &configv1.Infrastructure{ | ||
| Status: configv1.InfrastructureStatus{ | ||
| ControlPlaneTopology: configv1.ExternalTopologyMode, | ||
| }, | ||
| }, | ||
| expected: true, | ||
| }, | ||
| { | ||
| name: "hypershift not enabled", | ||
| infrastructure: &configv1.Infrastructure{ | ||
| Status: configv1.InfrastructureStatus{ | ||
| ControlPlaneTopology: configv1.HighlyAvailableTopologyMode, | ||
| }, | ||
| }, | ||
| }, | ||
| } { | ||
| t.Run(testCase.name, func(t *testing.T) { | ||
| actual := isHostedCluster(testCase.infrastructure) | ||
|
|
||
| if actual != testCase.expected { | ||
| t.Errorf("%v != %v", actual, testCase.expected) | ||
| } | ||
| }) | ||
| } | ||
| } |
152 changes: 152 additions & 0 deletions
152
pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-alerts.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| { | ||
| "status": "success", | ||
| "data": { | ||
| "alerts": [ | ||
| { | ||
| "labels": { | ||
| "alertname": "ClusterNotUpgradeable", | ||
| "condition": "Upgradeable", | ||
| "endpoint": "metrics", | ||
| "name": "version", | ||
| "namespace": "openshift-cluster-version", | ||
| "severity": "info" | ||
| }, | ||
| "annotations": { | ||
| "description": "In most cases, you will still be able to apply patch releases. Reason MultipleReasons. For more information refer to 'oc adm upgrade' or https://console-openshift-console.apps.ci-ln-h13idik-72292.gcp-2.ci.openshift.org/settings/cluster/.", | ||
| "summary": "One or more cluster operators have been blocking minor or major version cluster updates for at least an hour." | ||
| }, | ||
| "state": "firing", | ||
| "activeAt": "2026-07-13T18:15:08.114207953Z", | ||
| "value": "0e+00", | ||
| "partialResponseStrategy": "WARN" | ||
| }, | ||
| { | ||
| "labels": { | ||
| "alertname": "OpenShiftUpdateRiskMightApply", | ||
| "namespace": "openshift-cluster-version", | ||
| "reason": "Alert:firing", | ||
| "risk": "TestAlert", | ||
| "severity": "warning" | ||
| }, | ||
| "annotations": { | ||
| "description": "The conditional update risk TestAlert might apply to the cluster because of Alert:firing, and the cluster update to a version exposed to the risk is not recommended. For more information refer to 'oc adm upgrade'.", | ||
| "runbook_url": "https://github.com/openshift/runbooks/blob/master/alerts/cluster-version-operator/OpenShiftUpdateRiskMightApply.md", | ||
| "summary": "The cluster might have been exposed to the conditional update risk for 15 minutes." | ||
| }, | ||
| "state": "pending", | ||
| "activeAt": "2026-07-13T20:02:36.835802807Z", | ||
| "value": "1e+00", | ||
| "partialResponseStrategy": "WARN" | ||
| }, | ||
| { | ||
| "labels": { | ||
| "alertname": "InsightsRecommendationActive", | ||
| "container": "insights-operator", | ||
| "description": "Enabling the **TechPreviewNoUpgrade** feature set on your cluster\ncan not be undone and prevents minor version updates. Please do\nnot enable this feature set on production clusters.\n", | ||
| "endpoint": "https", | ||
| "info_link": "https://console.redhat.com/openshift/insights/advisor/clusters/82c88454-3cfc-4233-8e10-34f5c3ff67c0?first=ccx_rules_ocp.external.rules.upgrade_is_blocked_due_to_tpfg%7CTECH_PREVIEW_NO_UPGRADE_FEATURE_SET_IS_ENABLED", | ||
| "instance": "10.130.0.27:8443", | ||
| "job": "metrics", | ||
| "namespace": "openshift-insights", | ||
| "pod": "insights-operator-584747df49-5x462", | ||
| "service": "metrics", | ||
| "severity": "info", | ||
| "total_risk": "Important" | ||
| }, | ||
| "annotations": { | ||
| "description": "Insights recommendation \"Enabling the **TechPreviewNoUpgrade** feature set on your cluster\ncan not be undone and prevents minor version updates. Please do\nnot enable this feature set on production clusters.\n\" with total risk \"Important\" was detected on the cluster. More information is available at https://console.redhat.com/openshift/insights/advisor/clusters/82c88454-3cfc-4233-8e10-34f5c3ff67c0?first=ccx_rules_ocp.external.rules.upgrade_is_blocked_due_to_tpfg%7CTECH_PREVIEW_NO_UPGRADE_FEATURE_SET_IS_ENABLED.", | ||
| "summary": "An Insights recommendation is active for this cluster." | ||
| }, | ||
| "state": "firing", | ||
| "activeAt": "2026-07-13T18:17:18.129623987Z", | ||
| "value": "1e+00", | ||
| "partialResponseStrategy": "WARN" | ||
| }, | ||
| { | ||
| "labels": { | ||
| "alertname": "TechPreviewNoUpgrade", | ||
| "container": "kube-apiserver-operator", | ||
| "endpoint": "https", | ||
| "instance": "10.130.0.42:8443", | ||
| "job": "kube-apiserver-operator", | ||
| "name": "TechPreviewNoUpgrade", | ||
| "namespace": "openshift-kube-apiserver-operator", | ||
| "pod": "kube-apiserver-operator-7d998989dd-gscdp", | ||
| "service": "metrics", | ||
| "severity": "warning" | ||
| }, | ||
| "annotations": { | ||
| "description": "Cluster has enabled Technology Preview features that cannot be undone and will prevent upgrades. The TechPreviewNoUpgrade feature set is not recommended on production clusters.", | ||
| "summary": "Cluster has enabled tech preview features that will prevent upgrades." | ||
| }, | ||
| "state": "firing", | ||
| "activeAt": "2026-07-13T18:17:52.119686422Z", | ||
| "value": "0e+00", | ||
| "partialResponseStrategy": "WARN" | ||
| }, | ||
| { | ||
| "labels": { | ||
| "alertname": "Watchdog", | ||
| "namespace": "openshift-monitoring", | ||
| "severity": "none" | ||
| }, | ||
| "annotations": { | ||
| "description": "This is an alert meant to ensure that the entire alerting pipeline is functional.\nThis alert is always firing, therefore it should always be firing in Alertmanager\nand always fire against a receiver. There are integrations with various notification\nmechanisms that send a notification when this alert is not firing. For example the\n\"DeadMansSnitch\" integration in PagerDuty.\n", | ||
| "summary": "An alert that should always be firing to certify that Alertmanager is working properly." | ||
| }, | ||
| "state": "firing", | ||
| "activeAt": "2026-07-13T18:14:54.631104668Z", | ||
| "value": "1e+00", | ||
| "partialResponseStrategy": "WARN" | ||
| }, | ||
| { | ||
| "labels": { | ||
| "alertname": "TargetDown", | ||
| "job": "check-endpoints", | ||
| "namespace": "openshift-apiserver", | ||
| "service": "check-endpoints", | ||
| "severity": "warning" | ||
| }, | ||
| "annotations": { | ||
| "description": "100% of the check-endpoints/check-endpoints targets in openshift-apiserver namespace have been unreachable for more than 15 minutes. This may be a symptom of network connectivity issues, down nodes, or failures within these components. Assess the health of the infrastructure and nodes running these targets and then contact support.", | ||
| "runbook_url": "https://github.com/openshift/runbooks/blob/master/alerts/cluster-monitoring-operator/TargetDown.md", | ||
| "summary": "Some targets were not reachable from the monitoring server for an extended period of time." | ||
| }, | ||
| "state": "firing", | ||
| "activeAt": "2026-07-13T18:15:42.660370292Z", | ||
| "value": "1e+02", | ||
| "partialResponseStrategy": "WARN" | ||
| }, | ||
| { | ||
| "labels": { | ||
| "alertname": "AlertmanagerReceiversNotConfigured", | ||
| "namespace": "openshift-monitoring", | ||
| "severity": "warning" | ||
| }, | ||
| "annotations": { | ||
| "description": "Alerts are not configured to be sent to a notification system, meaning that you may not be notified in a timely fashion when important failures occur. Check the OpenShift documentation to learn how to configure notifications with Alertmanager.", | ||
| "summary": "Receivers (notification integrations) are not configured on Alertmanager" | ||
| }, | ||
| "state": "firing", | ||
| "activeAt": "2026-07-13T18:17:24.167429387Z", | ||
| "value": "0e+00", | ||
| "partialResponseStrategy": "WARN" | ||
| }, | ||
| { | ||
| "labels": { | ||
| "alertname": "TestAlert", | ||
| "openShiftUpdatePrecheck": "true", | ||
| "severity": "warning" | ||
| }, | ||
| "annotations": { | ||
| "description": "Test alert for updates", | ||
| "summary": "Test alert for updates" | ||
| }, | ||
| "state": "firing", | ||
| "activeAt": "2026-07-13T19:05:17.879901206Z", | ||
| "value": "1e+00", | ||
| "partialResponseStrategy": "WARN" | ||
| } | ||
| ] | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the warning typo.
“occured” should be “occurred.”
🤖 Prompt for AI Agents