Skip to content

Commit

Permalink
fix vpcnatgw image is not synced (#4264)
Browse files Browse the repository at this point in the history
Signed-off-by: oilbeater <[email protected]>
  • Loading branch information
oilbeater committed Jul 8, 2024
1 parent 5f8cef9 commit e25bf15
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
6 changes: 5 additions & 1 deletion pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,11 +1026,15 @@ func (c *Controller) startWorkers(ctx context.Context) {
// maintain l3 ha about the vpc external lrp binding to the gw chassis
c.OVNNbClient.MonitorBFD()
}

// TODO: we should merge these two vpc nat config into one config and resync them together
go wait.Until(func() {
c.resyncVpcNatGwConfig()
}, time.Second, ctx.Done())

go wait.Until(func() {
c.resyncVpcNatImage()
}, time.Second, ctx.Done())

go wait.Until(func() {
if err := c.markAndCleanLSP(); err != nil {
klog.Errorf("gc lsp error: %v", err)
Expand Down
4 changes: 0 additions & 4 deletions pkg/controller/service_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ func (c *Controller) checkAttachNetwork(svc *corev1.Service) error {
}

func (c *Controller) genLbSvcDeployment(svc *corev1.Service) (dp *v1.Deployment) {
if err := c.resyncVpcNatImage(); err != nil {
klog.Errorf("failed to resync vpc nat config, err: %v", err)
return nil
}
name := genLbSvcDpName(svc.Name)
labels := map[string]string{
"app": name,
Expand Down
4 changes: 0 additions & 4 deletions pkg/controller/vpc_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ func (c *Controller) deleteVpcLb(vpc *kubeovnv1.Vpc) error {
}

func (c *Controller) genVpcLbDeployment(vpc *kubeovnv1.Vpc) (*v1.Deployment, error) {
if err := c.resyncVpcNatImage(); err != nil {
klog.Errorf("failed to resync vpc nat config, err: %v", err)
return nil, err
}
if len(vpc.Status.Subnets) == 0 {
return nil, nil
}
Expand Down
11 changes: 7 additions & 4 deletions pkg/controller/vpc_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ import (

var vpcNatImage = ""

func (c *Controller) resyncVpcNatImage() error {
func (c *Controller) resyncVpcNatImage() {
if vpcNatEnabled != "true" {
return
}

cm, err := c.configMapsLister.ConfigMaps(c.config.PodNamespace).Get(util.VpcNatConfig)
if err != nil {
err = fmt.Errorf("failed to get ovn-vpc-nat-config, %v", err)
klog.Error(err)
return err
return
}
image, exist := cm.Data["image"]
if !exist {
err = fmt.Errorf("%s should have image field", util.VpcNatConfig)
klog.Error(err)
return err
return
}
vpcNatImage = image
return nil
}
4 changes: 0 additions & 4 deletions pkg/controller/vpc_nat_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ func (c *Controller) resyncVpcNatGwConfig() {
klog.Errorf("failed to get vpc nat gateway, %v", err)
return
}
if err = c.resyncVpcNatImage(); err != nil {
klog.Errorf("failed to resync vpc nat config, err: %v", err)
return
}
vpcNatEnabled = "true"
VpcNatCmVersion = cm.ResourceVersion
for _, gw := range gws {
Expand Down

0 comments on commit e25bf15

Please sign in to comment.