Skip to content

Commit

Permalink
Merge pull request #245 from gujingit/bugfix/listener-delete
Browse files Browse the repository at this point in the history
fix forward listener delete error
  • Loading branch information
k8s-ci-robot authored Mar 19, 2021
2 parents cf3535b + 93e9dad commit 6fda98c
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions cloud-controller-manager/listeners.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,19 +373,23 @@ func EnsureListenersDeleted(

for _, loc := range local {
for _, rem := range remote {
if !isManagedByMyService(service, rem) {
continue
}
hasUserNode, err := rem.listenerHasUserManagedNode(ctx)
if err != nil {
return fmt.Errorf("check if listener has user managed node, error: %s", err.Error())
}
if hasUserNode {
klog.Infof("%s port %d vgroup has user managed node, skip", rem.NamedKey, rem.Port)
continue
}

if loc.Port == rem.Port {
err := loc.Remove(ctx)

if !isManagedByMyService(service, rem) {
continue
}

hasUserNode, err := rem.listenerHasUserManagedNode(ctx)
if err != nil {
return fmt.Errorf("check if listener has user managed node, error: %s", err.Error())
}
if hasUserNode {
klog.Infof("%s port %d vgroup has user managed node, skip", rem.NamedKey, rem.Port)
continue
}

err = loc.Remove(ctx)
if err != nil {
return fmt.Errorf("ensure listener: %s", err.Error())
}
Expand Down Expand Up @@ -1499,6 +1503,10 @@ func (n *Listener) listenerHasUserManagedNode(ctx context.Context) (bool, error)
return false, err
}

if n.VServerGroupId == "" {
return false, nil
}

remoteVg, err := n.Client.DescribeVServerGroupAttribute(
ctx,
&slb.DescribeVServerGroupAttributeArgs{
Expand Down

0 comments on commit 6fda98c

Please sign in to comment.