Skip to content

Commit

Permalink
Bugfix: don't detach tag when tags is empty (#105)
Browse files Browse the repository at this point in the history
this bug is introduced by #95

Signed-off-by: Duan Jiong <[email protected]>
  • Loading branch information
duanjiong authored Aug 11, 2020
1 parent 7278181 commit 26113c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/executor/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import (
)

func AttachTagsToResources(tagapi *service.TagService, tags []string, resourceIDs []string, resourceType string) error {
if len(tags) <= 0 {
return nil
}

input := &service.AttachTagsInput{}
for _, tag := range tags {
for _, resourceID := range resourceIDs {
Expand All @@ -29,6 +33,10 @@ func AttachTagsToResources(tagapi *service.TagService, tags []string, resourceID
}

func DetachTagsFromResources(tagapi *service.TagService, tags []string, resourceIDs []string, resourceType string) error {
if len(tags) <= 0 {
return nil
}

input := &service.DetachTagsInput{}
for _, tag := range tags {
for _, resourceID := range resourceIDs {
Expand Down
1 change: 1 addition & 0 deletions pkg/loadbalance/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
ServiceAnnotationLoadBalancerEipSource = "service.beta.kubernetes.io/qingcloud-load-balancer-eip-source"

//ReuseExistingLB use existing loadbalancer on the cloud
//We can't change any properties.
ReuseExistingLB Policy = "reuse-lb"
// Shared represent the EIP can be shared with other service which has no port conflict
Shared Policy = "reuse"
Expand Down
2 changes: 2 additions & 0 deletions pkg/loadbalance/loadbalancer_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ func (l *Listener) CreateQingCloudListenerWithBackends() error {
l.initBackends()
err = l.backendList.CreateBackends()
if err != nil {
//It is possible that the hostname has been modified, and when adding the backend, you can't find the host
//by the hostname. we should adding annotation "node.beta.kubernetes.io/instance-id" to the node
klog.Errorf("Failed to create backends of listener %s", l.Name)
return err
}
Expand Down

0 comments on commit 26113c8

Please sign in to comment.