Skip to content

Commit b0139e5

Browse files
authored
Add structured reporting diff to AppHubApplication (#6779)
### BRIEF Change description Fixes #6535 #### WHY do we need this change? Add structured reporting diff to the controller in `pkg/controller/direct/apphub/application_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 d1a6619 + 63eb009 commit b0139e5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/controller/direct/apphub/application_controller.go

Lines changed: 7 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/k8s"
30+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/structuredreporting"
3031

3132
gcp "cloud.google.com/go/apphub/apiv1"
3233
apphubpb "cloud.google.com/go/apphub/apiv1/apphubpb"
@@ -200,6 +201,12 @@ func (a *ApplicationAdapter) Update(ctx context.Context, updateOp *directbase.Up
200201
return updateOp.UpdateStatus(ctx, status, condition)
201202
}
202203

204+
report := &structuredreporting.Diff{Object: updateOp.GetUnstructured()}
205+
for path := range paths {
206+
report.AddField(path, nil, nil)
207+
}
208+
structuredreporting.ReportDiff(ctx, report)
209+
203210
updateMask := &fieldmaskpb.FieldMask{
204211
Paths: sets.List(paths),
205212
}

0 commit comments

Comments
 (0)