Greenfield: Implement direct controller for DataLabelingAnnotationSpecSet - #12439
Greenfield: Implement direct controller for DataLabelingAnnotationSpecSet#12439hopper-coder-bot wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
🤖 AI Factory started reviewing this pull request in a sandbox. |
reviewbot-robot
left a comment
There was a problem hiding this comment.
KCC Auto-Review Results
- Trigger criteria matched: Yes
- Proto Diffs & Update Mask: Fail - Custom manual field comparison is used instead of the standard
common.CompareProtoMessage. - Structured Reporting: Fail -
structuredreporting.ReportDiffis not called when differences are detected on the immutable resource. - KRM Status Updates: Pass
- LRO Wait: Pass - Not applicable (operations on the service are synchronous).
- Test Coverage: Pass - Minimal and maximal test cases are present. Real GCP recording is correctly skipped due to the global retirement of the Google Cloud Data Labeling service.
Detailed Findings / Actions Required:
- In
pkg/controller/direct/datalabeling/datalabelingannotationspecset/datalabelingannotationspecset_controller.go: Align theUpdatemethod to calculate differences usingcommon.CompareProtoMessageand surface the changes back to the user viastructuredreporting.ReportDiffbefore returning an immutability error.
| return a.updateStatus(ctx, createOp, createdAnnotationSpecSet) | ||
| } | ||
|
|
||
| func (a *Adapter) Update(ctx context.Context, updateOp *directbase.UpdateOperation) error { |
There was a problem hiding this comment.
Please use the standard common.CompareProtoMessage to calculate differences between a.desired and a.actual rather than a manual, field-by-field comparison. Furthermore, when differences are found, call structuredreporting.ReportDiff before returning an error.
This aligns the controller with modern direct controllers and ensures that any immutability errors or field modifications are properly surfaced to the user via their Kubernetes resource status condition.
For example, update the method as follows:
func (a *Adapter) Update(ctx context.Context, updateOp *directbase.UpdateOperation) error {
log := klog.FromContext(ctx)
log.V(2).Info("updating/diffing DataLabelingAnnotationSpecSet", "name", a.id.String())
paths, err := common.CompareProtoMessage(a.desired, a.actual, common.BasicDiff)
if err != nil {
return err
}
if len(paths) > 0 {
report := &structuredreporting.Diff{Object: updateOp.GetUnstructured()}
for path := range paths {
report.AddField(path, nil, nil)
}
structuredreporting.ReportDiff(ctx, report)
return fmt.Errorf("DataLabelingAnnotationSpecSet is immutable and cannot be updated")
}
return a.updateStatus(ctx, updateOp, a.actual)
}Make sure to import github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/common and github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/structuredreporting.
|
🤖 AI Factory started addressing review feedback for this pull request. |
…cSet Add direct controller, fuzzer, and minimal/maximal fixtures for DataLabelingAnnotationSpecSet. Issue: 11478
7dc43fc to
e003a99
Compare
|
Hi! I have addressed the review feedback by updating the (This comment was generated by overseer) |
|
🤖 AI Factory started addressing review feedback for this pull request. |
|
Hi! I have verified that the |
|
🤖 AI Factory started investigating CI check failures for this pull request. |
Investigating
|
|
🤖 AI Factory started reviewing this pull request in a sandbox. |
reviewbot-robot
left a comment
There was a problem hiding this comment.
KCC Auto-Review Results
- Trigger criteria matched: Yes
- Proto Diffs & Update Mask: Pass (The resource is immutable; diff calculation correctly blocks updates and returns an error without requiring an update mask/patch API).
- Structured Reporting: Pass (ReportDiff is correctly called before throwing the immutability error).
- KRM Status Updates: Pass (Status updates are performed on both Create and no-op Update).
- LRO Wait: Pass (CreateAnnotationSpecSet is a synchronous operation, so no LRO wait is required).
- Test Coverage: Pass (Minimal and maximal test cases are provided, and exception list is updated).
Detailed Findings / Actions Required:
No action required. The implementation is clean, robust, and correctly aligned with the existing codebase conventions and the fallback approach for discontinued GCP Data Labeling services.
|
🤖 AI Factory started addressing review feedback for this pull request. |
|
Hi! Thanks for the review! The latest implementation of
The latest review from (This comment was generated by overseer) |
This PR implements the direct controller for the
DataLabelingAnnotationSpecSetresource underpkg/controller/direct/datalabeling/datalabelingannotationspecset.Design Decisions & Implementation Highlights
Find,Create,Update,Delete) using modern patterns under isolated packagepkg/controller/direct/datalabeling/datalabelingannotationspecset.DataLabelingAnnotationSpecSetby verifying if any mutable spec fields changed and returning an appropriate error.GCP Recording PR Reporting
./hack/record-gcpcommand on the minimal and maximal test fixtures using projectcnrm-barni-4.rpc error: code = Unavailable desc = 502:Bad Gatewayrepeatedly.datalabeling.googleapis.com) was fully discontinued and shut down globally by Google as of July 1, 2024, and retired in August 2026. Because of this deprecation and service shutdown, real GCP API endpoints are permanently unavailable, returning 502 Bad Gateway error on all requests.As a fallback, no golden logs (
_http.log) or Kubernetes golden object files were checked in, following the existing pattern of the related discontinued service resourceDataLabelingInstruction.Fixes #11478
This PR was generated by the overseer,overseer,priority/medium,area/direct,greenfield,step/controller,chore/ai agent (powered by the gemini-3.5-flash model).