Skip to content

Commit

Permalink
fix: delete vpc-nat-gw deployment
Browse files Browse the repository at this point in the history
When receive delete event, we cannot get the origin object anymore, we can just delete the deployment here.
  • Loading branch information
oilbeater committed Oct 25, 2021
1 parent b32fc65 commit cd1dda1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/vpc_nat_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ func (c *Controller) processNextWorkItem(processName string, queue workqueue.Rat
func (c *Controller) handleDelVpcNatGw(key string) error {
c.vpcNatGwKeyMutex.Lock(key)
defer c.vpcNatGwKeyMutex.Unlock(key)
gw, err := c.vpcNatGatewayLister.Get(key)
_, err := c.vpcNatGatewayLister.Get(key)
if err != nil {
if k8serrors.IsNotFound(err) {
return nil
return c.config.KubeClient.AppsV1().Deployments(c.config.PodNamespace).Delete(context.Background(), genNatGwDpName(key), metav1.DeleteOptions{})
}
return err
}
return c.config.KubeClient.AppsV1().Deployments(c.config.PodNamespace).Delete(context.Background(), genNatGwDpName(gw.Name), metav1.DeleteOptions{})
return nil
}

func (c *Controller) handleAddOrUpdateVpcNatGw(key string) error {
Expand Down

0 comments on commit cd1dda1

Please sign in to comment.