@@ -121,7 +121,7 @@ func (s *Service) reconcileCluster(ctx context.Context) error {
121
121
return errors .Wrap (err , "failed reconciling cluster config" )
122
122
}
123
123
124
- if err := s .reconcileAccessConfig (cluster .AccessConfig ); err != nil {
124
+ if err := s .reconcileAccessConfig (ctx , cluster .AccessConfig ); err != nil {
125
125
return errors .Wrap (err , "failed reconciling access config" )
126
126
}
127
127
@@ -429,7 +429,7 @@ func (s *Service) createCluster(ctx context.Context, eksClusterName string) (*ek
429
429
var accessConfig * ekstypes.CreateAccessConfigRequest
430
430
if s .scope .ControlPlane .Spec .AccessConfig != nil && s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode != "" {
431
431
accessConfig = & ekstypes.CreateAccessConfigRequest {
432
- AuthenticationMode : string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode ),
432
+ AuthenticationMode : ekstypes . AuthenticationMode ( string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode ) ),
433
433
}
434
434
}
435
435
@@ -485,10 +485,6 @@ func (s *Service) createCluster(ctx context.Context, eksClusterName string) (*ek
485
485
BootstrapSelfManagedAddons : bootstrapAddon ,
486
486
}
487
487
488
- if err := input .Validate (); err != nil {
489
- return nil , errors .Wrap (err , "created invalid CreateClusterInput" )
490
- }
491
-
492
488
var out * eks.CreateClusterOutput
493
489
if err := wait .WaitForWithRetryable (wait .NewBackoff (), func () (bool , error ) {
494
490
if out , err = s .EKSClient .CreateCluster (ctx , input ); err != nil {
@@ -558,40 +554,34 @@ func (s *Service) reconcileClusterConfig(ctx context.Context, cluster *ekstypes.
558
554
return nil
559
555
}
560
556
561
- func (s * Service ) reconcileAccessConfig (accessConfig * ekstypes.AccessConfigResponse ) error {
557
+ func (s * Service ) reconcileAccessConfig (ctx context. Context , accessConfig * ekstypes.AccessConfigResponse ) error {
562
558
input := & eks.UpdateClusterConfigInput {Name : aws .String (s .scope .KubernetesClusterName ())}
563
559
564
560
if s .scope .ControlPlane .Spec .AccessConfig == nil || s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode == "" {
565
561
return nil
566
562
}
567
563
568
- expectedAuthenticationMode := string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode )
564
+ expectedAuthenticationMode := ekstypes . AuthenticationMode ( string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode ) )
569
565
s .scope .Debug ("Reconciling EKS Access Config for cluster" , "cluster-name" , s .scope .KubernetesClusterName (), "expected" , expectedAuthenticationMode , "current" , accessConfig .AuthenticationMode )
570
566
if expectedAuthenticationMode != accessConfig .AuthenticationMode {
571
- input .AccessConfig = & eks .UpdateAccessConfigRequest {
572
- AuthenticationMode : aws . String ( expectedAuthenticationMode ) ,
567
+ input .AccessConfig = & ekstypes .UpdateAccessConfigRequest {
568
+ AuthenticationMode : expectedAuthenticationMode ,
573
569
}
574
570
}
575
571
576
572
if input .AccessConfig != nil {
577
- if err := input .Validate (); err != nil {
578
- return errors .Wrap (err , "created invalid UpdateClusterConfigInput" )
579
- }
580
-
581
573
if err := wait .WaitForWithRetryable (wait .NewBackoff (), func () (bool , error ) {
582
- if _ , err := s .EKSClient .UpdateClusterConfig (input ); err != nil {
583
- if aerr , ok := err .(awserr.Error ); ok {
584
- return false , aerr
585
- }
574
+ if _ , err := s .EKSClient .UpdateClusterConfig (ctx , input ); err != nil {
586
575
return false , err
587
576
}
588
577
589
578
// Wait until status transitions to UPDATING because there's a short
590
579
// window after UpdateClusterConfig returns where the cluster
591
580
// status is ACTIVE and the update would be tried again
592
581
if err := s .EKSClient .WaitUntilClusterUpdating (
582
+ ctx ,
593
583
& eks.DescribeClusterInput {Name : aws .String (s .scope .KubernetesClusterName ())},
594
- request . WithWaiterLogger ( & awslog { s . GetLogger ()}) ,
584
+ s . scope . MaxWaitActiveUpdateDelete ,
595
585
); err != nil {
596
586
return false , err
597
587
}
0 commit comments