Skip to content

Commit 3dca4db

Browse files
authored
Add diff structured reporting to IAPSettings direct controller (#6526)
### BRIEF Change description Added structured diff reporting to the IAPSettings direct controller in Update operations. <!-- Describe what this pull request does. * If your pull request is to address an open issue, indicate it by specifying the issue number: * If your pull request fixes an issue which has not been filed, please file the issue and put the number here. For example: "Fixes #858" --> Fixes # #### WHY do we need this change? To enable structured reporting for updates to IAPSettings resources. This allows KCC to report exactly which fields are being changed during a reconciliation, providing better visibility into the "diff" being applied to the GCP resource. #### Special notes for your reviewer: #### Does this PR add something which needs to be 'release noted'? <!-- If no, just write "NONE" in the release-note block below. If yes, a release note is required: Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". --> ```release-note ``` - [ ] Reviewer reviewed release note. #### Additional documentation e.g., references, usage docs, etc.: <!-- This section can be blank if this pull request does not require any additional documentation. When adding links which point to resources within git repositories, like usage documentation, please reference a specific commit and avoid linking directly to the master branch. This ensures that links reference a specific point in time, rather than a document that may change over time. See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files Please use the following format for linking documentation: - [Usage]: <link> - [Other doc]: <link> --> ```docs ``` #### Intended Milestone Please indicate the intended milestone. - [ ] Reviewer tagged PR with the actual milestone. ### Tests you have done <!-- Make sure you have run "make ready-pr" to run required tests and ensure this PR is ready to review. Also if possible, share a bit more on the tests you have done. For example if you have updated the pubsubtopic sample, you can share the test logs from running the test case locally. go test -v -tags=integration ./config/tests/samples/create -test.run TestAll -run-tests pubsubtopic --> - [ ] Run `make ready-pr` to ensure this PR is ready for review. - [ ] Perform necessary E2E testing for changed resources.
2 parents 318d066 + 56cdc85 commit 3dca4db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/controller/direct/iap/iapsettings_controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"
2727
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/directbase"
2828
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/registry"
29+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/structuredreporting"
2930
"google.golang.org/api/option"
3031
"google.golang.org/protobuf/types/known/fieldmaskpb"
3132

@@ -145,7 +146,11 @@ func (a *IAPSettingsAdapter) Update(ctx context.Context, updateOp *directbase.Up
145146
}
146147

147148
desiredPb.Name = a.id.String() // explicitly set Name field for the underlying GCP API
148-
149+
report := &structuredreporting.Diff{Object: updateOp.GetUnstructured()}
150+
for _, path := range paths {
151+
report.AddField(path, nil, nil)
152+
}
153+
structuredreporting.ReportDiff(ctx, report)
149154
req := &pb.UpdateIapSettingsRequest{
150155
IapSettings: desiredPb,
151156
UpdateMask: &fieldmaskpb.FieldMask{Paths: paths},

0 commit comments

Comments
 (0)