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

⚠️ Use consistent naming for API constants #7618

Merged

Conversation

chiukapoor
Copy link
Contributor

Signed-off-by: Chirayu Kapoor dev.csociety@gmail.com

What this PR does / why we need it:
Fixes the inconsistent constant names

Which issue(s) this PR fixes
Fixes #7611

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 24, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @chiukapoor. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 24, 2022
@sbueringer
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 25, 2022
// external objects(bootstrap and infrastructure providers).
ClusterLabelName = "cluster.x-k8s.io/cluster-name"
ClusterNameLabel = "cluster.x-k8s.io/cluster-name"
Copy link
Member

@sbueringer sbueringer Nov 25, 2022

Choose a reason for hiding this comment

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

The renames should be eventually all added to the migration doc.

The migration doc should be created by the release team in 1-2 weeks: https://github.com/kubernetes-sigs/cluster-api/blob/d146f6d9e264241c5db29e8ecf99a390ab97807d/docs/release/release-tasks.md#add-docs-to-collect-release-notes-for-users-and-migration-notes-for-provider-implementers

Theoretically we could do it here already but I would like to give the first release team a chance to try out our new release process, ...

Copy link
Member

Choose a reason for hiding this comment

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

Let's also in general hold merging this PR until at least after the v1.3.0 release (1st December) just to ensure it doesn't interfere with the release / cherry-picks until then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will make sure the PR is on hold until at least after the v1.3.0 release.

@sbueringer
Copy link
Member

In general looks fine +/- the comments above.

Given the amount of files that have to be touched for those renames. Maybe you can do further renames for now in separate commits and then we can see how big the impact overall is and potentially decide to move individual commits to separate PRs?

Although this label should be pretty much the one with the most usage.

@chiukapoor
Copy link
Contributor Author

Sure @sbueringer, Will make commits to this PR for now, and later we may decide upon if it requires separate PRs 👍

@sbueringer
Copy link
Member

Sounds perfect, thank you!

@chiukapoor
Copy link
Contributor Author

chiukapoor commented Nov 25, 2022

Updated the constant from ClusterTopologyMachineDeploymentLabelName to ClusterTopologyMachineDeploymentNameLabel

@chiukapoor
Copy link
Contributor Author

Updated the constant from ProviderLabelName to ProviderLabel, executed the test using make test [passed]

@chiukapoor
Copy link
Contributor Author

chiukapoor commented Nov 25, 2022

@sbueringer, While working on label ProvideLabel, the file hack/tools/tilt-prepare/main.go was updated. Do we need to run make tilt-prepare to update the Tiltfile?

@sbueringer
Copy link
Member

sbueringer commented Nov 28, 2022

While working on label ProvideLabel, the file hack/tools/tilt-prepare/main.go was updated. Do we need to run make tilt-prepare to update the Tiltfile?

No that's fine. The tiltfile is using the tilt-prepare binary at runtime. tilt-prepare does not generate the Tiltfile.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 28, 2022
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

overall lgtm from my side

// This label allows to easily identify all the components belonging to a provider; the clusterctl
// tool uses this label for implementing provider's lifecycle operations.
ProviderLabelName = "cluster.x-k8s.io/provider"
ProviderLabel = "cluster.x-k8s.io/provider"
Copy link
Member

Choose a reason for hiding this comment

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

q: should this be

Suggested change
ProviderLabel = "cluster.x-k8s.io/provider"
ProviderNameLabel = "cluster.x-k8s.io/provider"

@sbueringer opinions?

Copy link
Member

@sbueringer sbueringer Nov 29, 2022

Choose a reason for hiding this comment

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

I'm not sure

The following keeps the mapping from label string to constant name simple and straight-forward:

I would suggest to only include a Name in the constant name if the label actually contains name. In that case we should include it before Label and not after.
#7611

If the label string itself is wrong ideally we would fix the label string to cluster.x-k8s.io/provider-name, but it's a non-trivial effort.

I think for better readability of consumer code I would make an exception to the naming rule and go with your suggestion (ProviderNameLabel) for this label. As far as I can tell it's the only label where we have this problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I will inculcate the changes.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 29, 2022
@chiukapoor chiukapoor changed the title 🌱 [WIP] Fixing inconsistent constant names 🌱 Fixing inconsistent constant names Nov 29, 2022
@chiukapoor
Copy link
Contributor Author

Hello @sbueringer and @fabriziopandini, I have fixed all the constants with inconsistency mentioned in #7611 and have made the requested change of ProviderLabel to ProviderNameLabel.

