Skip to content

Conversation

wking
Copy link
Member

@wking wking commented Oct 2, 2025

Since 8bdac16 (#2088), this knob has always been enabled. Save ourselves a no longer necessary level of indentation by removing it completely.

Since 8bdac16 (pkg/cli/admin/upgrade/recommend: Enable precheck and
accept gates, 2025-09-03, openshift#2088), this knob has always been enabled.
Save ourselves a no longer necessary level of indentation by removing
it completely.
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Oct 2, 2025
@openshift-ci-robot
Copy link

@wking: This pull request explicitly references no jira issue.

In response to this:

Since 8bdac16 (#2088), this knob has always been enabled. Save ourselves a no longer necessary level of indentation by removing it completely.

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.

Copy link

coderabbitai bot commented Oct 2, 2025

Walkthrough

The precheck feature flag is removed, making prechecks always run. The Run flow in recommend.go is refactored to unconditionally execute precheck, consolidate condition handling (happy/accepted/unhappy), and centralize output formatting. A test case removes manual precheck flag manipulation after options completion.

Changes

Cohort / File(s) Summary
Recommend logic refactor
pkg/cli/admin/upgrade/recommend/recommend.go
Removed precheckEnabled flag and its gating. Made precheck unconditional in Run. Simplified and reordered handling of precheck results. Unified acceptance logic and issue insertion. Consolidated user-facing output for happy/accepted/unhappy conditions with consistent sorting and messaging.
Tests update
pkg/cli/admin/upgrade/recommend/examples_test.go
Deleted assignment of precheckEnabled after opts.Complete, aligning test with unconditional precheck behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly identifies the removal of the obsolete precheckEnabled knob in the pkg/cli/admin/upgrade/recommend package, directly reflecting the main change described in the pull request.
Description Check ✅ Passed The description clearly explains that the precheckEnabled knob has been redundant since a prior commit and why it is being removed, directly relating to the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci bot requested review from ingvagabund and tchap October 2, 2025 22:17
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 2, 2025
}

if o.precheckEnabled {
conditions, err := o.precheck(ctx)
Copy link
Member Author

Choose a reason for hiding this comment

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

GitHub doesn't seem to have a knob like Git's -w / --ignore-all-space, but here's the diff rendered that way, to show that I'm just dropping that level of indentation:

$ git --no-pager show --oneline -w
cb28d2778 (HEAD -> remove-obsolete-precheckEnabled, wking/remove-obsolete-precheckEnabled) pkg/cli/admin/upgrade/recommend: Drop obsolete precheckEnabled knob
... 
@@ -188,7 +185,6 @@ func (o *options) Run(ctx context.Context) error {
                issues.Insert(string(configv1.OperatorProgressing))
        }
 
-       if o.precheckEnabled {
        conditions, err := o.precheck(ctx)
        if err != nil {
                if !o.quiet {
@@ -232,7 +228,6 @@ func (o *options) Run(ctx context.Context) error {
                        }
                }
        }
-       }
 
        if c := findClusterOperatorStatusCondition(cv.Status.Conditions, configv1.RetrievedUpdates); c != nil && c.Status != configv1.ConditionTrue {
                if !o.quiet {

Copy link
Member

@petr-muller petr-muller Oct 6, 2025

Choose a reason for hiding this comment

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

Check out the "Hide whitespace" here

Image

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
pkg/cli/admin/upgrade/recommend/recommend.go (1)

211-230: LGTM! Well-structured consolidated output formatting.

The refactored output logic is clean and maintainable:

  • Single quiet flag check wraps all output
  • Consistent formatting across condition categories
  • Proper sorting for deterministic output
  • Clear separation between happy, accepted, and unhappy conditions

Optional: Consider collecting condition details during the initial loop (lines 198-209) to avoid re-iterating through all conditions at lines 224-228. This would be a minor performance improvement:

 var happyConditions []string
 var acceptedConditions []string
 var unhappyConditions []string
+var unhappyConditionDetails []*metav1.Condition
 for _, condition := range conditions {
   if condition.Status == metav1.ConditionTrue {
     happyConditions = append(happyConditions, fmt.Sprintf("%s (%s)", condition.Type, condition.Reason))
   } else {
     issues.Insert(condition.acceptanceName)
     if accept.Has(condition.acceptanceName) {
       acceptedConditions = append(acceptedConditions, condition.Type)
     } else {
       unhappyConditions = append(unhappyConditions, condition.Type)
+      unhappyConditionDetails = append(unhappyConditionDetails, &condition)
     }
   }
 }

Then use unhappyConditionDetails directly in the output block instead of looping through all conditions again.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between a25e854 and cb28d27.

📒 Files selected for processing (2)
  • pkg/cli/admin/upgrade/recommend/examples_test.go (0 hunks)
  • pkg/cli/admin/upgrade/recommend/recommend.go (1 hunks)
💤 Files with no reviewable changes (1)
  • pkg/cli/admin/upgrade/recommend/examples_test.go
🔇 Additional comments (2)
pkg/cli/admin/upgrade/recommend/recommend.go (2)

188-194: LGTM! Clean refactoring to make precheck unconditional.

The precheck is now always invoked, with appropriate error handling that respects the quiet flag and tracks failures in the issues set.


195-209: No issues with acceptanceName usage
All non-true conditions in alerts.go include an acceptanceName; the insertion logic in recommend.go is correct.

@hongkailiu
Copy link
Member

/cc

@openshift-ci openshift-ci bot requested a review from hongkailiu October 3, 2025 00:52
@tchap
Copy link
Contributor

tchap commented Oct 6, 2025

/lgtm

Thanks!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2025
Copy link
Contributor

openshift-ci bot commented Oct 6, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tchap, wking

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

The pull request process is described here

Needs approval from an approver in each of these files:

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

@wking
Copy link
Member Author

wking commented Oct 6, 2025

/verified by @wking based on no functional changes and green presubmits

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Oct 6, 2025
@openshift-ci-robot
Copy link

@wking: This PR has been marked as verified by @wking based on no functional changes and green presubmits.

In response to this:

/verified by @wking based on no functional changes and green presubmits

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.

@wking
Copy link
Member Author

wking commented Oct 6, 2025

/retest-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 229ead6 and 2 for PR HEAD cb28d27 in total

@wking
Copy link
Member Author

wking commented Oct 8, 2025

/retest-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 672ff62 and 1 for PR HEAD cb28d27 in total

Copy link
Contributor

openshift-ci bot commented Oct 10, 2025

@wking: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-e2e-aws-ovn cb28d27 link false /test okd-scos-e2e-aws-ovn
ci/prow/e2e-agnostic-ovn-cmd cb28d27 link true /test e2e-agnostic-ovn-cmd

Full PR test history. Your PR dashboard.

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.

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.

5 participants