@@ -941,36 +941,36 @@ func (nsc *NetworkServicesController) buildServicesInfo() serviceInfoMap {
941941 targetPort : port .TargetPort .String (),
942942 protocol : strings .ToLower (string (port .Protocol )),
943943 nodePort : int (port .NodePort ),
944- name : svc .ObjectMeta . Name ,
945- namespace : svc .ObjectMeta . Namespace ,
944+ name : svc .Name ,
945+ namespace : svc .Namespace ,
946946 externalIPs : make ([]string , len (svc .Spec .ExternalIPs )),
947947 intTrafficPolicy : & intClusterPolicyDefault ,
948948 extTrafficPolicy : & extClusterPolicyDefault ,
949949 healthCheckNodePort : int (svc .Spec .HealthCheckNodePort ),
950950 }
951- dsrMethod , ok := svc .ObjectMeta . Annotations [svcDSRAnnotation ]
951+ dsrMethod , ok := svc .Annotations [svcDSRAnnotation ]
952952 if ok {
953953 svcInfo .directServerReturn = true
954954 svcInfo .directServerReturnMethod = dsrMethod
955955 }
956956 svcInfo .scheduler = ipvs .RoundRobin
957- schedulingMethod , ok := svc .ObjectMeta . Annotations [svcSchedulerAnnotation ]
957+ schedulingMethod , ok := svc .Annotations [svcSchedulerAnnotation ]
958958 if ok {
959- switch {
960- case schedulingMethod == ipvs .RoundRobin :
959+ switch schedulingMethod {
960+ case ipvs .RoundRobin :
961961 svcInfo .scheduler = ipvs .RoundRobin
962- case schedulingMethod == ipvs .LeastConnection :
962+ case ipvs .LeastConnection :
963963 svcInfo .scheduler = ipvs .LeastConnection
964- case schedulingMethod == ipvs .DestinationHashing :
964+ case ipvs .DestinationHashing :
965965 svcInfo .scheduler = ipvs .DestinationHashing
966- case schedulingMethod == ipvs .SourceHashing :
966+ case ipvs .SourceHashing :
967967 svcInfo .scheduler = ipvs .SourceHashing
968- case schedulingMethod == IpvsMaglevHashing :
968+ case IpvsMaglevHashing :
969969 svcInfo .scheduler = IpvsMaglevHashing
970970 }
971971 }
972972
973- flags , ok := svc .ObjectMeta . Annotations [svcSchedFlagsAnnotation ]
973+ flags , ok := svc .Annotations [svcSchedFlagsAnnotation ]
974974 if ok && svcInfo .scheduler == IpvsMaglevHashing {
975975 svcInfo .flags = parseSchedFlags (flags )
976976 }
@@ -990,17 +990,17 @@ func (nsc *NetworkServicesController) buildServicesInfo() serviceInfoMap {
990990 // https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/v1/defaults.go#L106
991991 svcInfo .sessionAffinityTimeoutSeconds = * svc .Spec .SessionAffinityConfig .ClientIP .TimeoutSeconds
992992 }
993- _ , svcInfo .hairpin = svc .ObjectMeta . Annotations [svcHairpinAnnotation ]
994- _ , svcInfo .hairpinExternalIPs = svc .ObjectMeta . Annotations [svcHairpinExternalIPsAnnotation ]
995- _ , svcInfo .skipLbIps = svc .ObjectMeta . Annotations [svcSkipLbIpsAnnotation ]
993+ _ , svcInfo .hairpin = svc .Annotations [svcHairpinAnnotation ]
994+ _ , svcInfo .hairpinExternalIPs = svc .Annotations [svcHairpinExternalIPsAnnotation ]
995+ _ , svcInfo .skipLbIps = svc .Annotations [svcSkipLbIpsAnnotation ]
996996 svcInfo .intTrafficPolicy = svc .Spec .InternalTrafficPolicy
997997 svcInfo .extTrafficPolicy = & svc .Spec .ExternalTrafficPolicy
998998
999999 // The kube-router.io/service.local annotation has the ability to override the internal and external traffic
10001000 // policy that is set in the spec. Previously, when this was active set both to local when the annotation is
10011001 // true so that previous functionality of the annotation is best preserved. However, this has proved to not
10021002 // be a good fit for ClusterIP traffic, so we retain cluster for internal traffic policy.
1003- if svc .ObjectMeta . Annotations [svcLocalAnnotation ] == "true" {
1003+ if svc .Annotations [svcLocalAnnotation ] == "true" {
10041004 intTrafficPolicyLocal := v1 .ServiceInternalTrafficPolicyCluster
10051005 extTrafficPolicyLocal := v1 .ServiceExternalTrafficPolicyLocal
10061006 svcInfo .intTrafficPolicy = & intTrafficPolicyLocal
0 commit comments