Skip to content

Commit

Permalink
Get latest vpc data from apiserver instead of cache (#1684)
Browse files Browse the repository at this point in the history
(cherry picked from commit c4e91cb)
  • Loading branch information
chestack authored and oilbeater committed Jul 14, 2022
1 parent 9050b22 commit aef889a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/init.go
Expand Up @@ -187,13 +187,13 @@ func (c *Controller) initClusterRouter() error {

// InitLoadBalancer init the default tcp and udp cluster loadbalancer
func (c *Controller) initLoadBalancer() error {
vpcs, err := c.vpcsLister.List(labels.Everything())
vpcs, err := c.config.KubeOvnClient.KubeovnV1().Vpcs().List(context.Background(), metav1.ListOptions{})
if err != nil {
klog.Errorf("failed to list vpc: %v", err)
return err
}

for _, orivpc := range vpcs {
for _, orivpc := range vpcs.Items {
vpc := orivpc.DeepCopy()
vpcLb := c.GenVpcLoadBalancer(vpc.Name)

Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/vpc.go
Expand Up @@ -249,7 +249,8 @@ func (c *Controller) addLoadBalancer(vpc string) (*VpcLoadBalancer, error) {
}

func (c *Controller) handleAddOrUpdateVpc(key string) error {
orivpc, err := c.vpcsLister.Get(key)
// get latest vpc info
orivpc, err := c.config.KubeOvnClient.KubeovnV1().Vpcs().Get(context.Background(), key, metav1.GetOptions{})
if err != nil {
if k8serrors.IsNotFound(err) {
return nil
Expand Down

0 comments on commit aef889a

Please sign in to comment.