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

[RFC] Prepare for deprecating NodeLegacyHostIP #36095

Merged

Conversation

caesarxuchao
Copy link
Member

@caesarxuchao caesarxuchao commented Nov 2, 2016

Ref #9267 (comment)

What this PR does

  • Add comments saying "LegacyHostIP" will be deprecated in 1.7;
  • Add v1.NodeLegacyHostIP to be consistent with the internal API (useful for client-go migration [RFC] Migrating kubernetes components to use client-go #35159)
  • Let cloudproviders who used to only set LegacyHostIP set the IP as both InternalIP and ExternalIP
  • Master used to ssh tunnel to node's ExternalIP or LegacyHostIP to do healthz check. OTOH, if on-prem, kubelet only sets LegacyHostIP or InternalIP. In order to deprecate LegacyHostIP in 1.7, I let healthz check to use InternalIP if ExternalIP is not available. (The healthz check is the only consumer of LegacyHostIP in k8s.)

@liggitt @justinsb @bgrant0607

LegacyHostIP will be deprecated in 1.7.

This change is Reviewable

@caesarxuchao caesarxuchao changed the title Prepare for deprecating NodeLegacyHostIP [RFC] Prepare for deprecating NodeLegacyHostIP Nov 2, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins unit/integration failed for commit 73743d6. Full PR test history.

The magic incantation to run this job again is @k8s-bot unit test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Nov 2, 2016
func findExternalAddress(node *api.Node) (string, error) {
var fallback string
// findAddress returns address in this order: ExternalIP, InternalIP, LegacyHostIP.
func findAddress(node *api.Node) (string, error) {
Copy link
Member

@liggitt liggitt Nov 3, 2016

Choose a reason for hiding this comment

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

use GetPreferredNodeAddress(node, []{externalIP, internalIP, legacyHostIP})

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. PTAL. Thanks.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 3, 2016
@caesarxuchao caesarxuchao force-pushed the deprecate-LegacyHostIP branch from 73743d6 to 1fe68b2 Compare November 4, 2016 02:11
@caesarxuchao caesarxuchao added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Nov 4, 2016
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 4, 2016
@caesarxuchao caesarxuchao assigned liggitt and unassigned erictune Nov 4, 2016
preferredAddressTypes := []api.NodeAddressType{
api.NodeExternalIP,
api.NodeInternalIP,
api.NodeLegacyHostIP,
Copy link
Member

@liggitt liggitt Nov 4, 2016

Choose a reason for hiding this comment

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

would like someone familiar with the tunneling setup to comment... @mikedanese / @cjcullen? we weren't using NodeInternalIP for tunneling before... is that valid? I think the point of tunneling is that the master isn't on the same network, so internal IP is not likely to work

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. We can't use an internal IP for tunneling.

@caesarxuchao caesarxuchao force-pushed the deprecate-LegacyHostIP branch from 1fe68b2 to 42c03a8 Compare November 4, 2016 20:52
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2016
@caesarxuchao caesarxuchao force-pushed the deprecate-LegacyHostIP branch from 42c03a8 to 10b95b5 Compare November 4, 2016 20:54
@@ -354,14 +355,18 @@ type nodeAddressProvider struct {
}

func (n nodeAddressProvider) externalAddresses() (addresses []string, err error) {
preferredAddressTypes := []api.NodeAddressType{
Copy link
Member Author

Choose a reason for hiding this comment

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

I misunderstood the tunneling healthz. The tunneling shouldn't use the InternalIP.

Now the changes to this file do not change any logic. The only change is reusing the utility function in pkg/util/node.

@caesarxuchao
Copy link
Member Author

@liggitt do you agree with the cloudprovider changes?

@@ -408,7 +408,11 @@ func (i *Instances) NodeAddresses(nodeName types.NodeName) ([]api.NodeAddress, e
glog.V(2).Infof("NodeAddresses(%v) => %v", serverName, ip)

// net.ParseIP().String() is to maintain compatibility with the old code
Copy link
Member

@liggitt liggitt Nov 4, 2016

Choose a reason for hiding this comment

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

parse to string once, assign multiple times

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks.

@liggitt
Copy link
Member

liggitt commented Nov 4, 2016

I think so. If a cloudprovider doesn't differentiate between internal/external, it makes sense to register it for both

@caesarxuchao caesarxuchao force-pushed the deprecate-LegacyHostIP branch from 10b95b5 to f3c096e Compare November 4, 2016 21:16
@liggitt
Copy link
Member

liggitt commented Nov 4, 2016

I1104 13:58:17.061] FAILED   hack/make-rules/../../hack/verify-bazel.sh 22s

@liggitt
Copy link
Member

liggitt commented Nov 4, 2016

LGTM otherwise

Mark NodeLegacyHostIP will be deprecated in 1.7;
Let cloudprovider that used to only set NodeLegacyHostIP set the IP as both InternalIP and ExternalIP, to allow dprecation in 1.7
@caesarxuchao
Copy link
Member Author

Thanks! Applying the label per comment.

@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 4, 2016
@caesarxuchao caesarxuchao added this to the v1.5 milestone Nov 4, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins verification failed for commit f3c096e2723ebe820661815dfa8f4024ae997db5. Full PR test history.

The magic incantation to run this job again is @k8s-bot verify test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@caesarxuchao caesarxuchao force-pushed the deprecate-LegacyHostIP branch from f3c096e to 783af94 Compare November 4, 2016 22:44
@caesarxuchao caesarxuchao added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Nov 4, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 0068c30 into kubernetes:master Nov 7, 2016
k8s-github-robot pushed a commit that referenced this pull request Aug 12, 2017
Automatic merge from submit-queue (batch tested with PRs 50537, 49699, 50160, 49025, 50205)

When not using a CloudProvider, set both InternalIP and ExternalIP on Nodes

#36095 changed all of the cloudproviders to set both InternalIP and ExternalIP on Nodes, but the non-cloudprovider fallback code now only sets InternalIP.

This causes the test "should be able to create a functioning NodePort service" in test/e2e/service.go to fail on cloud-provider-less clusters, because (with LegacyHostIP gone), it now will only try to work with ExternalIPs, and will fail if the node has only an InternalIP.

There isn't much other code that assumes that ExternalIP will always be set (there's something in pkg/master/master.go, but I don't know what it's doing, so maybe it's only useful in the case where InternalIP != ExternalIP anyway). But given that several of the cloudproviders (mesos, ovirt, rackspace) now explicitly set both InternalIP and ExternalIP to the same value always, it seemed right to do that in the fallback case too.

@deads2k FYI

**Release note**:
```release-note
NONE
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants