@@ -94,6 +94,8 @@ type ROSAControlPlaneReconciler struct {
9494 Endpoints []scope.ServiceEndpoint
9595 NewStsClient func (cloud.ScopeUsage , cloud.Session , logger.Wrapper , runtime.Object ) stsiface.STSAPI
9696 NewOCMClient func (ctx context.Context , rosaScope * scope.ROSAControlPlaneScope ) (rosa.OCMClient , error )
97+ // Exposing the restClientConfig for integration test. No need to initialize.
98+ restClientConfig * restclient.Config
9799}
98100
99101// SetupWithManager is used to setup the controller.
@@ -252,6 +254,7 @@ func (r *ROSAControlPlaneReconciler) reconcileNormal(ctx context.Context, rosaSc
252254 rosaScope .ControlPlane .Status .ConsoleURL = cluster .Console ().URL ()
253255 rosaScope .ControlPlane .Status .OIDCEndpointURL = cluster .AWS ().STS ().OIDCEndpointURL ()
254256 rosaScope .ControlPlane .Status .Ready = false
257+ rosaScope .ControlPlane .Status .Version = rosa .RawVersionID (cluster .Version ())
255258
256259 switch cluster .Status ().State () {
257260 case cmv1 .ClusterStateReady :
@@ -801,13 +804,16 @@ func (r *ROSAControlPlaneReconciler) reconcileKubeconfig(ctx context.Context, ro
801804 return err
802805 }
803806
804- clientConfig := & restclient.Config {
805- Host : apiServerURL ,
806- Username : userName ,
807+ if r .restClientConfig == nil {
808+ r .restClientConfig = & restclient.Config {
809+ Host : apiServerURL ,
810+ Username : userName ,
811+ }
807812 }
813+
808814 // request an acccess token using the credentials of the cluster admin user created earlier.
809815 // this token is used in the kubeconfig to authenticate with the API server.
810- token , err := rosa .RequestToken (ctx , apiServerURL , userName , password , clientConfig )
816+ token , err := rosa .RequestToken (ctx , apiServerURL , userName , password , r . restClientConfig )
811817 if err != nil {
812818 return fmt .Errorf ("failed to request token: %w" , err )
813819 }
0 commit comments