PTAL

@fabriziopandini
Copy link
Member

Please squash commits, I will take a look right after

Signed-off-by: Chirayu Kapoor <dev.csociety@gmail.com>
@k8s-ci-robot
Copy link
Contributor

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

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main f2ba999 link false /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@chiukapoor
Copy link
Contributor Author

chiukapoor commented Nov 29, 2022

@fabriziopandini The commits have been squashed, I have also fixed the below mismatch in the comment and function name.

// assertClusterTopologyOwnedLabel asserts the label exists and is set to the correct value.
func assertClusterLabelName(got client.Object, clusterName string) error {

Also, as per the update from @sbueringer in reply #7618 (comment), the PR merge needs to be on hold until 1.3.0 release.

@chiukapoor chiukapoor requested review from fabriziopandini and removed request for enxebre and JoelSpeed November 30, 2022 13:13
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

One last nit from my side
Also, @sbueringer what about marking this PR as ⚠️ so it will pop up in the 1.4 release notes

// This label allows to easily identify all the components belonging to a provider; the clusterctl
// tool uses this label for implementing provider's lifecycle operations.
ProviderLabelName = "cluster.x-k8s.io/provider"
ProviderNameLabel = "cluster.x-k8s.io/provider"
Copy link
Member

Choose a reason for hiding this comment

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

As per @sbueringer this should be

Suggested change
ProviderNameLabel = "cluster.x-k8s.io/provider"
ProviderLabel = "cluster.x-k8s.io/provider"

(the label is just provider, not provider-name)

Copy link
Contributor Author

@chiukapoor chiukapoor Nov 30, 2022

Choose a reason for hiding this comment

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

As per the @sbueringer suggestion in reply #7618 (comment) I made this exception. Please do let me know if I should revert it?

I think for better readability of consumer code I would make an exception to the naming rule and go with your suggestion (ProviderNameLabel) for this label. As far as I can tell it's the only label where we have this problem.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with ProviderNameLabel for the stated reason. @fabriziopandini I'm also fine with ProviderLabel if you prefer it.

@sbueringer
Copy link
Member

One last nit from my side Also, @sbueringer what about marking this PR as ⚠️ so it will pop up in the 1.4 release notes

Yup let's do that.

/retitle ⚠️ Use consistent naming for API constants

@k8s-ci-robot k8s-ci-robot changed the title 🌱 Fixing inconsistent constant names ⚠️ Use consistent naming for API constants Dec 2, 2022
@sbueringer
Copy link
Member

/lgtm

I think we can merge this before the migration doc. Let's just keep the corresponding issue open and do a follow-up PR for: https://github.com/kubernetes-sigs/cluster-api/pull/7618?notification_referrer_id=NT_kwDOAEckWLI0OTIxNDA3OTc1OjQ2NjIzNjA&notifications_query=repo%3Akubernetes-sigs%2Fcluster-api#discussion_r1031997700

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 2, 2022
@chiukapoor
Copy link
Contributor Author

Let's just keep the corresponding issue open and do a follow-up PR for: https://github.com/kubernetes-sigs/cluster-api/pull/7618?notification_referrer_id=NT_kwDOAEckWLI0OTIxNDA3OTc1OjQ2NjIzNjA&notifications_query=repo%3Akubernetes-sigs%2Fcluster-api#discussion_r1031997700

@sbueringer should I create another PR attached to #7611 for the migration doc? If yes, what should be added to the doc?

Also, how may I resolve the pull-cluster-api-apidiff-main test?

@sbueringer
Copy link
Member

sbueringer commented Dec 2, 2022

@sbueringer should I create another PR attached to #7611 for the migration doc? If yes, what should be added to the doc?

Let's just add a comment to #7611 for now and make sure that the current PR does not close the issue (change "fixes" in the pr description to "Part of")

Also, how may I resolve the pull-cluster-api-apidiff-main test?

You don't have to resolve it. It's just an indiciation for reviewers that we change an API. It's optional for merge.

@fabriziopandini
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 2, 2022
@k8s-ci-robot k8s-ci-robot merged commit 40b6090 into kubernetes-sigs:main Dec 2, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Dec 2, 2022
chiukapoor added a commit to chiukapoor/cluster-api that referenced this pull request Jan 31, 2023
Signed-off-by: Chirayu Kapoor <dev.csociety@gmail.com>
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use suffixes consistently in API constants
4 participants