@@ -30,7 +30,7 @@ const (
3030 healthCheckPortTrafficPort = "traffic-port"
3131)
3232
33- func (t * defaultModelBuildTask ) buildTargetGroup (ctx context.Context , svc * corev1. Service , port corev1.ServicePort , tgProtocol elbv2model.Protocol , scheme elbv2model.LoadBalancerScheme ) (* elbv2model.TargetGroup , error ) {
33+ func (t * defaultModelBuildTask ) buildTargetGroup (ctx context.Context , port corev1.ServicePort , tgProtocol elbv2model.Protocol , scheme elbv2model.LoadBalancerScheme ) (* elbv2model.TargetGroup , error ) {
3434 svcPort := intstr .FromInt (int (port .Port ))
3535 tgResourceID := t .buildTargetGroupResourceID (k8s .NamespacedName (t .service ), svcPort )
3636 if targetGroup , exists := t .tgByResID [tgResourceID ]; exists {
@@ -40,7 +40,7 @@ func (t *defaultModelBuildTask) buildTargetGroup(ctx context.Context, svc *corev
4040 if err != nil {
4141 return nil , err
4242 }
43- healthCheckConfig , err := t .buildTargetGroupHealthCheckConfig (ctx , svc , targetType )
43+ healthCheckConfig , err := t .buildTargetGroupHealthCheckConfig (ctx , targetType )
4444 if err != nil {
4545 return nil , err
4646 }
@@ -89,22 +89,22 @@ func (t *defaultModelBuildTask) buildTargetGroupSpec(ctx context.Context, tgProt
8989 }, nil
9090}
9191
92- func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckConfig (ctx context.Context , svc * corev1. Service , targetType elbv2model.TargetType ) (* elbv2model.TargetGroupHealthCheckConfig , error ) {
92+ func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckConfig (ctx context.Context , targetType elbv2model.TargetType ) (* elbv2model.TargetGroupHealthCheckConfig , error ) {
9393 if targetType == elbv2model .TargetTypeInstance && t .service .Spec .ExternalTrafficPolicy == corev1 .ServiceExternalTrafficPolicyTypeLocal &&
9494 t .service .Spec .Type == corev1 .ServiceTypeLoadBalancer {
95- return t .buildTargetGroupHealthCheckConfigForInstanceModeLocal (ctx , svc , targetType )
95+ return t .buildTargetGroupHealthCheckConfigForInstanceModeLocal (ctx , targetType )
9696 }
97- return t .buildTargetGroupHealthCheckConfigDefault (ctx , svc , targetType )
97+ return t .buildTargetGroupHealthCheckConfigDefault (ctx , targetType )
9898}
9999
100- func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckConfigDefault (ctx context.Context , svc * corev1. Service , targetType elbv2model.TargetType ) (* elbv2model.TargetGroupHealthCheckConfig , error ) {
100+ func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckConfigDefault (ctx context.Context , targetType elbv2model.TargetType ) (* elbv2model.TargetGroupHealthCheckConfig , error ) {
101101 healthCheckProtocol , err := t .buildTargetGroupHealthCheckProtocol (ctx , t .defaultHealthCheckProtocol )
102102 if err != nil {
103103 return nil , err
104104 }
105105 healthCheckPathPtr := t .buildTargetGroupHealthCheckPath (ctx , t .defaultHealthCheckPath , healthCheckProtocol )
106106 healthCheckMatcherPtr := t .buildTargetGroupHealthCheckMatcher (ctx , healthCheckProtocol )
107- healthCheckPort , err := t .buildTargetGroupHealthCheckPort (ctx , svc , t .defaultHealthCheckPort , targetType )
107+ healthCheckPort , err := t .buildTargetGroupHealthCheckPort (ctx , t .defaultHealthCheckPort , targetType )
108108 if err != nil {
109109 return nil , err
110110 }
@@ -137,14 +137,14 @@ func (t *defaultModelBuildTask) buildTargetGroupHealthCheckConfigDefault(ctx con
137137 }, nil
138138}
139139
140- func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckConfigForInstanceModeLocal (ctx context.Context , svc * corev1. Service , targetType elbv2model.TargetType ) (* elbv2model.TargetGroupHealthCheckConfig , error ) {
140+ func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckConfigForInstanceModeLocal (ctx context.Context , targetType elbv2model.TargetType ) (* elbv2model.TargetGroupHealthCheckConfig , error ) {
141141 healthCheckProtocol , err := t .buildTargetGroupHealthCheckProtocol (ctx , t .defaultHealthCheckProtocolForInstanceModeLocal )
142142 if err != nil {
143143 return nil , err
144144 }
145145 healthCheckPathPtr := t .buildTargetGroupHealthCheckPath (ctx , t .defaultHealthCheckPathForInstanceModeLocal , healthCheckProtocol )
146146 healthCheckMatcherPtr := t .buildTargetGroupHealthCheckMatcher (ctx , healthCheckProtocol )
147- healthCheckPort , err := t .buildTargetGroupHealthCheckPort (ctx , svc , t .defaultHealthCheckPortForInstanceModeLocal , targetType )
147+ healthCheckPort , err := t .buildTargetGroupHealthCheckPort (ctx , t .defaultHealthCheckPortForInstanceModeLocal , targetType )
148148 if err != nil {
149149 return nil , err
150150 }
@@ -276,7 +276,7 @@ func (t *defaultModelBuildTask) buildTargetGroupPort(_ context.Context, targetTy
276276 return 1
277277}
278278
279- func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckPort (_ context.Context , svc * corev1. Service , defaultHealthCheckPort string , targetType elbv2model.TargetType ) (intstr.IntOrString , error ) {
279+ func (t * defaultModelBuildTask ) buildTargetGroupHealthCheckPort (_ context.Context , defaultHealthCheckPort string , targetType elbv2model.TargetType ) (intstr.IntOrString , error ) {
280280 rawHealthCheckPort := defaultHealthCheckPort
281281 t .annotationParser .ParseStringAnnotation (annotations .SvcLBSuffixHCPort , & rawHealthCheckPort , t .service .Annotations )
282282 if rawHealthCheckPort == healthCheckPortTrafficPort {
@@ -287,7 +287,7 @@ func (t *defaultModelBuildTask) buildTargetGroupHealthCheckPort(_ context.Contex
287287 return healthCheckPort , nil
288288 }
289289
290- svcPort , err := k8s .LookupServicePort (svc , healthCheckPort )
290+ svcPort , err := k8s .LookupServicePort (t . service , healthCheckPort )
291291 if err != nil {
292292 return intstr.IntOrString {}, errors .Wrap (err , "failed to resolve healthCheckPort" )
293293 }
0 commit comments