Skip to content

Commit fe63dc6

Browse files
committed
Remove lingering references to openshift-sdn
1 parent de8ed45 commit fe63dc6

File tree

9 files changed

+130
-187
lines changed

9 files changed

+130
-187
lines changed

pkg/controller/template/render_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ var (
214214
"kubevirt": "./test_data/controller_config_kubevirt.yaml",
215215
"powervs": "./test_data/controller_config_powervs.yaml",
216216
"nutanix": "./test_data/controller_config_nutanix.yaml",
217-
"network-forwarding-sdn": "./test_data/controller_config_forwarding_sdn.yaml",
218217
"network-forwarding-ovn": "./test_data/controller_config_forwarding_ovn.yaml",
219218
"gcp-custom-dns": "./test_data/controller_config_gcp_custom_dns.yaml",
220219
"gcp-default-dns": "./test_data/controller_config_gcp_default_dns.yaml",
@@ -337,7 +336,7 @@ func TestGenerateMachineConfigs(t *testing.T) {
337336
if !foundKubeletUnitWorker {
338337
t.Errorf("Failed to find kubelet unit for worker")
339338
}
340-
if foundIPForwarding && controllerConfig.Spec.NetworkType != "OpenShiftSDN" {
339+
if foundIPForwarding {
341340
t.Errorf("IP forwarding file mismatch. Was rendered: %t for network type: %s",
342341
foundIPForwarding, controllerConfig.Spec.NetworkType)
343342
}

pkg/controller/template/test_data/controller_config_forwarding_sdn.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

templates/common/_base/files/configure-ovs-network.yaml

Lines changed: 112 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -952,139 +952,131 @@ contents:
952952
# print initial state
953953
print_state
954954
955-
if [ "$1" == "OVNKubernetes" ]; then
956-
# Configures NICs onto OVS bridge "br-ex"
957-
# Configuration is either auto-detected or provided through a config file written already in Network Manager
958-
# key files under /etc/NetworkManager/system-connections/
959-
# Managing key files is outside of the scope of this script
960-
961-
# if the interface is of type vmxnet3 add multicast capability for that driver
962-
# History: BZ:1854355
963-
function configure_driver_options {
964-
intf=$1
965-
if [ ! -f "/sys/class/net/${intf}/device/uevent" ]; then
966-
echo "Device file doesn't exist, skipping setting multicast mode"
967-
else
968-
driver=$(cat "/sys/class/net/${intf}/device/uevent" | grep DRIVER | awk -F "=" '{print $2}')
969-
echo "Driver name is" $driver
970-
if [ "$driver" = "vmxnet3" ]; then
971-
ip link set dev "${intf}" allmulticast on
972-
fi
973-
fi
974-
}
975-
976-
ovnk_config_dir='/etc/ovnk'
977-
ovnk_var_dir='/var/lib/ovnk'
978-
extra_bridge_file="${ovnk_config_dir}/extra_bridge"
979-
iface_default_hint_file="${ovnk_var_dir}/iface_default_hint"
980-
ip_hint_file="/run/nodeip-configuration/primary-ip"
981-
# explicitly specify which interface should be used with the default bridge
982-
default_bridge_file="${ovnk_config_dir}/default_bridge"
983-
984-
# make sure to create ovnk_config_dir if it does not exist, yet
985-
mkdir -p "${ovnk_config_dir}"
986-
# make sure to create ovnk_var_dir if it does not exist, yet
987-
mkdir -p "${ovnk_var_dir}"
988-
989-
# For upgrade scenarios, make sure that we stabilize what we already configured
990-
# before. If we do not have a valid interface hint, find the physical interface
991-
# that's attached to ovs-if-phys0.
992-
# If we find such an interface, write it to the hint file.
993-
iface_default_hint=$(get_iface_default_hint "${iface_default_hint_file}")
994-
if [ "${iface_default_hint}" == "" ]; then
995-
current_interface=$(get_bridge_physical_interface ovs-if-phys0)
996-
if [ "${current_interface}" != "" ]; then
997-
write_iface_default_hint "${iface_default_hint_file}" "${current_interface}"
955+
# Configures NICs onto OVS bridge "br-ex"
956+
# Configuration is either auto-detected or provided through a config file written already in Network Manager
957+
# key files under /etc/NetworkManager/system-connections/
958+
# Managing key files is outside of the scope of this script
959+
960+
# if the interface is of type vmxnet3 add multicast capability for that driver
961+
# History: BZ:1854355
962+
function configure_driver_options {
963+
intf=$1
964+
if [ ! -f "/sys/class/net/${intf}/device/uevent" ]; then
965+
echo "Device file doesn't exist, skipping setting multicast mode"
966+
else
967+
driver=$(cat "/sys/class/net/${intf}/device/uevent" | grep DRIVER | awk -F "=" '{print $2}')
968+
echo "Driver name is" $driver
969+
if [ "$driver" = "vmxnet3" ]; then
970+
ip link set dev "${intf}" allmulticast on
998971
fi
999972
fi
1000-
1001-
# delete iface_default_hint_file if it has the same content as extra_bridge_file
1002-
# in that case, we must also force a reconfiguration of our network interfaces
1003-
# to make sure that we reconcile this conflict
1004-
if [ -f "${iface_default_hint_file}" ] &&
1005-
[ -f "${extra_bridge_file}" ] &&
1006-
[ "$(cat "${iface_default_hint_file}")" == "$(cat "${extra_bridge_file}")" ]; then
1007-
echo "${iface_default_hint_file} and ${extra_bridge_file} share the same content"
1008-
echo "Deleting file ${iface_default_hint_file} to choose a different interface"
1009-
rm -f "${iface_default_hint_file}"
1010-
rm -f /run/configure-ovs-boot-done
973+
}
974+
975+
ovnk_config_dir='/etc/ovnk'
976+
ovnk_var_dir='/var/lib/ovnk'
977+
extra_bridge_file="${ovnk_config_dir}/extra_bridge"
978+
iface_default_hint_file="${ovnk_var_dir}/iface_default_hint"
979+
ip_hint_file="/run/nodeip-configuration/primary-ip"
980+
# explicitly specify which interface should be used with the default bridge
981+
default_bridge_file="${ovnk_config_dir}/default_bridge"
982+
983+
# make sure to create ovnk_config_dir if it does not exist, yet
984+
mkdir -p "${ovnk_config_dir}"
985+
# make sure to create ovnk_var_dir if it does not exist, yet
986+
mkdir -p "${ovnk_var_dir}"
987+
988+
# For upgrade scenarios, make sure that we stabilize what we already configured
989+
# before. If we do not have a valid interface hint, find the physical interface
990+
# that's attached to ovs-if-phys0.
991+
# If we find such an interface, write it to the hint file.
992+
iface_default_hint=$(get_iface_default_hint "${iface_default_hint_file}")
993+
if [ "${iface_default_hint}" == "" ]; then
994+
current_interface=$(get_bridge_physical_interface ovs-if-phys0)
995+
if [ "${current_interface}" != "" ]; then
996+
write_iface_default_hint "${iface_default_hint_file}" "${current_interface}"
1011997
fi
998+
fi
999+
1000+
# delete iface_default_hint_file if it has the same content as extra_bridge_file
1001+
# in that case, we must also force a reconfiguration of our network interfaces
1002+
# to make sure that we reconcile this conflict
1003+
if [ -f "${iface_default_hint_file}" ] &&
1004+
[ -f "${extra_bridge_file}" ] &&
1005+
[ "$(cat "${iface_default_hint_file}")" == "$(cat "${extra_bridge_file}")" ]; then
1006+
echo "${iface_default_hint_file} and ${extra_bridge_file} share the same content"
1007+
echo "Deleting file ${iface_default_hint_file} to choose a different interface"
1008+
rm -f "${iface_default_hint_file}"
1009+
rm -f /run/configure-ovs-boot-done
1010+
fi
10121011
1013-
# on every boot we rollback and generate the configuration again, to take
1014-
# in any changes that have possibly been applied in the standard
1015-
# configuration sources
1016-
if [ ! -f /run/configure-ovs-boot-done ]; then
1017-
echo "Running on boot, restoring previous configuration before proceeding..."
1012+
# on every boot we rollback and generate the configuration again, to take
1013+
# in any changes that have possibly been applied in the standard
1014+
# configuration sources
1015+
if [ ! -f /run/configure-ovs-boot-done ]; then
1016+
echo "Running on boot, restoring previous configuration before proceeding..."
1017+
rollback_nm
1018+
print_state
1019+
fi
1020+
touch /run/configure-ovs-boot-done
1021+
1022+
iface=$(get_default_bridge_interface "${iface_default_hint_file}" "${extra_bridge_file}" "${ip_hint_file}" "${default_bridge_file}")
1023+
1024+
if [ "$iface" != "br-ex" ]; then
1025+
# Specified interface is not br-ex.
1026+
# Some deployments use a temporary solution where br-ex is moved out from the default gateway interface
1027+
# and bound to a different nic (https://github.com/trozet/openshift-ovn-migration).
1028+
# This is now supported through an extra bridge if requested. If that is the case, we rollback.
1029+
# We also rollback if it looks like we need to configure things, just in case there are any leftovers
1030+
# from previous attempts.
1031+
if [ -f "$extra_bridge_file" ] || [ -z "$(nmcli connection show --active br-ex 2> /dev/null)" ]; then
1032+
echo "Bridge br-ex is not active, restoring previous configuration before proceeding..."
10181033
rollback_nm
10191034
print_state
10201035
fi
1021-
touch /run/configure-ovs-boot-done
1022-
1023-
iface=$(get_default_bridge_interface "${iface_default_hint_file}" "${extra_bridge_file}" "${ip_hint_file}" "${default_bridge_file}")
1024-
1025-
if [ "$iface" != "br-ex" ]; then
1026-
# Specified interface is not br-ex.
1027-
# Some deployments use a temporary solution where br-ex is moved out from the default gateway interface
1028-
# and bound to a different nic (https://github.com/trozet/openshift-ovn-migration).
1029-
# This is now supported through an extra bridge if requested. If that is the case, we rollback.
1030-
# We also rollback if it looks like we need to configure things, just in case there are any leftovers
1031-
# from previous attempts.
1032-
if [ -f "$extra_bridge_file" ] || [ -z "$(nmcli connection show --active br-ex 2> /dev/null)" ]; then
1033-
echo "Bridge br-ex is not active, restoring previous configuration before proceeding..."
1034-
rollback_nm
1035-
print_state
1036-
fi
1037-
fi
1036+
fi
10381037
1039-
convert_to_bridge "$iface" "br-ex" "phys0" "${BRIDGE_METRIC}"
1038+
convert_to_bridge "$iface" "br-ex" "phys0" "${BRIDGE_METRIC}"
10401039
1041-
# Check if we need to configure the second bridge
1042-
if [ -f "$extra_bridge_file" ] && (! nmcli connection show br-ex1 &> /dev/null || ! nmcli connection show ovs-if-phys1 &> /dev/null); then
1043-
interface=$(head -n 1 $extra_bridge_file)
1044-
convert_to_bridge "$interface" "br-ex1" "phys1" "${BRIDGE1_METRIC}"
1045-
fi
1040+
# Check if we need to configure the second bridge
1041+
if [ -f "$extra_bridge_file" ] && (! nmcli connection show br-ex1 &> /dev/null || ! nmcli connection show ovs-if-phys1 &> /dev/null); then
1042+
interface=$(head -n 1 $extra_bridge_file)
1043+
convert_to_bridge "$interface" "br-ex1" "phys1" "${BRIDGE1_METRIC}"
1044+
fi
10461045
1047-
# Check if we need to remove the second bridge
1048-
if [ ! -f "$extra_bridge_file" ] && (nmcli connection show br-ex1 &> /dev/null || nmcli connection show ovs-if-phys1 &> /dev/null); then
1049-
remove_ovn_bridges br-ex1 phys1
1050-
fi
1046+
# Check if we need to remove the second bridge
1047+
if [ ! -f "$extra_bridge_file" ] && (nmcli connection show br-ex1 &> /dev/null || nmcli connection show ovs-if-phys1 &> /dev/null); then
1048+
remove_ovn_bridges br-ex1 phys1
1049+
fi
10511050
1052-
# Remove bridges created by openshift-sdn
1053-
ovs-vsctl --timeout=30 --if-exists del-br br0
1054-
1055-
# Make sure everything is activated. Do it in a specific order:
1056-
# - activate br-ex first, due to autoconnect-slaves this will also
1057-
# activate ovs-port-br-ex, ovs-port-phys0 and ovs-if-phys0. It is
1058-
# important that ovs-if-phys0 activates with br-ex to avoid the
1059-
# ovs-if-phys0 profile being overridden with a profile generated from
1060-
# kargs. The activation of ovs-if-phys0, if a bond, might cause the
1061-
# slaves to re-activate, but it should be with our profiles since they
1062-
# have higher priority
1063-
# - make sure that ovs-if-phys0 and its slaves, if any, are activated.
1064-
# - finally activate ovs-if-br-ex which holds the IP configuration.
1065-
connections=(br-ex ovs-if-phys0)
1066-
if [ -f "$extra_bridge_file" ]; then
1067-
connections+=(br-ex1 ovs-if-phys1)
1068-
fi
1069-
while IFS= read -r connection; do
1070-
if [[ $connection == *"$MANAGED_NM_CONN_SUFFIX" ]]; then
1071-
connections+=("$connection")
1072-
fi
1073-
done < <(nmcli -g NAME c)
1074-
connections+=(ovs-if-br-ex)
1075-
if [ -f "$extra_bridge_file" ]; then
1076-
connections+=(ovs-if-br-ex1)
1051+
# Remove bridges created by openshift-sdn
1052+
ovs-vsctl --timeout=30 --if-exists del-br br0
1053+
1054+
# Make sure everything is activated. Do it in a specific order:
1055+
# - activate br-ex first, due to autoconnect-slaves this will also
1056+
# activate ovs-port-br-ex, ovs-port-phys0 and ovs-if-phys0. It is
1057+
# important that ovs-if-phys0 activates with br-ex to avoid the
1058+
# ovs-if-phys0 profile being overridden with a profile generated from
1059+
# kargs. The activation of ovs-if-phys0, if a bond, might cause the
1060+
# slaves to re-activate, but it should be with our profiles since they
1061+
# have higher priority
1062+
# - make sure that ovs-if-phys0 and its slaves, if any, are activated.
1063+
# - finally activate ovs-if-br-ex which holds the IP configuration.
1064+
connections=(br-ex ovs-if-phys0)
1065+
if [ -f "$extra_bridge_file" ]; then
1066+
connections+=(br-ex1 ovs-if-phys1)
1067+
fi
1068+
while IFS= read -r connection; do
1069+
if [[ $connection == *"$MANAGED_NM_CONN_SUFFIX" ]]; then
1070+
connections+=("$connection")
10771071
fi
1078-
activate_nm_connections "${connections[@]}"
1079-
try_to_bind_ipv6_address
1080-
set_nm_conn_files
1081-
elif [ "$1" == "OpenShiftSDN" ]; then
1082-
# Revert changes made by /usr/local/bin/configure-ovs.sh during SDN migration.
1083-
rollback_nm
1084-
1085-
# Remove bridges created by ovn-kubernetes
1086-
ovs-vsctl --timeout=30 --if-exists del-br br-int -- --if-exists del-br br-local
1072+
done < <(nmcli -g NAME c)
1073+
connections+=(ovs-if-br-ex)
1074+
if [ -f "$extra_bridge_file" ]; then
1075+
connections+=(ovs-if-br-ex1)
10871076
fi
1077+
activate_nm_connections "${connections[@]}"
1078+
try_to_bind_ipv6_address
1079+
set_nm_conn_files
10881080
}
10891081
10901082
# Retry configure_ovs until it succeeds.

templates/common/_base/files/mtu-migration.yaml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ contents:
1212
1313
# mtu-migration systemd service will call this script with the following
1414
# environment variables set:
15-
# - NETWORK_TYPE: OVNKubernetes or OpenshiftSDN
15+
# - NETWORK_TYPE: OVNKubernetes
1616
# - TARGET_MTU: new host MTU to set
1717
# - CURRENT_MTU: current host MTU (optional, not currently used)
1818
# - CNI_TARGET_MTU: new cluster network MTU (optional, not currently used)
@@ -158,7 +158,7 @@ contents:
158158
exit 1
159159
fi
160160
161-
if ! [[ $NETWORK_TYPE == "OVNKubernetes" || $NETWORK_TYPE == "OpenShiftSDN" ]]; then
161+
if ! [[ $NETWORK_TYPE == "OVNKubernetes" ]]; then
162162
echo "error: NETWORK_TYPE=$NETWORK_TYPE not supported for MTU migration"
163163
exit 1
164164
fi
@@ -168,29 +168,15 @@ contents:
168168
exit 0
169169
fi
170170
171+
# for ovn-k, we handle interfaces from well known NM profiles
171172
ifaces=()
172-
if [ "$NETWORK_TYPE" == "OVNKubernetes" ]; then
173-
# for ovn-k, we handle interfaces from well known NM profiles
174-
ifaces+=("$(nmcli -g connection.interface-name c show ovs-if-br-ex)")
175-
ifaces+=("$(nmcli -g connection.interface-name c show ovs-if-phys0)")
176-
for connection in ovs-if-br-ex1 ovs-if-phys1; do
177-
# nmcli exit code is 10 when not found
178-
iface="$(nmcli -g connection.interface-name c show $connection || [ "$?" = "10" ])"
179-
[ -n "$iface" ] && ifaces+=("$iface")
180-
done
181-
else
182-
# for openshift-sdn, we handle the default gateway interface
183-
gw_iface=$(ip route show default | awk '{ if ($4 == "dev") { print $5; exit } }')
184-
if [[ -z "$gw_iface" ]]; then
185-
# no IPv4 Default gateway interface found, checking IPv6
186-
gw_iface=$(ip -6 route show default | awk '{ if ($4 == "dev") { print $5; exit } }')
187-
fi
188-
if [[ -z "$gw_iface" ]]; then
189-
echo "mtu migration error: no gateway interface found, cannot continue"
190-
exit 1
191-
fi
192-
ifaces+=("$gw_iface")
193-
fi
173+
ifaces+=("$(nmcli -g connection.interface-name c show ovs-if-br-ex)")
174+
ifaces+=("$(nmcli -g connection.interface-name c show ovs-if-phys0)")
175+
for connection in ovs-if-br-ex1 ovs-if-phys1; do
176+
# nmcli exit code is 10 when not found
177+
iface="$(nmcli -g connection.interface-name c show $connection || [ "$?" = "10" ])"
178+
[ -n "$iface" ] && ifaces+=("$iface")
179+
done
194180
195181
# if it's a bond or team interface, MTU propagates to slaves when set on
196182
# master.
@@ -210,4 +196,4 @@ contents:
210196
set_mtu "$iface" $is_parent
211197
done
212198
213-
{{ end }}{{ end }}
199+
{{ end }}{{ end }}

templates/common/_base/files/sysctl-forward-conf.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
name: "openvswitch.service"
2-
enabled: {{if eq .NetworkType "OVNKubernetes"}}true{{else if eq .NetworkType "OpenShiftSDN"}}true{{else}}false{{end}}
2+
enabled: {{if eq .NetworkType "OVNKubernetes"}}true{{else}}false{{end}}

templates/common/_base/units/ovs-configuration.service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: ovs-configuration.service
2-
enabled: {{if eq .NetworkType "OVNKubernetes" "OpenShiftSDN"}}true{{else}}false{{end}}
2+
enabled: {{if eq .NetworkType "OVNKubernetes"}}true{{else}}false{{end}}
33
contents: |
44
[Unit]
55
# Kdump will generate it's initramfs based on the running state when kdump.service run
@@ -18,7 +18,7 @@ contents: |
1818
[Service]
1919
# Need oneshot to delay kubelet
2020
Type=oneshot
21-
ExecStart=/usr/local/bin/configure-ovs.sh {{.NetworkType}}
21+
ExecStart=/usr/local/bin/configure-ovs.sh
2222
StandardOutput=journal+console
2323
StandardError=journal+console
2424

templates/common/_base/units/ovsdb-server.service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "ovsdb-server.service"
2-
enabled: {{if eq .NetworkType "OVNKubernetes"}}true{{else if eq .NetworkType "OpenShiftSDN"}}true{{else}}false{{end}}
2+
enabled: {{if eq .NetworkType "OVNKubernetes"}}true{{else}}false{{end}}
33
dropins:
44
- name: 10-ovsdb-restart.conf
55
contents: |

0 commit comments

Comments
 (0)