diff --git a/pkg/controller/init.go b/pkg/controller/init.go index 79dfbe6b4c9f..921ff72dc406 100644 --- a/pkg/controller/init.go +++ b/pkg/controller/init.go @@ -697,12 +697,22 @@ func (c *Controller) initSyncCrdSubnets() error { func (c *Controller) initSyncCrdVpcNatGw() error { klog.Info("start to sync crd vpc nat gw") - cm, err := c.configMapsLister.ConfigMaps(c.config.PodNamespace).Get(util.VpcNatGatewayConfig) + + cm, err := c.configMapsLister.ConfigMaps(c.config.PodNamespace).Get(util.VpcNatConfig) + if err != nil && !k8serrors.IsNotFound(err) { + klog.Errorf("failed to get %s, %v", util.VpcNatConfig, err) + return err + } + if k8serrors.IsNotFound(err) || cm.Data["image"] == "" { + return nil + } + + cm, err = c.configMapsLister.ConfigMaps(c.config.PodNamespace).Get(util.VpcNatGatewayConfig) if err != nil && !k8serrors.IsNotFound(err) { - klog.Errorf("failed to get ovn-vpc-nat-gw-config, %v", err) + klog.Errorf("failed to get %s, %v", util.VpcNatGatewayConfig, err) return err } - if k8serrors.IsNotFound(err) || cm.Data["enable-vpc-nat-gw"] == "false" || cm.Data["image"] == "" { + if k8serrors.IsNotFound(err) || cm.Data["enable-vpc-nat-gw"] == "false" { return nil } gws, err := c.vpcNatGatewayLister.List(labels.Everything())