Skip to content

Commit 14f04e3

Browse files
authored
Add structured reporting diff to ComputeTargetTCPProxy (#6755)
### BRIEF Change description Fixes #6559 #### WHY do we need this change? Add structured reporting diff to the controller in `pkg/controller/direct/compute/targettcpproxy_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 3c7e2fe + ff977d6 commit 14f04e3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/controller/direct/compute/targettcpproxy_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"
3030
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/directbase"
3131
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/registry"
32+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/structuredreporting"
3233
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3334
"k8s.io/apimachinery/pkg/runtime"
3435
"k8s.io/klog/v2"
@@ -241,6 +242,12 @@ func (a *targetTCPProxyAdapter) Update(ctx context.Context, updateOp *directbase
241242
// Even though there is no update, we still want to update KRM status
242243
updated = a.actual
243244
} else {
245+
report := &structuredreporting.Diff{Object: updateOp.GetUnstructured()}
246+
for path := range paths {
247+
report.AddField(path, nil, nil)
248+
}
249+
structuredreporting.ReportDiff(ctx, report)
250+
244251
// Changes on resource spec are detected
245252
if parent.Location != "global" {
246253
// Regional ComputeTargetTCPProxy API does not support Update

0 commit comments

Comments
 (0)