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

fix vpcnatgw image is not synced #4264

Merged
merged 1 commit into from
Jul 8, 2024
Merged
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
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
Loading