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

refresh nat gw image before using it #2743

Merged
merged 1 commit into from
May 4, 2023
Merged

Conversation

zbb88888
Copy link
Collaborator

@zbb88888 zbb88888 commented May 3, 2023

WHAT

copilot:summary

copilot:poem

HOW

copilot:walkthrough

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

  • The resyncVpcNatConfig() function is called multiple times in different functions. It should be refactored to a single function and called once.
  • In the genLbSvcDeployment() function, the resyncVpcNatConfig() function is called before generating the deployment. This may cause unnecessary overhead. It should be moved to a more appropriate location.
  • In the genVpcDnsDeployment() function, the resyncVpcNatConfig() function is called after setting the VPC DNS route. This may cause unnecessary overhead. It should be moved to a more appropriate location.
  • In the genVpcLbDeployment() function, the resyncVpcNatConfig() function is called before generating the deployment. This may cause unnecessary overhead. It should be moved to a more appropriate location.
  • In the resyncVpcNatGwConfig() function, the vpcNatImage variable is assigned the value of cm.Data["image"] but it is not used anywhere else in the function. This line of code can be removed.

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

  • The resyncVpcNatConfig() function should return an error instead of logging it and returning nothing. This will allow the caller to handle the error appropriately.
  • The resyncVpcNatConfig() function should check if the ovn-vpc-nat-config ConfigMap has the required fields before proceeding. If the required fields are not present, it should return an error instead of logging it and returning nothing.
  • The genLbSvcDeployment() function calls resyncVpcNatConfig() without checking for errors. It should handle any errors returned by this function.
  • The genVpcDnsDeployment() function calls resyncVpcNatConfig() without checking for errors. It should handle any errors returned by this function.
  • The resyncVpcNatGwConfig() function calls resyncVpcNatConfig() without checking for errors. It should handle any errors returned by this function.

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

  • The resyncVpcNatConfig function should be renamed to resyncVpcNatImage to better reflect its purpose.
  • The error handling in the resyncVpcNatImage function should be improved. Instead of just logging the error, it should return the error to the caller so that it can be handled properly.
  • The genLbSvcDeployment, genVpcDnsDeployment, and genVpcLbDeployment functions all call resyncVpcNatImage. This could potentially cause performance issues if these functions are called frequently. It would be better to call resyncVpcNatImage once in the startWorkers function and store the result in a variable that can be accessed by these other functions.
  • The genVpcDnsDeployment function should have better error handling. If defaultSubnet.Spec.Gateway is empty, it should return an error instead of returning nil.
  • The resyncExternalGateway function is no longer being called. Is this intentional? If not, it should be added back in.

@zbb88888 zbb88888 marked this pull request as ready for review May 4, 2023 01:59
@zbb88888 zbb88888 requested a review from hongzhen-ma May 4, 2023 01:59
pkg/controller/service_lb.go Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2023

  • Priority 1: The resyncVpcNatConfig function has been renamed to resyncVpcNatImage, but the call to it in startWorkers and resyncVpcGwConfig still uses the old name. This inconsistency can cause confusion and should be fixed.
  • Priority 2: The genLbSvcDeployment, genVpcDnsDeployment, and genVpcLbDeployment functions all call resyncVpcNatImage. This function is not thread-safe, so calling it concurrently from multiple goroutines can lead to race conditions. It would be better to call this function once at the beginning of the startWorkers function and store the result in a variable that can be accessed by these other functions.
  • Priority 3: The error handling in resyncVpcNatImage could be improved. Instead of just logging the error and returning, it would be better to return the error to the caller so that they can handle it appropriately.
  • Priority 4: In genVpcDnsDeployment, if resyncVpcNatImage returns an error, the function should return both nil and the error instead of just returning nil.
  • Priority 5: In genVpcLbDeployment, if resyncVpcNatImage returns an error, the function should return both nil and the error instead of just returning nil.

@zbb88888 zbb88888 merged commit d1711ac into kubeovn:master May 4, 2023
@zbb88888 zbb88888 deleted the nat-gw-image branch May 5, 2023 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants