@@ -121,7 +121,7 @@ func (s *Service) reconcileCluster(ctx context.Context) error {
121121 return errors .Wrap (err , "failed reconciling cluster config" )
122122 }
123123
124- if err := s .reconcileAccessConfig (cluster .AccessConfig ); err != nil {
124+ if err := s .reconcileAccessConfig (ctx , cluster .AccessConfig ); err != nil {
125125 return errors .Wrap (err , "failed reconciling access config" )
126126 }
127127
@@ -429,7 +429,7 @@ func (s *Service) createCluster(ctx context.Context, eksClusterName string) (*ek
429429 var accessConfig * ekstypes.CreateAccessConfigRequest
430430 if s .scope .ControlPlane .Spec .AccessConfig != nil && s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode != "" {
431431 accessConfig = & ekstypes.CreateAccessConfigRequest {
432- AuthenticationMode : string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode ),
432+ AuthenticationMode : ekstypes . AuthenticationMode ( string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode ) ),
433433 }
434434 }
435435
@@ -485,10 +485,6 @@ func (s *Service) createCluster(ctx context.Context, eksClusterName string) (*ek
485485 BootstrapSelfManagedAddons : bootstrapAddon ,
486486 }
487487
488- if err := input .Validate (); err != nil {
489- return nil , errors .Wrap (err , "created invalid CreateClusterInput" )
490- }
491-
492488 var out * eks.CreateClusterOutput
493489 if err := wait .WaitForWithRetryable (wait .NewBackoff (), func () (bool , error ) {
494490 if out , err = s .EKSClient .CreateCluster (ctx , input ); err != nil {
@@ -558,40 +554,34 @@ func (s *Service) reconcileClusterConfig(ctx context.Context, cluster *ekstypes.
558554 return nil
559555}
560556
561- func (s * Service ) reconcileAccessConfig (accessConfig * ekstypes.AccessConfigResponse ) error {
557+ func (s * Service ) reconcileAccessConfig (ctx context. Context , accessConfig * ekstypes.AccessConfigResponse ) error {
562558 input := & eks.UpdateClusterConfigInput {Name : aws .String (s .scope .KubernetesClusterName ())}
563559
564560 if s .scope .ControlPlane .Spec .AccessConfig == nil || s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode == "" {
565561 return nil
566562 }
567563
568- expectedAuthenticationMode := string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode )
564+ expectedAuthenticationMode := ekstypes . AuthenticationMode ( string (s .scope .ControlPlane .Spec .AccessConfig .AuthenticationMode ) )
569565 s .scope .Debug ("Reconciling EKS Access Config for cluster" , "cluster-name" , s .scope .KubernetesClusterName (), "expected" , expectedAuthenticationMode , "current" , accessConfig .AuthenticationMode )
570566 if expectedAuthenticationMode != accessConfig .AuthenticationMode {
571- input .AccessConfig = & eks .UpdateAccessConfigRequest {
572- AuthenticationMode : aws . String ( expectedAuthenticationMode ) ,
567+ input .AccessConfig = & ekstypes .UpdateAccessConfigRequest {
568+ AuthenticationMode : expectedAuthenticationMode ,
573569 }
574570 }
575571
576572 if input .AccessConfig != nil {
577- if err := input .Validate (); err != nil {
578- return errors .Wrap (err , "created invalid UpdateClusterConfigInput" )
579- }
580-
581573 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 {
586575 return false , err
587576 }
588577
589578 // Wait until status transitions to UPDATING because there's a short
590579 // window after UpdateClusterConfig returns where the cluster
591580 // status is ACTIVE and the update would be tried again
592581 if err := s .EKSClient .WaitUntilClusterUpdating (
582+ ctx ,
593583 & eks.DescribeClusterInput {Name : aws .String (s .scope .KubernetesClusterName ())},
594- request . WithWaiterLogger ( & awslog { s . GetLogger ()}) ,
584+ s . scope . MaxWaitActiveUpdateDelete ,
595585 ); err != nil {
596586 return false , err
597587 }
0 commit comments