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

Only configure IPv6 RAs when ipv6 mode enabled #4810

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion go-controller/pkg/ovn/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ func (gw *GatewayManager) GatewayInit(
types.NetworkExternalID: gw.netInfo.GetNetworkName(),
types.TopologyExternalID: gw.netInfo.TopologyType(),
}
if gw.netInfo.IsPrimaryNetwork() && gw.netInfo.TopologyType() == types.Layer2Topology {
_, isNetIPv6 := gw.netInfo.IPMode()
if gw.netInfo.IsPrimaryNetwork() && gw.netInfo.TopologyType() == types.Layer2Topology && isNetIPv6 && config.IPv6Mode {
logicalRouterPort.Ipv6RaConfigs = map[string]string{
"address_mode": "dhcpv6_stateful",
"send_periodic": "true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
nadapi "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
knet "k8s.io/utils/net"

"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb"
Expand Down Expand Up @@ -64,6 +65,11 @@ var _ = Describe("OVN Multi-Homed pod operations for layer2 network", func() {
}
}
config.Gateway.Mode = gatewayMode
if knet.IsIPv6CIDRString(netInfo.clustersubnets) {
config.IPv6Mode = true
// tests dont support dualstack yet
config.IPv4Mode = false
}
app.Action = func(ctx *cli.Context) error {
By(fmt.Sprintf("creating a network attachment definition for network: %s", netInfo.netName))
nad, err := newNetworkAttachmentDefinition(
Expand Down Expand Up @@ -206,6 +212,13 @@ var _ = Describe("OVN Multi-Homed pod operations for layer2 network", func() {
icClusterWithDisableSNATTestConfiguration(),
config.GatewayModeShared,
),
/** FIXME: tests do not support ipv6 yet
Entry("pod on a IPv6 user defined primary network on an IC cluster with per-pod SNATs enabled",
dummyPrimaryLayer2UserDefinedNetwork("2001:db8:abcd:0012::/64"),
icClusterWithDisableSNATTestConfiguration(),
config.GatewayModeShared,
),
*/
)

DescribeTable(
Expand Down Expand Up @@ -478,13 +491,16 @@ func expectedLayer2EgressEntities(netInfo util.NetInfo, gwConfig util.L3GatewayC
func expectedGWToNetworkSwitchRouterPort(name string, netInfo util.NetInfo, networks ...*net.IPNet) *nbdb.LogicalRouterPort {
options := map[string]string{"gateway_mtu": fmt.Sprintf("%d", 1400)}
lrp := expectedLogicalRouterPort(name, netInfo, options, networks...)
lrp.Ipv6RaConfigs = map[string]string{
"address_mode": "dhcpv6_stateful",
"mtu": "1400",
"send_periodic": "true",
"max_interval": "900",
"min_interval": "300",
"router_preference": "LOW",

if config.IPv6Mode {
lrp.Ipv6RaConfigs = map[string]string{
"address_mode": "dhcpv6_stateful",
"mtu": "1400",
"send_periodic": "true",
"max_interval": "900",
"min_interval": "300",
"router_preference": "LOW",
}
}
return lrp
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
knet "k8s.io/utils/net"
"k8s.io/utils/ptr"

nadapi "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
Expand Down Expand Up @@ -97,6 +98,11 @@ var _ = Describe("OVN Multi-Homed pod operations", func() {
}
}
config.Gateway.Mode = gwMode
if knet.IsIPv6CIDRString(netInfo.clustersubnets) {
config.IPv6Mode = true
// tests dont support dualstack yet
config.IPv4Mode = false
}
app.Action = func(ctx *cli.Context) error {
nad, err := newNetworkAttachmentDefinition(
ns,
Expand Down
Loading