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

Bug 1846093: Improve bootstrap reliability on heterogeneous UPI network configurations #384

Merged

Conversation

ironcladlou
Copy link
Contributor

@ironcladlou ironcladlou commented Jun 22, 2020

Before this change, bootstrap IP discovery assumed that the first address of the
unicast interface must be the bootstrap IP. This assumption doesn't always hold
in the face of user-defined interfaces and addresses whose ordering isn't
guaranteed. When the assumptions are broken and the incorrect bootstrap IP is
selected, bootstrapping fails because quorum cannot be established.

This change improves the accuracy of bootstrap IP discovery by more flexibly
accounting for a wider variety of possible network interface configurations.

An IP is now considered the bootstrap IP if all of the following are true.

For IPv4:

  • The IP is contained by the machine CIDR defined in the cluster configuration
  • On bare metal platforms, the IP is not the API or DNS VIP in the cluster configuration

For IPv6, the same must be true in addition to the following:

  • The IP is not deprecated
  • The IP is routable according at least one non-default route

This work is adapted from https://github.com/openshift/baremetal-runtimecfg/blob/master/pkg/utils/utils.go.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 22, 2020
@ironcladlou
Copy link
Contributor Author

Still need to play with this in a new cluster's bootstrapping environment, here's how it looks on an already solvent master ipv4 GCP master node:

I0622 20:29:00.242715      81 bootstrap_ip_linux.go:37] retrieved Address map map[0xc000262c30:[127.0.0.1/8 lo ::1/128] 0xc0005707e0:[10.129.0.74/23 eth0 fe80::7c73:6eff:fe59:f9ad/64]]
I0622 20:29:00.242841      81 bootstrap_ip_linux.go:114] Checking whether address 127.0.0.1/8 lo contains VIP 10.129.0.74
I0622 20:29:00.242929      81 bootstrap_ip_linux.go:56] Ignoring route non Router advertisement route {Ifindex: 3 Dst: fe80::/64 Src: <nil> Gw: <nil> Flags: [] Table: 254}
I0622 20:29:00.242953      81 bootstrap_ip_linux.go:66] Retrieved route map map[]
I0622 20:29:00.242976      81 bootstrap_ip_linux.go:114] Checking whether address 10.129.0.74/23 eth0 contains VIP 10.129.0.74
I0622 20:29:00.242986      81 bootstrap_ip_linux.go:116] Address 10.129.0.74/23 eth0 contains VIP 10.129.0.74
I0622 20:29:00.242995      81 bootstrap_ip_linux.go:114] Checking whether address fe80::7c73:6eff:fe59:f9ad/64 contains VIP 10.129.0.74
10.129.0.74

@ironcladlou
Copy link
Contributor Author

What role should machineCIDR play in this discovery?

@ironcladlou
Copy link
Contributor Author

@hexfusion @celebdor the latest commit here refactors the detection to add an additional filter that ensures candidate IPs are contained in the machine CIDR.

One caveat here is that I'm not sure if machineCIDR is always present. In the current code, I'm assuming that if machineCIDR is unavailable, no machine CIDR containment check will happen (but we do now produce a warning). The net effect in that case is that it's theoretically possible to select an IP which is routable but outside the unknown machine CIDR. I'm not entirely sure what the right assumption here should be.

Is machine CIDR truly optional? How should the product react when machine CIDR is unknown here?

@hexfusion
Copy link
Contributor

great questions and ones that needs to be answered before this merges

@hardys
Copy link
Contributor

hardys commented Jun 24, 2020

@hexfusion @celebdor the latest commit here refactors the detection to add an additional filter that ensures candidate IPs are contained in the machine CIDR.

One caveat here is that I'm not sure if machineCIDR is always present. In the current code, I'm assuming that if machineCIDR is unavailable, no machine CIDR containment check will happen (but we do now produce a warning). The net effect in that case is that it's theoretically possible to select an IP which is routable but outside the unknown machine CIDR. I'm not entirely sure what the right assumption here should be.

Is machine CIDR truly optional? How should the product react when machine CIDR is unknown here?

Looking at the installer interfaces I think it's mandatory:

https://github.com/openshift/installer/blob/master/pkg/types/validation/installconfig.go#L249

It's marked as optional in the install-config schema, but AFAICS that's only to enable backwards compatibility with machineNetwork and the now-deprecated machineCIDR interface

https://github.com/openshift/installer/blob/master/pkg/types/installconfig.go#L213

https://github.com/openshift/installer/blob/master/pkg/types/installconfig.go#L234

@ironcladlou
Copy link
Contributor Author

@hardys

@hexfusion @celebdor the latest commit here refactors the detection to add an additional filter that ensures candidate IPs are contained in the machine CIDR.
One caveat here is that I'm not sure if machineCIDR is always present. In the current code, I'm assuming that if machineCIDR is unavailable, no machine CIDR containment check will happen (but we do now produce a warning). The net effect in that case is that it's theoretically possible to select an IP which is routable but outside the unknown machine CIDR. I'm not entirely sure what the right assumption here should be.
Is machine CIDR truly optional? How should the product react when machine CIDR is unknown here?

Looking at the installer interfaces I think it's mandatory:

https://github.com/openshift/installer/blob/master/pkg/types/validation/installconfig.go#L249

