Skip to content

Commit

Permalink
fix initialization check of vpc nat gateway configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
qiutingjun committed Jun 25, 2023
1 parent e558702 commit 8946144
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 8946144

Please sign in to comment.