From 2c1f836c439b1c306a327b03f3f3282179803a24 Mon Sep 17 00:00:00 2001 From: Jason Vigil Date: Thu, 12 Dec 2024 19:45:13 +0000 Subject: [PATCH] fix: Update resource status even if no GCP fields are updated Even when adopting resources, we want to update status. --- .../controllerbuilder/template/controller/controller.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/tools/controllerbuilder/template/controller/controller.go b/dev/tools/controllerbuilder/template/controller/controller.go index 9ddd54f465..344fd2897c 100644 --- a/dev/tools/controllerbuilder/template/controller/controller.go +++ b/dev/tools/controllerbuilder/template/controller/controller.go @@ -227,7 +227,12 @@ func (a *{{.ProtoResource}}Adapter) Update(ctx context.Context, updateOp *direct if len(paths) == 0 { log.V(2).Info("no field needs update", "name", a.id.External) - return nil + status := &krm.{{.Kind}}Status{} + status.ObservedState = {{.Kind}}ObservedState_FromProto(mapCtx, a.actual) + if mapCtx.Err() != nil { + return mapCtx.Err() + } + return updateOp.UpdateStatus(ctx, status, nil) } updateMask := &fieldmaskpb.FieldMask{ Paths: sets.List(paths)}