Skip to content

⚠️ Mark singleton flag in init deprecated#532

Open
qiujian16 wants to merge 1 commit intoopen-cluster-management-io:mainfrom
qiujian16:mark-controleplane-singleton-deprecated
Open

⚠️ Mark singleton flag in init deprecated#532
qiujian16 wants to merge 1 commit intoopen-cluster-management-io:mainfrom
qiujian16:mark-controleplane-singleton-deprecated

Conversation

@qiujian16
Copy link
Member

@qiujian16 qiujian16 commented Jan 30, 2026

Summary

Related issue(s)

Fixes #

Summary by CodeRabbit

  • Deprecations

    • The "singleton" and "singleton-name" flags are deprecated. Users should migrate to Helm chart installation.
  • Changes

    • Removed MulticlusterControlplane from version management and tracking.

@openshift-ci openshift-ci bot requested review from ycyaoxdu and zhujian7 January 30, 2026 06:25
@openshift-ci
Copy link

openshift-ci bot commented Jan 30, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16

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:

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

Walkthrough

This PR deprecates two init command flags ("singleton" and "singleton-name") directing users to Helm chart installation, and removes the MulticlusterControlplane field from the VersionBundle struct across all version entries and related tests.

Changes

Cohort / File(s) Summary
Command Deprecation
pkg/cmd/init/cmd.go
Added deprecation notices via MarkDeprecated for "singleton" and "singleton-name" flags, directing users to install via Helm chart.
Version Structure Refactoring
pkg/version/version.go
Removed MulticlusterControlplane field from VersionBundle struct definition; updated all version bundle initializations (1.0.0, 1.1.0, 1.1.1, 1.2.0, latest) to exclude the field.
Test Adjustments
pkg/version/version_test.go
Updated TestGetVersionBundle to remove MulticlusterControlplane from expected VersionBundle literals; adjusted version value in specific version test case from "v0.16.0" to "v1.1.0".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • 🌱 Bump to v1.1.0 deps #514: Modifies VersionBundle bundles that include MulticlusterControlplane field, directly affected by the field removal in this PR.

Suggested labels

lgtm

Suggested reviewers

  • ycyaoxdu
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains the repository template with empty Summary and Related issue sections; actual implementation details, rationale, and issue references are missing. Add a meaningful Summary section explaining why the singleton flag is being deprecated and what users should do instead; include any relevant issue references in the Related issue section.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: marking the singleton flag as deprecated in the init command, which aligns with the primary modifications in pkg/cmd/init/cmd.go.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


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.

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: 3

🤖 Fix all issues with AI agents
In `@pkg/cmd/init/cmd.go`:
- Around line 63-64: Move the call to MarkDeprecated so it runs after the flag
is registered: define the flag with cmd.Flags().BoolVar(&o.singleton,
"singleton", false, ...) first (the BoolVar call that sets up o.singleton), then
call cmd.Flags().MarkDeprecated("singleton", "install via helm chart directly")
to ensure the FlagSet contains "singleton" before marking it deprecated; update
any error handling around MarkDeprecated instead of discarding returned errors.
- Around line 88-89: The deprecated call is invoked before the flag is defined
and is using the wrong FlagSet; move the MarkDeprecated call to after the flag
is created and call it on the same FlagSet that defines the flag (i.e., after
singletonSet.StringVar(...)) and use
singletonSet.MarkDeprecated("singleton-name", "install via helm chart directly")
so the flag exists and the deprecation is applied on the correct FlagSet.

In `@pkg/version/version_test.go`:
- Around line 10-13: Tests fail because they request a non-existent bundle
"v0.16.0"; update the tests or bundles so the lookup in getVersionBundle
succeeds: either change the test cases that use "v0.16.0" (e.g., the "specific
version" and "override" tests and the expectedVersionBundle variable) to an
existing key such as "v1.0.0"/"1.0.0" or "latest"/"default", or add a
corresponding entry for "0.16.0" into the versionBundleList used by
getVersionBundle in version.go so that VersionBundle lookups succeed and the
override test can apply the bundle-overrides.json as intended.

Comment on lines 88 to 89
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Same issue: MarkDeprecated called before singleton-name flag is defined.

Similar to the singleton flag, MarkDeprecated("singleton-name", ...) is called on line 88 before the flag is defined on line 89. The flag must exist before it can be marked as deprecated.

🐛 Proposed fix
 	singletonSet := pflag.NewFlagSet("singletonSet", pflag.ExitOnError)
-	_ = cmd.Flags().MarkDeprecated("singleton-name", "install via helm chart directly")
 	singletonSet.StringVar(&o.SingletonName, "singleton-name", "singleton-controlplane", "The name of the singleton control plane")
+	_ = singletonSet.MarkDeprecated("singleton-name", "install via helm chart directly")
 	_ = clusterManagerSet.SetAnnotation("singleton-name", "singletonSet", []string{})

Note: The flag is defined on singletonSet, not cmd.Flags(), so MarkDeprecated should also be called on singletonSet.

📝 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
_ = cmd.Flags().MarkDeprecated("singleton-name", "install via helm chart directly")
singletonSet.StringVar(&o.SingletonName, "singleton-name", "singleton-controlplane", "The name of the singleton control plane")
singletonSet := pflag.NewFlagSet("singletonSet", pflag.ExitOnError)
singletonSet.StringVar(&o.SingletonName, "singleton-name", "singleton-controlplane", "The name of the singleton control plane")
_ = singletonSet.MarkDeprecated("singleton-name", "install via helm chart directly")
_ = clusterManagerSet.SetAnnotation("singleton-name", "singletonSet", []string{})
🤖 Prompt for AI Agents
In `@pkg/cmd/init/cmd.go` around lines 88 - 89, The deprecated call is invoked
before the flag is defined and is using the wrong FlagSet; move the
MarkDeprecated call to after the flag is created and call it on the same FlagSet
that defines the flag (i.e., after singletonSet.StringVar(...)) and use
singletonSet.MarkDeprecated("singleton-name", "install via helm chart directly")
so the flag exists and the deprecation is applied on the correct FlagSet.

@qiujian16 qiujian16 force-pushed the mark-controleplane-singleton-deprecated branch from 7c4bdc6 to d73b1b1 Compare January 30, 2026 07:34
Signed-off-by: Jian Qiu <jqiu@redhat.com>
@qiujian16 qiujian16 force-pushed the mark-controleplane-singleton-deprecated branch from d73b1b1 to b11e0dd Compare February 4, 2026 08:44
@zhujian7
Copy link
Member

zhujian7 commented Feb 6, 2026

/lgtm
/hold

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments