Skip to content

Commit 686fb12

Browse files
committed
Add Version to ROSA Control Plane Status
1 parent 1dfb164 commit 686fb12

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,12 @@ spec:
911911
description: Ready denotes that the ROSAControlPlane API Server is
912912
ready to receive requests.
913913
type: boolean
914+
version:
915+
description: OpenShift semantic version, for example "4.14.5".
916+
type: string
914917
required:
915918
- ready
919+
- version
916920
type: object
917921
type: object
918922
served: true

controlplane/rosa/api/v1beta2/rosacontrolplane_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,9 @@ type RosaControlPlaneStatus struct {
749749
// OIDCEndpointURL is the endpoint url for the managed OIDC provider.
750750
OIDCEndpointURL string `json:"oidcEndpointURL,omitempty"`
751751

752+
// OpenShift semantic version, for example "4.14.5".
753+
Version string `json:"version"`
754+
752755
// Available upgrades for the ROSA hosted control plane.
753756
AvailableUpgrades []string `json:"availableUpgrades,omitempty"`
754757
}

controlplane/rosa/controllers/rosacontrolplane_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func (r *ROSAControlPlaneReconciler) reconcileNormal(ctx context.Context, rosaSc
252252
rosaScope.ControlPlane.Status.ConsoleURL = cluster.Console().URL()
253253
rosaScope.ControlPlane.Status.OIDCEndpointURL = cluster.AWS().STS().OIDCEndpointURL()
254254
rosaScope.ControlPlane.Status.Ready = false
255+
rosaScope.ControlPlane.Status.Version = rosa.RawVersionID(cluster.Version())
255256

256257
switch cluster.Status().State() {
257258
case cmv1.ClusterStateReady:

exp/controllers/rosamachinepool_controller_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ func TestRosaMachinePoolReconcile(t *testing.T) {
145145
},
146146
},
147147
Status: rosacontrolplanev1.RosaControlPlaneStatus{
148-
Ready: true,
149-
ID: fmt.Sprintf("rosa-control-plane-%v", i),
148+
Ready: true,
149+
ID: fmt.Sprintf("rosa-control-plane-%v", i),
150+
Version: "4.15.20",
150151
},
151152
}
152153
}
@@ -370,6 +371,7 @@ func TestRosaMachinePoolReconcile(t *testing.T) {
370371
// make Control Plane ready, can't do this duirng creation
371372
mpPh, err := patch.NewHelper(cp, testEnv)
372373
cp.Status.Ready = true
374+
cp.Status.Version = cp.Spec.Version
373375
g.Expect(mpPh.Patch(ctx, cp)).To(Succeed())
374376
g.Expect(err).ShouldNot(HaveOccurred())
375377

@@ -470,6 +472,7 @@ func TestRosaMachinePoolReconcile(t *testing.T) {
470472
cpPh, err := patch.NewHelper(cp, testEnv)
471473
cp.Status.Ready = true
472474
cp.Status.ID = controlPlaneName
475+
cp.Status.Version = cp.Spec.Version
473476
g.Expect(cpPh.Patch(ctx, cp)).To(Succeed())
474477
g.Expect(err).ShouldNot(HaveOccurred())
475478

0 commit comments

Comments
 (0)