Skip to content

Commit

Permalink
Dev annotations null deal 20200702 (#4)
Browse files Browse the repository at this point in the history
* annotations null deal

* update deploy.yaml
  • Loading branch information
yichuankaorou authored Jul 2, 2020
1 parent 3b111dd commit 5b0fcd1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deploy/base/cloud-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- key: "node-role.kubernetes.io/master"
effect: NoSchedule
containers:
- image: registry-bj.capitalonline.net/cck/cdscloud-controller-manager:v1.0.1
- image: registry-bj.capitalonline.net/cck/cdscloud-controller-manager:v1.0.3
name: cds-cloud-controller-manager
imagePullPolicy: Always
args:
Expand Down
25 changes: 18 additions & 7 deletions pkg/ccm/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,14 @@ func updateClassicLoadBalancer(ctx context.Context, service *v1.Service, nodes [

// get service annotations
var annotationsSliceTmp []string
for key, value := range service.ObjectMeta.Annotations {
stringTmp := key + ":" + value
annotationsSliceTmp = append(annotationsSliceTmp, stringTmp)
if len(service.ObjectMeta.Annotations) != 0 {
for key, value := range service.ObjectMeta.Annotations {
stringTmp := key + ":" + value
annotationsSliceTmp = append(annotationsSliceTmp, stringTmp)
}

} else {
annotationsSliceTmp = append(annotationsSliceTmp, "")
}
log.Infof("updateClassicLoadBalancer:: annotationsSliceTmp is: %s", annotationsSliceTmp)

Expand Down Expand Up @@ -331,11 +336,17 @@ func createClassicLoadBalancer(ctx context.Context, service *v1.Service, nodes [

// get service annotations
var annotationsSliceTmp []string
for key, value := range service.ObjectMeta.Annotations {
stringTmp := key + ":" + value
annotationsSliceTmp = append(annotationsSliceTmp, stringTmp)

if len(service.ObjectMeta.Annotations) != 0 {
for key, value := range service.ObjectMeta.Annotations {
stringTmp := key + ":" + value
annotationsSliceTmp = append(annotationsSliceTmp, stringTmp)
}

} else {
annotationsSliceTmp = append(annotationsSliceTmp, "")
}
log.Infof("createClassicLoadBalancer:: annotationsSliceTmp is: %s", annotationsSliceTmp)
log.Infof("updateClassicLoadBalancer:: annotationsSliceTmp is: %s", annotationsSliceTmp)

// to create loadBalancer
res, err := clb.CreateLoadBalancers(&clb.CreateLoadBalancersArgs{
Expand Down

0 comments on commit 5b0fcd1

Please sign in to comment.