Skip to content

Commit 86173a0

Browse files
authored
Add structured reporting diff to SecretManagerSecret (#6715)
### BRIEF Change description Fixes #6610 #### WHY do we need this change? Add structured reporting diff to the controller in `pkg/controller/direct/secretmanager/secret_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 a5f1d73 + 47771f1 commit 86173a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/controller/direct/secretmanager/secret_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/directbase"
3333
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/registry"
3434
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/label"
35+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/structuredreporting"
3536
"google.golang.org/api/option"
3637
"google.golang.org/protobuf/types/known/fieldmaskpb"
3738
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -291,6 +292,12 @@ func (a *Adapter) Update(ctx context.Context, op *directbase.UpdateOperation) er
291292
return nil
292293
}
293294

295+
report := &structuredreporting.Diff{Object: op.GetUnstructured()}
296+
for path := range paths {
297+
report.AddField(path, nil, nil)
298+
}
299+
structuredreporting.ReportDiff(ctx, report)
300+
294301
req := &secretmanagerpb.UpdateSecretRequest{
295302
UpdateMask: &fieldmaskpb.FieldMask{Paths: sets.List(paths)},
296303
Secret: resource,

0 commit comments

Comments
 (0)