From c39d51a3c7d011ae8e33e6510ebcdb7612feada4 Mon Sep 17 00:00:00 2001 From: Mengxin Liu Date: Thu, 8 Sep 2022 16:14:53 +0800 Subject: [PATCH] fix: gatewaynode might be null (#1896) (cherry picked from commit 7fae28aecf7119f8ed3f777defac7294f699be4c) --- pkg/apis/kubeovn/v1/types.go | 2 +- pkg/controller/init.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/apis/kubeovn/v1/types.go b/pkg/apis/kubeovn/v1/types.go index 49e8d0225a8..314dd63e230 100644 --- a/pkg/apis/kubeovn/v1/types.go +++ b/pkg/apis/kubeovn/v1/types.go @@ -109,7 +109,7 @@ type SubnetSpec struct { Provider string `json:"provider,omitempty"` GatewayType string `json:"gatewayType,omitempty"` - GatewayNode string `json:"gatewayNode,omitempty"` + GatewayNode string `json:"gatewayNode"` NatOutgoing bool `json:"natOutgoing"` ExternalEgressGateway string `json:"externalEgressGateway,omitempty"` diff --git a/pkg/controller/init.go b/pkg/controller/init.go index f40d6e4d392..5ac91dd5bae 100644 --- a/pkg/controller/init.go +++ b/pkg/controller/init.go @@ -115,6 +115,7 @@ func (c *Controller) initDefaultLogicalSwitch() error { Provider: util.OvnProvider, CIDRBlock: c.config.DefaultCIDR, Gateway: c.config.DefaultGateway, + GatewayNode: "", ExcludeIps: strings.Split(c.config.DefaultExcludeIps, ","), NatOutgoing: true, GatewayType: kubeovnv1.GWDistributedType, @@ -160,6 +161,7 @@ func (c *Controller) initNodeSwitch() error { Provider: util.OvnProvider, CIDRBlock: c.config.NodeSwitchCIDR, Gateway: c.config.NodeSwitchGateway, + GatewayNode: "", ExcludeIps: strings.Split(c.config.NodeSwitchGateway, ","), Protocol: util.CheckProtocol(c.config.NodeSwitchCIDR), DisableInterConnection: true,