Skip to content

Commit 9a99433

Browse files
Call ReadOne as part of createResource (#43)
Some status fields were not being set properly during the first reconciliation loop, as part of the Create flow. This loop called the `Create*` operation, and set any status fields that are returned as part of the output shape, and then returned successfully (without re-queuing). Previously, the reconciler would loop again to describe and set the other status fields, however we now filter out any events that do not change the resource generation. This fix will call `ReadOne` to describe the newly created resource and set the status fields based on that response, directly after calling `Create*`. This ensures all fields are set before completing the first reconciliation loop.
1 parent d7b6e45 commit 9a99433

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkg/runtime/reconciler.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,17 @@ func (r *resourceReconciler) createResource(
263263
if err != nil {
264264
return latest, err
265265
}
266+
267+
rlog.Enter("rm.ReadOne")
268+
observed, err := rm.ReadOne(ctx, latest)
269+
rlog.Exit("rm.ReadOne", err)
270+
if err != nil {
271+
return latest, err
272+
}
273+
274+
// Take the status from the latest ReadOne
275+
latest.SetStatus(observed)
276+
266277
// Ensure that we are patching any changes to the annotations/metadata and
267278
// the Spec that may have been set by the resource manager's successful
268279
// Create call above.

pkg/types/aws_resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ type AWSResource interface {
5555
// SetIdentifiers will set the the Spec or Status field that represents the
5656
// identifier for the resource.
5757
SetIdentifiers(*ackv1alpha1.AWSIdentifiers) error
58+
// SetStatus will set the Status field for the resource
59+
SetStatus(AWSResource)
5860
}

0 commit comments

Comments
 (0)