Skip to content

Commit 968fef1

Browse files
authored
Add structured reporting diff to AlloyDBInstance (#6782)
### BRIEF Change description Fixes #6529 #### WHY do we need this change? Add structured reporting diff to the controller in `pkg/controller/direct/alloydb/instance_controller.go`. The `structuredreporting.ReportDiff` should be used in the `Update` method of the adapter to report which fields are being updated. This helps in debugging reconciliation loops and provides better visibility into what changed. #### Special notes for your reviewer: #### Does this PR add something which needs to be 'release noted'? ```release-note NONE ``` #### Additional documentation e.g., references, usage docs, etc.: ```docs NONE ``` #### Intended Milestone - [ ] Reviewer tagged PR with the actual milestone. ### Tests you have done - [ ] Run `make ready-pr` to ensure this PR is ready for review. - [ ] Perform necessary E2E testing for changed resources.
2 parents fe9ac45 + 991c19b commit 968fef1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/controller/direct/alloydb/instance_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/directbase"
2828
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/registry"
2929
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/label"
30+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/structuredreporting"
3031

3132
gcp "cloud.google.com/go/alloydb/apiv1beta"
3233
alloydbpb "cloud.google.com/go/alloydb/apiv1beta/alloydbpb"
@@ -298,6 +299,13 @@ func (a *instanceAdapter) Update(ctx context.Context, updateOp *directbase.Updat
298299
}
299300
return nil
300301
}
302+
303+
report := &structuredreporting.Diff{Object: updateOp.GetUnstructured()}
304+
for _, path := range updatePaths {
305+
report.AddField(path, nil, nil)
306+
}
307+
structuredreporting.ReportDiff(ctx, report)
308+
301309
updateMask := &fieldmaskpb.FieldMask{
302310
Paths: updatePaths,
303311
}

0 commit comments

Comments
 (0)