Skip to content

Commit cbc3d23

Browse files
authored
Add .status.versions.reconciled to runtime components (#530)
1 parent d609bfd commit cbc3d23

File tree

13 files changed

+77
-0
lines changed

13 files changed

+77
-0
lines changed

api/v1/runtimecomponent_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ type RuntimeComponentStatus struct {
370370
Conditions []StatusCondition `json:"conditions,omitempty"`
371371
Endpoints []StatusEndpoint `json:"endpoints,omitempty"`
372372
ImageReference string `json:"imageReference,omitempty"`
373+
Versions StatusVersions `json:"versions,omitempty"`
373374

374375
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Service Binding"
375376
Binding *corev1.LocalObjectReference `json:"binding,omitempty"`
@@ -413,6 +414,10 @@ const (
413414
StatusEndpointScopeInternal StatusEndpointScope = "Internal"
414415
)
415416

417+
type StatusVersions struct {
418+
Reconciled string `json:"reconciled,omitempty"`
419+
}
420+
416421
// +kubebuilder:resource:path=runtimecomponents,scope=Namespaced,shortName=comp;comps
417422
// +kubebuilder:object:root=true
418423
// +kubebuilder:subresource:status

api/v1/runtimeoperation_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type RuntimeOperationSpec struct {
4141
type RuntimeOperationStatus struct {
4242
// +listType=atomic
4343
Conditions []OperationStatusCondition `json:"conditions,omitempty"`
44+
Versions StatusVersions `json:"versions,omitempty"`
4445
}
4546

4647
// +kubebuilder:object:root=true

api/v1/zz_generated.deepcopy.go

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/rc.app.stacks_runtimecomponents.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7014,6 +7014,11 @@ spec:
70147014
additionalProperties:
70157015
type: string
70167016
type: object
7017+
versions:
7018+
properties:
7019+
reconciled:
7020+
type: string
7021+
type: object
70177022
type: object
70187023
type: object
70197024
served: true

bundle/manifests/rc.app.stacks_runtimeoperations.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ spec:
7878
type: object
7979
type: array
8080
x-kubernetes-list-type: atomic
81+
versions:
82+
properties:
83+
reconciled:
84+
type: string
85+
type: object
8186
type: object
8287
type: object
8388
served: true

bundle/tests/scorecard/kuttl/basic/00-assert.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ status:
1010
replicas: 1
1111
readyReplicas: 1
1212
updatedReplicas: 1
13+
---
14+
apiVersion: rc.app.stacks/v1
15+
kind: RuntimeComponent
16+
metadata:
17+
name: example-runtime-component
18+
status:
19+
versions:
20+
reconciled: 1.2.0

config/crd/bases/rc.app.stacks_runtimecomponents.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7011,6 +7011,11 @@ spec:
70117011
additionalProperties:
70127012
type: string
70137013
type: object
7014+
versions:
7015+
properties:
7016+
reconciled:
7017+
type: string
7018+
type: object
70147019
type: object
70157020
type: object
70167021
served: true

config/crd/bases/rc.app.stacks_runtimeoperations.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ spec:
7575
type: object
7676
type: array
7777
x-kubernetes-list-type: atomic
78+
versions:
79+
properties:
80+
reconciled:
81+
type: string
82+
type: object
7883
type: object
7984
type: object
8085
served: true

controllers/runtimecomponent_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req
270270
reqLogger.Error(err, "Failed to reconcile Knative Service")
271271
return r.ManageError(err, common.StatusConditionTypeReconciled, instance)
272272
}
273+
instance.Status.Versions.Reconciled = appstacksutils.RCOOperandVersion
273274
reqLogger.Info("Reconcile RuntimeComponent - completed")
274275
return r.ManageSuccess(common.StatusConditionTypeReconciled, instance)
275276
}
@@ -506,6 +507,7 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req
506507
reqLogger.V(1).Info(fmt.Sprintf("%s is not supported", prometheusv1.SchemeGroupVersion.String()))
507508
}
508509

510+
instance.Status.Versions.Reconciled = appstacksutils.RCOOperandVersion
509511
reqLogger.Info("Reconcile RuntimeComponent - completed")
510512
return r.ManageSuccess(common.StatusConditionTypeReconciled, instance)
511513
}

controllers/runtimeoperation_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func (r *RuntimeOperationReconciler) Reconcile(ctx context.Context, req ctrl.Req
139139
Message: err.Error(),
140140
}
141141
instance.Status.Conditions = appstacksv1.SetOperationCondition(instance.Status.Conditions, c)
142+
instance.Status.Versions.Reconciled = utils.RCOOperandVersion
142143
r.Client.Status().Update(context.TODO(), instance)
143144
return reconcile.Result{}, nil
144145

@@ -150,6 +151,7 @@ func (r *RuntimeOperationReconciler) Reconcile(ctx context.Context, req ctrl.Req
150151
}
151152

152153
instance.Status.Conditions = appstacksv1.SetOperationCondition(instance.Status.Conditions, c)
154+
instance.Status.Versions.Reconciled = utils.RCOOperandVersion
153155
r.Client.Status().Update(context.TODO(), instance)
154156
return reconcile.Result{}, nil
155157
}

0 commit comments

Comments
 (0)