@@ -941,20 +941,20 @@ func (nsc *NetworkServicesController) buildServicesInfo() serviceInfoMap {
941
941
targetPort : port .TargetPort .String (),
942
942
protocol : strings .ToLower (string (port .Protocol )),
943
943
nodePort : int (port .NodePort ),
944
- name : svc .ObjectMeta . Name ,
945
- namespace : svc .ObjectMeta . Namespace ,
944
+ name : svc .Name ,
945
+ namespace : svc .Namespace ,
946
946
externalIPs : make ([]string , len (svc .Spec .ExternalIPs )),
947
947
intTrafficPolicy : & intClusterPolicyDefault ,
948
948
extTrafficPolicy : & extClusterPolicyDefault ,
949
949
healthCheckNodePort : int (svc .Spec .HealthCheckNodePort ),
950
950
}
951
- dsrMethod , ok := svc .ObjectMeta . Annotations [svcDSRAnnotation ]
951
+ dsrMethod , ok := svc .Annotations [svcDSRAnnotation ]
952
952
if ok {
953
953
svcInfo .directServerReturn = true
954
954
svcInfo .directServerReturnMethod = dsrMethod
955
955
}
956
956
svcInfo .scheduler = ipvs .RoundRobin
957
- schedulingMethod , ok := svc .ObjectMeta . Annotations [svcSchedulerAnnotation ]
957
+ schedulingMethod , ok := svc .Annotations [svcSchedulerAnnotation ]
958
958
if ok {
959
959
switch {
960
960
case schedulingMethod == ipvs .RoundRobin :
@@ -970,7 +970,7 @@ func (nsc *NetworkServicesController) buildServicesInfo() serviceInfoMap {
970
970
}
971
971
}
972
972
973
- flags , ok := svc .ObjectMeta . Annotations [svcSchedFlagsAnnotation ]
973
+ flags , ok := svc .Annotations [svcSchedFlagsAnnotation ]
974
974
if ok && svcInfo .scheduler == IpvsMaglevHashing {
975
975
svcInfo .flags = parseSchedFlags (flags )
976
976
}
@@ -990,17 +990,17 @@ func (nsc *NetworkServicesController) buildServicesInfo() serviceInfoMap {
990
990
// https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/v1/defaults.go#L106
991
991
svcInfo .sessionAffinityTimeoutSeconds = * svc .Spec .SessionAffinityConfig .ClientIP .TimeoutSeconds
992
992
}
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 ]
996
996
svcInfo .intTrafficPolicy = svc .Spec .InternalTrafficPolicy
997
997
svcInfo .extTrafficPolicy = & svc .Spec .ExternalTrafficPolicy
998
998
999
999
// The kube-router.io/service.local annotation has the ability to override the internal and external traffic
1000
1000
// policy that is set in the spec. Previously, when this was active set both to local when the annotation is
1001
1001
// true so that previous functionality of the annotation is best preserved. However, this has proved to not
1002
1002
// 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" {
1004
1004
intTrafficPolicyLocal := v1 .ServiceInternalTrafficPolicyCluster
1005
1005
extTrafficPolicyLocal := v1 .ServiceExternalTrafficPolicyLocal
1006
1006
svcInfo .intTrafficPolicy = & intTrafficPolicyLocal
0 commit comments