Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ spec:
description: Ready denotes that the ROSAControlPlane API Server is
ready to receive requests.
type: boolean
version:
description: OpenShift semantic version, for example "4.14.5".
type: string
required:
- ready
type: object
Expand Down
4 changes: 4 additions & 0 deletions controlplane/rosa/api/v1beta2/rosacontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,10 @@ type RosaControlPlaneStatus struct {
// OIDCEndpointURL is the endpoint url for the managed OIDC provider.
OIDCEndpointURL string `json:"oidcEndpointURL,omitempty"`

// OpenShift semantic version, for example "4.14.5".
// +optional
Version string `json:"version"`

// Available upgrades for the ROSA hosted control plane.
AvailableUpgrades []string `json:"availableUpgrades,omitempty"`
}
Expand Down
14 changes: 10 additions & 4 deletions controlplane/rosa/controllers/rosacontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type ROSAControlPlaneReconciler struct {
Endpoints []scope.ServiceEndpoint
NewStsClient func(cloud.ScopeUsage, cloud.Session, logger.Wrapper, runtime.Object) stsiface.STSAPI
NewOCMClient func(ctx context.Context, rosaScope *scope.ROSAControlPlaneScope) (rosa.OCMClient, error)
// Exposing the restClientConfig for integration test. No need to initialize.
restClientConfig *restclient.Config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
restClientConfig *restclient.Config
// Exposing the restClientConfig for integration test, No need to initialize
restClientConfig *restclient.Config

}

// SetupWithManager is used to setup the controller.
Expand Down Expand Up @@ -252,6 +254,7 @@ func (r *ROSAControlPlaneReconciler) reconcileNormal(ctx context.Context, rosaSc
rosaScope.ControlPlane.Status.ConsoleURL = cluster.Console().URL()
rosaScope.ControlPlane.Status.OIDCEndpointURL = cluster.AWS().STS().OIDCEndpointURL()
rosaScope.ControlPlane.Status.Ready = false
rosaScope.ControlPlane.Status.Version = rosa.RawVersionID(cluster.Version())

switch cluster.Status().State() {
case cmv1.ClusterStateReady:
Expand Down Expand Up @@ -801,13 +804,16 @@ func (r *ROSAControlPlaneReconciler) reconcileKubeconfig(ctx context.Context, ro
return err
}

clientConfig := &restclient.Config{
Host: apiServerURL,
Username: userName,
if r.restClientConfig == nil {
r.restClientConfig = &restclient.Config{
Host: apiServerURL,
Username: userName,
}
}

// request an acccess token using the credentials of the cluster admin user created earlier.
// this token is used in the kubeconfig to authenticate with the API server.
token, err := rosa.RequestToken(ctx, apiServerURL, userName, password, clientConfig)
token, err := rosa.RequestToken(ctx, apiServerURL, userName, password, r.restClientConfig)
if err != nil {
return fmt.Errorf("failed to request token: %w", err)
}
Expand Down
Loading