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 8bc1b16 commit a798a8c
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
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,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
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,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 a798a8c

Please sign in to comment.