@@ -187,7 +187,7 @@ func (l *loadbalancers) cleanupOldNodeBalancer(ctx context.Context, service *v1.
187187// GetLoadBalancerName returns the name of the load balancer.
188188//
189189// GetLoadBalancer will not modify service.
190- func (l * loadbalancers ) GetLoadBalancerName (ctx context.Context , clusterName string , service * v1.Service ) string {
190+ func (l * loadbalancers ) GetLoadBalancerName (_ context.Context , _ string , _ * v1.Service ) string {
191191 unixNano := strconv .FormatInt (time .Now ().UnixNano (), 16 )
192192 return fmt .Sprintf ("ccm-%s" , unixNano [len (unixNano )- 12 :])
193193}
@@ -279,7 +279,7 @@ func (l *loadbalancers) updateNodeBalancer(ctx context.Context, service *v1.Serv
279279 }
280280 }
281281
282- tags := l .getLoadbalancerTags (ctx , service )
282+ tags := l .getLoadBalancerTags (ctx , service )
283283 if ! reflect .DeepEqual (nb .Tags , tags ) {
284284 update := nb .GetUpdateOptions ()
285285 update .Tags = & tags
@@ -504,7 +504,7 @@ func (l *loadbalancers) getNodeBalancerByID(ctx context.Context, service *v1.Ser
504504 return nb , nil
505505}
506506
507- func (l * loadbalancers ) getLoadbalancerTags ( ctx context.Context , service * v1.Service ) []string {
507+ func (l * loadbalancers ) getLoadBalancerTags ( _ context.Context , service * v1.Service ) []string {
508508 tagStr , ok := getServiceAnnotation (service , annLinodeLoadBalancerTags )
509509 if ok {
510510 return strings .Split (tagStr , "," )
@@ -516,7 +516,7 @@ func (l *loadbalancers) createNodeBalancer(ctx context.Context, clusterName stri
516516 connThrottle := getConnectionThrottle (service )
517517
518518 label := l .GetLoadBalancerName (ctx , clusterName , service )
519- tags := l .getLoadbalancerTags (ctx , service )
519+ tags := l .getLoadBalancerTags (ctx , service )
520520 createOpts := linodego.NodeBalancerCreateOptions {
521521 Label : & label ,
522522 Region : l .zone ,
@@ -706,23 +706,20 @@ func getPortConfig(service *v1.Service, port int) (portConfig, error) {
706706 }
707707 protocol := portConfigAnnotation .Protocol
708708 if protocol == "" {
709- var ok bool
710- protocol , ok = service .Annotations [annLinodeDefaultProtocol ]
711- if ! ok {
712- protocol = "tcp"
709+ protocol = "tcp"
710+ if p , ok := service .Annotations [annLinodeDefaultProtocol ]; ok {
711+ protocol = p
713712 }
714713 }
715714 protocol = strings .ToLower (protocol )
716715
717716 proxyProtocol := portConfigAnnotation .ProxyProtocol
718717 if proxyProtocol == "" {
719- var ok bool
718+ proxyProtocol = string ( linodego . ProxyProtocolNone )
720719 for _ , ann := range []string {annLinodeDefaultProxyProtocol , annLinodeProxyProtocolDeprecated } {
721- proxyProtocol , ok = service .Annotations [ann ]
722- if ok {
720+ if pp , ok : = service .Annotations [ann ]; ok {
721+ proxyProtocol = pp
723722 break
724- } else {
725- proxyProtocol = string (linodego .ProxyProtocolNone )
726723 }
727724 }
728725 }
0 commit comments