It's marked as optional in the install-config schema, but AFAICS that's only to enable backwards compatibility with machineNetwork and the now-deprecated machineCIDR interface

https://github.com/openshift/installer/blob/master/pkg/types/installconfig.go#L213

https://github.com/openshift/installer/blob/master/pkg/types/installconfig.go#L234

Thank you for digging that up. Would it make sense then for us to fail fast and loudly if the machine CIDR is empty?

@ironcladlou
Copy link
Contributor Author

/retest

@ironcladlou
Copy link
Contributor Author

Latest revision disentangles render from all bootstrap IP determination by moving all that stuff into the bootstrap_* files. Also cleaned up that code and added a fail-fast check which asserts machine CIDR is required.

@ironcladlou ironcladlou force-pushed the bootstrap-ip-discovery branch 2 times, most recently from f767ab1 to e2449fd Compare July 1, 2020 20:08
@ironcladlou ironcladlou changed the title WIP: make bootstrap IP discovery more robust Improve bootstrap reliability on heterogeneous UPI network configurations Jul 1, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2020
@ironcladlou
Copy link
Contributor Author

I still really owe this work some unit tests, but it's ready for some detailed review. So far testing has been manual.

@ironcladlou
Copy link
Contributor Author

cc @celebdor would love any feedback and fact checking you can spare on this one

Copy link
Contributor

@hexfusion hexfusion left a comment

Choose a reason for hiding this comment

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

@ironcladlou looks good in general, a few questions.

pkg/cmd/render/bootstrap_ip.go Show resolved Hide resolved
pkg/cmd/render/bootstrap_ip_linux.go Show resolved Hide resolved
pkg/cmd/render/render.go Show resolved Hide resolved
pkg/cmd/render/bootstrap_ip.go Show resolved Hide resolved
pkg/cmd/render/bootstrap_ip.go Outdated Show resolved Hide resolved
pkg/cmd/render/bootstrap_ip.go Show resolved Hide resolved
pkg/cmd/render/bootstrap_ip.go Outdated Show resolved Hide resolved
pkg/cmd/render/bootstrap_ip_linux.go Show resolved Hide resolved
@ironcladlou ironcladlou changed the title Improve bootstrap reliability on heterogeneous UPI network configurations Bug 1846093: Improve bootstrap reliability on heterogeneous UPI network configurations Jul 7, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Jul 7, 2020
@openshift-ci-robot
Copy link

@ironcladlou: This pull request references Bugzilla bug 1846093, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1846093: Improve bootstrap reliability on heterogeneous UPI network configurations

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.

@ironcladlou
Copy link
Contributor Author

Added a couple of unit tests. During the course of that I had to do a little refactoring and also discovered a bit of brittle logic around ipv6 handling (using length check to detect the family can be flaky depending on how the address struct is allocated; I switched to using net.To4() which I think is more stable).

@hexfusion ptal

@hexfusion
Copy link
Contributor

/retest

@hexfusion
Copy link
Contributor

@hexfusion
Copy link
Contributor

hmm CI looks hosed :(

@hexfusion
Copy link
Contributor

/retest

@hexfusion
Copy link
Contributor

/test e2e-gcp-upgrade

@ironcladlou
Copy link
Contributor Author

The metal failure could be something legit with ipv6, need to investigate

@hexfusion
Copy link
Contributor

@stbenjam we are nervous to merge this with metal failing.

cc @romfreiman

@ironcladlou
Copy link
Contributor Author

Okay, I had a chance to dig in to the metal-ipi failures, and the bootstrap IP seems to have been successfully identified and etcd is coming up — I didn't dig further into what might be the root cause of the overall failures. I need to rebase now, so I'll do that and squash again and go through another round of CI tests.

…ions

Before this change, bootstrap IP discovery assumed that the first address of the
unicast interface must be the bootstrap IP. This assumption doesn't always hold
in the face of user-defined interfaces and addresses whose ordering isn't
guaranteed. When the assumptions are broken and the incorrect bootstrap IP is
selected, bootstrapping fails because quorum cannot be established.

This change improves the accuracy of bootstrap IP discovery by more flexibly
accounting for a wider variety of possible network interface configurations.

An IP is now considered the bootstrap IP if all of the following are true.

For IPv4:

* The IP is contained by the machine CIDR defined in the cluster configuration
* On bare metal platforms, the IP is not the API or DNS VIP in the cluster configuration

For IPv6, the same must be true in addition to the following:

* The IP is not deprecated
* The IP is routable according at least one non-default route

This work is adapted from https://github.com/openshift/baremetal-runtimecfg/blob/master/pkg/utils/utils.go.
@hexfusion
Copy link
Contributor

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 9, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hexfusion, ironcladlou

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

11 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 9, 2020

@ironcladlou: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-azure 9340f51 link /test e2e-azure
ci/prow/e2e-aws-disruptive 9340f51 link /test e2e-aws-disruptive

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.

@openshift-merge-robot openshift-merge-robot merged commit ec29313 into openshift:master Jul 9, 2020
@openshift-ci-robot
Copy link

@ironcladlou: All pull requests linked via external trackers have merged: openshift/cluster-etcd-operator#384. Bugzilla bug 1846093 has been moved to the MODIFIED state.

In response to this:

Bug 1846093: Improve bootstrap reliability on heterogeneous UPI network configurations

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.

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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants