-
Notifications
You must be signed in to change notification settings - Fork 244
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
Refactor labels #5618
Refactor labels #5618
Conversation
✅ Deploy Preview for odo-docusaurus-preview canceled.
|
@feloy: The label(s) 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 kubernetes/test-infra repository. |
@kadel Could you please help review this PR? |
4368eee
to
dba04c8
Compare
func (o selectorBuilder) WithComponent(name string) selectorBuilder { | ||
req, err := labels.NewRequirement(componentLabel, selection.Equals, []string{name}) | ||
if err != nil { | ||
panic(err) |
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.
Is it okay to panic ?
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.
I think it is. The only error that can happen is when the number of values in the last param's array does not match with the operation in the second argument. Here it will never fail because we need one value with the Eq
operation, and we want to fail fast if a developer changes the operation or the last param in a wrong way.
Kudos, SonarCloud Quality Gate passed!
|
/lgtm |
@feloy since there is no issue linked/related to this PR, how should a reviewer go about checking what changes to expect as a result of merging this PR? Is this PR changing the labels applied to the Kubernetes resources created by odo, or is it changing the way we create the labels that are eventually applied to the Kubernetes resources created by odo? |
This is only a code refactoring, the resulting labels in the resources and the selectors used for filtering should be the same before and after this PR |
👍🏾 /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dharmit 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 |
/retest |
/override ci/prow/v4.10-integration-e2e
Tests pass on IBM Cloud |
@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.10-integration-e2e 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 kubernetes/test-infra repository. |
/override ci/prow/v4.10-integration-e2e |
@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.10-integration-e2e 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 kubernetes/test-infra repository. |
* refacto labels * Getters * Builder * Do not export labels * Move to pkg/labels + doc * Fix rebase
What type of PR is this:
/kind cleanup
What does this PR do / why we need it:
This PR refactors the labels packages to completely hide the keys and instead expose the odo-related concepts: component name, app name, etc.
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer: