Skip to content

Commit d1a6619

Browse files
authored
Add structured reporting diff to APIGatewayAPI (#6781)
### BRIEF Change description Fixes #6530 #### WHY do we need this change? Add structured reporting diff to the controller in `pkg/controller/direct/apigateway/api_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 968fef1 + 320c0d9 commit d1a6619

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/controller/direct/apigateway/api_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/directbase"
4040
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/registry"
4141
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/label"
42+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/structuredreporting"
4243
)
4344

4445
func init() {
@@ -185,6 +186,12 @@ func (a *apiAdapter) Update(ctx context.Context, updateOp *directbase.UpdateOper
185186
log.V(2).Info("no field needs update", "name", a.id)
186187
updated = a.actual
187188
} else {
189+
report := &structuredreporting.Diff{Object: updateOp.GetUnstructured()}
190+
for _, path := range paths {
191+
report.AddField(path, nil, nil)
192+
}
193+
structuredreporting.ReportDiff(ctx, report)
194+
188195
resource.Name = a.id.String() // we need to set the name so that GCP API can identify the resource
189196
req := &pb.UpdateApiRequest{
190197
Api: resource,

0 commit comments

Comments
 (0)