@@ -239,18 +239,6 @@ func (s *Service) getAdditionalTargetGroupHealthCheck(ln infrav1.AdditionalListe
239
239
return healthCheck
240
240
}
241
241
242
- // getTargetGroupName creates the target group name based on LB Name, when defined, otherwise return
243
- // the standard name created from the timestamp.
244
- func (s * Service ) getTargetGroupName (lbSpec * infrav1.AWSLoadBalancerSpec , defaultPrefix string , port int64 ) string {
245
- targetName := fmt .Sprintf ("%s-%d" , defaultPrefix , time .Now ().Unix ())
246
-
247
- if lbSpec != nil && lbSpec .Name != nil {
248
- targetName = fmt .Sprintf ("%s-%d" , * lbSpec .Name , port )
249
- }
250
-
251
- return targetName
252
- }
253
-
254
242
func (s * Service ) getAPIServerLBSpec (elbName string , lbSpec * infrav1.AWSLoadBalancerSpec ) (* infrav1.LoadBalancer , error ) {
255
243
var securityGroupIDs []string
256
244
if lbSpec != nil {
@@ -266,7 +254,6 @@ func (s *Service) getAPIServerLBSpec(elbName string, lbSpec *infrav1.AWSLoadBala
266
254
267
255
// The default API health check is TCP, allowing customization to HTTP or HTTPS when HealthCheckProtocol is set.
268
256
apiHealthCheck := s .getAPITargetGroupHealthCheck (lbSpec )
269
- apiTargetGroupName := s .getTargetGroupName (lbSpec , "apiserver-target" , infrav1 .DefaultAPIServerPort )
270
257
res := & infrav1.LoadBalancer {
271
258
Name : elbName ,
272
259
Scheme : scheme ,
@@ -276,7 +263,7 @@ func (s *Service) getAPIServerLBSpec(elbName string, lbSpec *infrav1.AWSLoadBala
276
263
Protocol : infrav1 .ELBProtocolTCP ,
277
264
Port : infrav1 .DefaultAPIServerPort ,
278
265
TargetGroup : infrav1.TargetGroupSpec {
279
- Name : apiTargetGroupName ,
266
+ Name : fmt . Sprintf ( "apiserver-target-%d" , time . Now (). Unix ()) ,
280
267
Port : infrav1 .DefaultAPIServerPort ,
281
268
Protocol : infrav1 .ELBProtocolTCP ,
282
269
VpcID : s .scope .VPC ().ID ,
@@ -289,7 +276,6 @@ func (s *Service) getAPIServerLBSpec(elbName string, lbSpec *infrav1.AWSLoadBala
289
276
290
277
if lbSpec != nil {
291
278
for _ , listener := range lbSpec .AdditionalListeners {
292
- targetGroupName := s .getTargetGroupName (lbSpec , "additional-listener" , listener .Port )
293
279
lnHealthCheck := & infrav1.TargetGroupHealthCheck {
294
280
Protocol : aws .String (string (listener .Protocol )),
295
281
Port : aws .String (strconv .FormatInt (listener .Port , 10 )),
@@ -302,7 +288,7 @@ func (s *Service) getAPIServerLBSpec(elbName string, lbSpec *infrav1.AWSLoadBala
302
288
Protocol : listener .Protocol ,
303
289
Port : listener .Port ,
304
290
TargetGroup : infrav1.TargetGroupSpec {
305
- Name : targetGroupName ,
291
+ Name : fmt . Sprintf ( "additional-listener-%d" , time . Now (). Unix ()) ,
306
292
Port : listener .Port ,
307
293
Protocol : listener .Protocol ,
308
294
VpcID : s .scope .VPC ().ID ,
0 commit comments