Skip to content
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

[wip]OTA-1010: pull GetImplicitlyEnabledCapabilities from the cvo repo #1908

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hongkailiu
Copy link
Member

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 Dec 11, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 11, 2024

@hongkailiu: This pull request references OTA-1010 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 story to target the "4.19.0" version, but no target version was set.

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.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 11, 2024
@openshift-ci openshift-ci bot requested review from bertinatto and deads2k December 11, 2024 21:19
Copy link
Contributor

openshift-ci bot commented Dec 11, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hongkailiu
Once this PR has been reviewed and has the lgtm label, please assign p0lyn0mial for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@hongkailiu hongkailiu force-pushed the OTA-1010 branch 5 times, most recently from f187e0e to 8c7531f Compare December 12, 2024 17:11
@hongkailiu hongkailiu force-pushed the OTA-1010 branch 2 times, most recently from 9cd9e07 to 9cbf3c7 Compare December 12, 2024 21:06
@hongkailiu hongkailiu changed the title [wip]OTA-1010: pull GetImplicitlyEnabledCapabilities from the cvo repo OTA-1010: pull GetImplicitlyEnabledCapabilities from the cvo repo Dec 12, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 12, 2024
@hongkailiu
Copy link
Member Author

/cc @wking @petr-muller

Copy link
Member

@petr-muller petr-muller left a comment

Choose a reason for hiding this comment

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

Code is just a lift from CVO so maybe that's enough, but it actually looks quite legacy and I would be in favor of some significant refactors if this was new code. And because we're including this in a library, I believe it should meet the bar for new code.

The capabilities are basically treated as sets but we do not use apimachinery Set type and include a lot of code that would not be needed if we used it.

pkg/capability/capability_test.go Outdated Show resolved Hide resolved
pkg/capability/capability.go Outdated Show resolved Hide resolved
pkg/capability/capability.go Outdated Show resolved Hide resolved
Comment on lines 21 to 23
func GetImplicitlyEnabledCapabilities(enabledCapabilities []configv1.ClusterVersionCapability,
capabilities []configv1.ClusterVersionCapability,
clusterCapabilities ClusterCapabilities) []configv1.ClusterVersionCapability {
Copy link
Member

Choose a reason for hiding this comment

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

TBH the signature and the godoc does not help too much in understanding what is the purpose of the method and what (high-level, semantic) operation ti performs. You give it some capabilities, and it filters some out. It is supposed to return implicitly enabled capabilities, but at the same time, it filters the content of clusterCapabilities.ImplicitlyEnabledCapabilities out? That's confusing. Also, if I am a caller, how is enabledCapabilities different from clusterCapabilities.EnabledCapabilities?

Also, they are all capabilities, so calling the variables as such does not help much. Could we call them enabled and input or something that carries more semantics?

pkg/capability/capability.go Outdated Show resolved Hide resolved
pkg/capability/capability.go Show resolved Hide resolved
pkg/capability/capability.go Outdated Show resolved Hide resolved
@petr-muller
Copy link
Member

Also I think the commit and the PR needs descriptions to explain why the code is pulled from CVO and where do we intend to use it.

@hongkailiu hongkailiu changed the title OTA-1010: pull GetImplicitlyEnabledCapabilities from the cvo repo [wip]OTA-1010: pull GetImplicitlyEnabledCapabilities from the cvo repo Dec 13, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 13, 2024
@hongkailiu
Copy link
Member Author

I was thinking about "set" too but did not go.
Let me refactor with it now.


// GetImplicitlyEnabledCapabilities returns the capabilities from
// a set of capabilities that are not (even implicitly) enabled in ClusterCapabilities:
func GetImplicitlyEnabledCapabilities(
Copy link
Member Author

Choose a reason for hiding this comment

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

This one seems too simple to be exported.
Let me think.

Copy link
Contributor

openshift-ci bot commented Dec 13, 2024

@hongkailiu: all tests passed!

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
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants