-
Notifications
You must be signed in to change notification settings - Fork 428
[baremetal] Add dispatcher script to statically configure DHCP address #2188
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
[baremetal] Add dispatcher script to statically configure DHCP address #2188
Conversation
/hold This is a PoC. If we decide to pursue this it will almost certainly need some refinement. |
#!/bin/bash | ||
set -ex | ||
|
||
if [ ${DHCP4_DHCP_LEASE_TIME:-0} -lt 4294967295 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this not exist in IPv6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only implemented ipv4 in this version. Based on my discussion with the NM team, I would probably argue that for this use case in ipv6 we should just use SLAAC addressing. If there's a reason we can't do that then we can always add support for DHCPv6 here too.
templates/common/baremetal/files/NetworkManager-static-dhcp.yaml
Outdated
Show resolved
Hide resolved
9f7811e
to
e1eb368
Compare
e1eb368
to
bb77aab
Compare
/hold cancel I've tested this locally with infinite DHCP leases and it worked fine. |
/retest |
This is essentially an ipv6 version of openshift#2188. Co-authored-by: Antoni Segura Puimedon <[email protected]>
/hold We discovered that this would cause problems on reboot. Fix coming. |
8c8441f
to
c8ed64a
Compare
This is essentially an ipv6 version of openshift#2188. Co-authored-by: Antoni Segura Puimedon <[email protected]>
a78db50
to
0551cd9
Compare
dceaf9f
to
e905d8c
Compare
Just tested it with a small modification on one of my masters with openshift-sdn. It worked well. Here some snippets:
After making these changes, that make sure that it works for openshift SDN and for OVN kubernetes, you can see in the following image that there is a reboot of master-0 (I also rebooted master-1) after I had killed the dnsmasq that provided DHCP functionality. |
We have a feature request for nodes to be able to initially get assigned their IP addresses via infinite DHCP leases, but then to have those addresses statically configured on the node so that if the DHCP server is unavailable for any reason they don't lose their network configuration. This adds a dispatcher script for NetworkManager that does so. It looks at the DHCP assigned network settings and adds static configuration with the same values.
e905d8c
to
ca1e125
Compare
/hold cancel I also had success rebooting nodes with the latest version of this. I think it's good to go. |
/lgtm The version in this PR now matches what I tested successfully in #2188 (comment) |
overall lgtm. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: celebdor, cybertron, sinnykumari 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 |
/retest |
/retest |
NetworkManager dispatcher scripts 30-static-dhcp and 30-static-dhcpv6 modify the NetworkManager connection of the OVS interface ovs-if-br-ex in case of a infinite DHCP lease: They will change ipv4.method and ipv6.method from auto to manual in order to statically assign DHCP addresses etc. The purpose of this feature was to enable nodes to keep their network configuration and network connectivity when their DHCP server becomes unavailable for any reason [0]. For example, this allowed users to deploy OpenShift nodes with "static" ip addresses, i.e. ip addresses with infitite DHCP leases, using an initial DHCP server that would then be removed once the cluster is up. However, the changes by the dispatcher scripts to NM connection ovs-if-br-ex were saved to disk which broke the rollback behaviour of configure-ovs.sh (ovs-configuration.service): OVN-Kubernetes configuration is rolled back and (re)generated on every boot, to take in account any changes that have possibly been applied in the standard configuration sources. Nowadays, OpenShift has proper support for static ip addresses built-in and this inf-lease-to-static feature has not been documented since 4.9. Both dispatcher scripts were only kept due to the "no breaking changes" policy in OpenShift. However, with configure-ovs.sh's rollback feature being broken, those dispatcher scripts could finally be removed. [0] openshift#2188 [1] openshift#4954
NetworkManager dispatcher scripts 30-static-dhcp and 30-static-dhcpv6 modify the NetworkManager connection of the OVS interface ovs-if-br-ex in case of a infinite DHCP lease: They will change ipv4.method and ipv6.method from auto to manual in order to statically assign DHCP addresses etc. The purpose of this feature was to enable nodes to keep their network configuration and network connectivity when their DHCP server becomes unavailable for any reason [0]. For example, this allowed users to deploy OpenShift nodes with "static" ip addresses, i.e. ip addresses with infitite DHCP leases, using an initial DHCP server that would then be removed once the cluster is up. However, the changes by the dispatcher scripts to NM connection ovs-if-br-ex were saved to disk which conflicts with the rollback behaviour of configure-ovs.sh (ovs-configuration.service): OVN-Kubernetes configuration is rolled back and (re)generated on every boot, to take in account any changes that have possibly been applied in the standard configuration sources. In OpenShift releases without PR openshift#4877 [2], the NM connection file for ovs-if-br-ex in /etc/NetworkManager/system-connections will not be removed during rollback which causes conflicts when changes have been applied in the standard configuration sources. With PR openshift#4877 [2], the NM connection file is removed during rollback, defeating the purpose of this feature. Nowadays, OpenShift has proper support for static ip addresses built-in and this inf-lease-to-static feature has not been documented since 4.9. Both dispatcher scripts were only kept due to the "no breaking changes" policy in OpenShift. However, because of the conflict with configure-ovs.sh's rollback feature, those dispatcher scripts could finally be removed. [0] openshift#2188 [1] openshift#4954 [2] openshift#4877
NetworkManager dispatcher scripts 30-static-dhcp and 30-static-dhcpv6 modify the NetworkManager connection of the OVS interface ovs-if-br-ex in case of a infinite DHCP lease: They will change ipv4.method and ipv6.method from auto to manual in order to statically assign DHCP addresses etc. The purpose of this feature was to enable nodes to keep their network configuration and network connectivity when their DHCP server becomes unavailable for any reason [0]. For example, this allowed users to deploy OpenShift nodes with "static" ip addresses, i.e. ip addresses with infitite DHCP leases, using an initial DHCP server that would then be removed once the cluster is up. However, the changes by the dispatcher scripts to NM connection ovs-if-br-ex were saved to disk which conflicts with the rollback behaviour of configure-ovs.sh (ovs-configuration.service): OVN-Kubernetes configuration is rolled back and (re)generated on every boot, to take in account any changes that have possibly been applied in the standard configuration sources. In OpenShift releases without PR openshift#4877 [2], the NM connection file for ovs-if-br-ex in /etc/NetworkManager/system-connections will not be removed during rollback which causes conflicts when changes have been applied in the standard configuration sources. With PR openshift#4877 [2], the NM connection file is removed during rollback, defeating the purpose of this feature. Nowadays, OpenShift has proper support for static ip addresses built-in and this inf-lease-to-static feature has not been documented since 4.9. Both dispatcher scripts were only kept due to the "no breaking changes" policy in OpenShift. However, because of the conflict with configure-ovs.sh's rollback feature, those dispatcher scripts could finally be removed. [0] openshift#2188 [1] openshift#4954 [2] openshift#4877
We have a feature request for nodes to be able to initially get
assigned their IP addresses via infinite DHCP leases, but then to
have those addresses statically configured on the node so that if
the DHCP server is unavailable for any reason they don't lose their
network configuration.
This adds a dispatcher script for NetworkManager that does so. It
looks at the DHCP assigned network settings and adds static
configuration with the same values.
- What I did
- How to verify it
- Description for the changelog