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

pass instanceMetadata to updateNodeAddress to reduce api calls #93284

Merged
merged 1 commit into from Sep 16, 2020

Conversation

gongguan
Copy link
Contributor

@gongguan gongguan commented Jul 21, 2020

What type of PR is this?
/kind feature

What this PR does / why we need it:
Pass instanceMetadata to updateNodeAddress to reduce api calls.

Which issue(s) this PR fixes:
Ref #90652

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

None

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


@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/feature Categorizes issue or PR as related to a new feature. 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. area/cloudprovider 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 Jul 21, 2020
@k8s-ci-robot k8s-ci-robot requested review from dims and vishh July 21, 2020 09:09
@gongguan
Copy link
Contributor Author

/retest

@gongguan
Copy link
Contributor Author

/assign @andrewsykim @wojtek-t

@wojtek-t
Copy link
Member

LGTM, but unfortunately we are in code-freeze now and this needs to wait until we start accepting 1.20 PRs.

I would also like @andrewsykim to take a look.

@dims
Copy link
Member

dims commented Jul 27, 2020

/uncc
/milestone v1.20

@k8s-ci-robot k8s-ci-robot removed the request for review from dims July 27, 2020 10:58
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Jul 27, 2020
@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 Jul 29, 2020
@gongguan gongguan force-pushed the instancemeta branch 3 times, most recently from 71b43dd to 6d2052e Compare July 29, 2020 09:28
@gongguan
Copy link
Contributor Author

/retest

@gongguan
Copy link
Contributor Author

/retest

@andrewsykim
Copy link
Member

Sorry for the delay @gongguan -- I'll review this soon

@gongguan
Copy link
Contributor Author

gongguan commented Sep 3, 2020

Sorry for the delay @gongguan -- I'll review this soon

No sorry, there is something wrong I'll fix it now, you can review after ci passed.

@gongguan gongguan force-pushed the instancemeta branch 2 times, most recently from 28c7f7e to 53aba78 Compare September 3, 2020 14:05
@gongguan
Copy link
Contributor Author

gongguan commented Sep 4, 2020

/retest

@gongguan
Copy link
Contributor Author

gongguan commented Sep 4, 2020

@andrewsykim ready for review now :)

Copy link
Member

@andrewsykim andrewsykim left a comment

Choose a reason for hiding this comment

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

LGTM, minor comment about error logging

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 12, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 15, 2020
@gongguan
Copy link
Contributor Author

/test pull-kubernetes-e2e-kind-ipv6

@gongguan
Copy link
Contributor Author

LGTM, minor comment about error logging

@andrewsykim addressed and rebased, PTAL.

Copy link
Member

@andrewsykim andrewsykim left a comment

Choose a reason for hiding this comment

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

Sorry, had one more comment

if err != nil {
return nil, err
var nodeModifiers []nodeModifier
if node.Spec.ProviderID != providerID {
Copy link
Member

Choose a reason for hiding this comment

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

I think this check needs to be updated to

if node.Spec.ProviderID == "" && providerID != "" {

otherwise we might try to set an existing node.Spec.ProviderID to "". What do you think?

Copy link
Contributor Author

@gongguan gongguan Sep 16, 2020

Choose a reason for hiding this comment

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

Done as your suggestion, it is more legible.

otherwise we might try to set an existing node.Spec.ProviderID to "". What do you think?

No, in line 454(getProviderID function), providerID will be set as node.Spec.ProviderID if node.Spec.ProviderID not nil. That means node.Spec.ProviderID not equal to providerID only occurs when node.Spec.ProviderID not set.

Copy link
Member

Choose a reason for hiding this comment

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

No, in line 454(getProviderID function), providerID will be set as node.Spec.ProviderID if node.Spec.ProviderID not nil. That means node.Spec.ProviderID not equal to providerID only occurs when node.Spec.ProviderID not set.

Good point

@andrewsykim
Copy link
Member

/retest

@gongguan
Copy link
Contributor Author

should set TCP CLOSE_WAIT timeout [Privileged] failed.

/test pull-kubernetes-e2e-kind-ipv6

instanceMetadata, err := cnc.getInstanceNodeAddresses(ctx, &nodes.Items[i])
if err != nil {
klog.Errorf("Error getting instance metadata for node addresses: %v", err)
return
Copy link
Member

Choose a reason for hiding this comment

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

this should probably be continue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, fixed.

nodeModifiers, err := cnc.getNodeModifiersFromCloudProvider(ctx, curNode)
providerID, err := cnc.getProviderID(ctx, curNode)
if err != nil {
utilruntime.HandleError(fmt.Errorf("failed to initialize node %s at cloudprovider: %v", node.Name, err))
Copy link
Member

Choose a reason for hiding this comment

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

This error message should probably be specific to getting the providerID:

utilruntime.HandleError(fmt.Errorf("failed to get provider ID for node %s: %v", node.Name, err))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


instanceMetadata, err := cnc.getInstanceMetadata(ctx, providerID, curNode)
if err != nil {
utilruntime.HandleError(err)
Copy link
Member

Choose a reason for hiding this comment

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

Wrap this error similar to other calls to HandleError here

utilruntime.HandleError(fmt.Errorf("failed to get instance metadata for node %s: %v", node.Name, err))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@andrewsykim andrewsykim left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

Thanks @gongguan

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 16, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewsykim, gongguan

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 Sep 16, 2020
@k8s-ci-robot k8s-ci-robot merged commit 9621ac6 into kubernetes:master Sep 16, 2020
@gongguan gongguan deleted the instancemeta branch September 16, 2020 16:02
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. area/cloudprovider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. 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.

None yet

6 participants