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

Modified providerID to unified format #81859

Closed
wants to merge 5 commits into from
Closed

Modified providerID to unified format #81859

wants to merge 5 commits into from

Conversation

bells17
Copy link
Contributor

@bells17 bells17 commented Aug 23, 2019

What type of PR is this?

/kind bug

What this PR does / why we need it:

Modified providerID to unified format.
I think instances.InstanceExistsByProviderID's providerID is needed <provider name>://<instance id> format.
But currently 2 patterns exists like below:

  • <provider name>://<instance id>
  • <instance id>

e.g.:

Which issue(s) this PR fixes:

Special notes for your reviewer:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 23, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @bells17. Thanks for your PR.

I'm waiting for a kubernetes 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 23, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bells17
To complete the pull request process, please assign wlan0
You can assign the PR to them by writing /assign @wlan0 in a comment when ready.

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

@k8s-ci-robot k8s-ci-robot added area/cloudprovider sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 23, 2019
@bells17 bells17 changed the title Modified to unified providerID format Modified providerID to unified format Aug 24, 2019
@neolit123
Copy link
Member

/cc @andrewsykim

@bells17
Copy link
Contributor Author

bells17 commented Aug 25, 2019

Sorry before a review, I fixed typo I found.

providerID := node.Spec.ProviderID
if providerID == "" {
var err error
providerID, err = instances.InstanceID(context.TODO(), types.NodeName(node.Name))
providerID, err = cloudprovider.GetInstanceProviderID(context.TODO(), cloud, types.NodeName(node.Name))
Copy link
Member

Choose a reason for hiding this comment

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

This is originally calling InstanceID for legacy reasons. It only applies if a provider ID isn't already set which shouldn't be the case.

Copy link
Contributor Author

@bells17 bells17 Aug 26, 2019

Choose a reason for hiding this comment

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

@andrewsykim Thank you for commenting.

This is originally calling InstanceID for legacy reasons. It only applies if a provider ID isn't already set which shouldn't be the case.

I understand. But I think if the situation that InstanceID can get an instance id, cloud.ProviderName can get a provider name.
because of cloud.ProviderName is a very simple method what return a provider name string only.
So if the situation that a provider id can use <provider name>://<instance id>, I think a provider id should be a unified format.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I don't quite follow the reasoning yet.

The main reason for actually calling InstanceID here is because (for legacy reasons) it can actually return the cloudprovider.InstanceNotFound error which we check for below. Some providers still depend on that behavior IIRC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrewsykim Ah...I see. Sorry, I mistake.
I fixed my code 😅

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 28, 2019
providerID := node.Spec.ProviderID
if providerID == "" {
var err error
providerID, err = instances.InstanceID(context.TODO(), types.NodeName(node.Name))
Copy link
Member

Choose a reason for hiding this comment

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

Oddly I think using the raw instance type is expected here. See how the AWS provider parses this for example in https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/legacy-cloud-providers/aws/instances.go#L50-L91. I agree it's confusing and not ideal, but I think trying to force the format <provider>://<instance-id> could break some implementations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andrewsykim Um...Sorry, I don't understand.

It looks support <provider>://<instance-id> format because bellow:

And other legacy cloud providers looks support <provider>://<instance-id> too:

azure

gcp

  • // splitProviderID splits a provider's id into core components.
    // A providerID is build out of '${ProviderName}://${project-id}/${zone}/${instance-name}'
    // See cloudprovider.GetInstanceProviderID.
    func splitProviderID(providerID string) (project, zone, instance string, err error) {
    matches := providerIDRE.FindStringSubmatch(providerID)
    if len(matches) != 4 {
    return "", "", "", errors.New("error splitting providerID")
    }
    return matches[1], matches[2], matches[3], nil
    }

vsphere

Copy link
Contributor Author

@bells17 bells17 Sep 10, 2019

Choose a reason for hiding this comment

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

@andrewsykim Hi, as wrote above that looks like InstanceExistsByProviderID method in AWS and other providers support <provider>://<instance-id> format.
So maybe provider ID format could be unified.
But, shouldn't provider ID format be unified?

Copy link
Member

Choose a reason for hiding this comment

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

Ideally it should, but there are some contraints here because we have to support legacy formats of the provider ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I understand.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 23, 2020
@k8s-ci-robot
Copy link
Contributor

@bells17: PR needs rebase.

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 23, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 13, 2020
@bells17 bells17 closed this Apr 8, 2020
@bells17 bells17 deleted the modified-to-unified-providerid-format branch April 8, 2020 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cloudprovider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants