Skip to content

Commit a5f1d73

Browse files
authored
Add structured reporting diff to ReCAPTCHAEnterpriseFirewallPolicy (#6716)
### BRIEF Change description Fixes #6608 #### WHY do we need this change? Add structured reporting diff to the controller in `pkg/controller/direct/recaptchaenterprise/firewallpolicy_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 0ceb178 + c8d694b commit a5f1d73

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/controller/direct/recaptchaenterprise/firewallpolicy_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/common"
3232
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/directbase"
3333
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/registry"
34+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/structuredreporting"
3435

3536
gcp "cloud.google.com/go/recaptchaenterprise/v2/apiv1"
3637
pb "cloud.google.com/go/recaptchaenterprise/v2/apiv1/recaptchaenterprisepb"
@@ -187,6 +188,12 @@ func (a *FirewallPolicyAdapter) Update(ctx context.Context, updateOp *directbase
187188
return nil
188189
}
189190

191+
report := &structuredreporting.Diff{Object: updateOp.GetUnstructured()}
192+
for path := range paths {
193+
report.AddField(path, nil, nil)
194+
}
195+
structuredreporting.ReportDiff(ctx, report)
196+
190197
req := &pb.UpdateFirewallPolicyRequest{
191198
FirewallPolicy: desiredPb,
192199
UpdateMask: &fieldmaskpb.FieldMask{Paths: sets.List(paths)},

0 commit comments

Comments
 (0)