@@ -94,6 +94,8 @@ type ROSAControlPlaneReconciler struct {
94
94
Endpoints []scope.ServiceEndpoint
95
95
NewStsClient func (cloud.ScopeUsage , cloud.Session , logger.Wrapper , runtime.Object ) stsiface.STSAPI
96
96
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
97
99
}
98
100
99
101
// SetupWithManager is used to setup the controller.
@@ -252,6 +254,7 @@ func (r *ROSAControlPlaneReconciler) reconcileNormal(ctx context.Context, rosaSc
252
254
rosaScope .ControlPlane .Status .ConsoleURL = cluster .Console ().URL ()
253
255
rosaScope .ControlPlane .Status .OIDCEndpointURL = cluster .AWS ().STS ().OIDCEndpointURL ()
254
256
rosaScope .ControlPlane .Status .Ready = false
257
+ rosaScope .ControlPlane .Status .Version = rosa .RawVersionID (cluster .Version ())
255
258
256
259
switch cluster .Status ().State () {
257
260
case cmv1 .ClusterStateReady :
@@ -801,13 +804,16 @@ func (r *ROSAControlPlaneReconciler) reconcileKubeconfig(ctx context.Context, ro
801
804
return err
802
805
}
803
806
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
+ }
807
812
}
813
+
808
814
// request an acccess token using the credentials of the cluster admin user created earlier.
809
815
// 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 )
811
817
if err != nil {
812
818
return fmt .Errorf ("failed to request token: %w" , err )
813
819
}
0 commit comments