Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 2 additions & 43 deletions go-controller/pkg/node/OCP_HACKS.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,10 @@
package node

import (
"fmt"
"net"

"github.com/coreos/go-iptables/iptables"

"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/kube"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util"
)

// Block MCS Access. https://github.com/openshift/ovn-kubernetes/pull/170
// OCP HACK: Block MCS Access. https://github.com/openshift/ovn-kubernetes/pull/170
func generateBlockMCSRules(rules *[]iptRule, protocol iptables.Protocol) {
*rules = append(*rules, iptRule{
table: "filter",
Expand Down Expand Up @@ -41,38 +34,4 @@ func generateBlockMCSRules(rules *[]iptRule, protocol iptables.Protocol) {
})
}

// initSharedGatewayNoBridge is used in order to run local gateway mode without moving the NIC to an ovs bridge
// https://github.com/openshift/ovn-kubernetes/pull/281
func (n *OvnNode) initSharedGatewayNoBridge(subnets []*net.IPNet, gwNextHops []net.IP, nodeAnnotator kube.Annotator) (postWaitFunc, error) {
err := setupLocalNodeAccessBridge(n.name, subnets)
if err != nil {
return nil, err
}
chassisID, err := util.GetNodeChassisID()
if err != nil {
return nil, err
}
// get the real default interface
defaultGatewayIntf, _, err := getDefaultGatewayInterfaceDetails()
if err != nil {
return nil, err
}
ips, err := getNetworkInterfaceIPAddresses(defaultGatewayIntf)
if err != nil {
return nil, fmt.Errorf("failed to get interface details for %s (%v)",
defaultGatewayIntf, err)
}
err = util.SetL3GatewayConfig(nodeAnnotator, &util.L3GatewayConfig{
ChassisID: chassisID,
Mode: config.GatewayModeLocal,
IPAddresses: ips,
MACAddress: util.IPAddrToHWAddr(ips[0].IP),
NextHops: gwNextHops,
NodePortEnable: config.Gateway.NodeportEnable,
})
if err != nil {
return nil, err
} else {
return func() error { return nil }, nil
}
}
// END OCP HACK
8 changes: 1 addition & 7 deletions go-controller/pkg/node/gateway_shared_intf.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,7 @@ func (n *OvnNode) initSharedGateway(subnets []*net.IPNet, gwNextHops []net.IP, g
var brCreated bool
var err error

// OCP HACK
// Do not configure OVS bridge for local gateway mode with a gateway iface of none
// For 4.5->4.6 migration, see https://github.com/openshift/ovn-kubernetes/pull/281
if gwIntf == "none" {
return n.initSharedGatewayNoBridge(subnets, gwNextHops, nodeAnnotator)
// END OCP HACK
} else if bridgeName, _, err = util.RunOVSVsctl("--", "port-to-br", gwIntf); err == nil {
if bridgeName, _, err = util.RunOVSVsctl("--", "port-to-br", gwIntf); err == nil {
// This is an OVS bridge's internal port
uplinkName, err = util.GetNicName(bridgeName)
if err != nil {
Expand Down
97 changes: 0 additions & 97 deletions go-controller/pkg/ovn/OCP_HACKS.go

This file was deleted.

9 changes: 2 additions & 7 deletions go-controller/pkg/ovn/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,9 @@ func (ovn *Controller) AddEndpoints(ep *kapi.Endpoints) error {
func (ovn *Controller) handleNodePortLB(node *kapi.Node) error {
gatewayRouter := gwRouterPrefix + node.Name
var physicalIPs []string
// OCP HACK - there will not be a GR during local gw + no gw interface mode (upgrade from 4.5->4.6)
// See https://github.com/openshift/ovn-kubernetes/pull/281
if !isGatewayInterfaceNone() {
if physicalIPs, _ = ovn.getGatewayPhysicalIPs(gatewayRouter); physicalIPs == nil {
return fmt.Errorf("gateway physical IP for node %q does not yet exist", node.Name)
}
if physicalIPs, _ = ovn.getGatewayPhysicalIPs(gatewayRouter); physicalIPs == nil {
return fmt.Errorf("gateway physical IP for node %q does not yet exist", node.Name)
}
// END OCP HACK
namespaces, err := ovn.watchFactory.GetNamespaces()
if err != nil {
return fmt.Errorf("failed to get k8s namespaces: %v", err)
Expand Down
18 changes: 3 additions & 15 deletions go-controller/pkg/ovn/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,21 +449,9 @@ func (oc *Controller) syncGatewayLogicalNetwork(node *kapi.Node, l3GatewayConfig
return err
}

// OCP HACK
// GatewayModeLocal is only used if Local mode is specified and None shared gateway bridge is specified
// This is to allow local gateway mode without having to configure/use the shared gateway bridge
// See https://github.com/openshift/ovn-kubernetes/pull/281
if l3GatewayConfig.Mode == config.GatewayModeLocal {
err = gatewayInitMinimal(node.Name, l3GatewayConfig, oc.SCTPSupport)
if err != nil {
return fmt.Errorf("failed to init local gateway with no OVS bridge: %v", err)
}
// END OCP HACK
} else {
err = gatewayInit(node.Name, clusterSubnets, hostSubnets, joinSubnets, l3GatewayConfig, oc.SCTPSupport)
if err != nil {
return fmt.Errorf("failed to init shared interface gateway: %v", err)
}
err = gatewayInit(node.Name, clusterSubnets, hostSubnets, joinSubnets, l3GatewayConfig, oc.SCTPSupport)
if err != nil {
return fmt.Errorf("failed to init shared interface gateway: %v", err)
}

// in the case of shared gateway mode, we need to setup
Expand Down