Greenfield: Implement direct controller, E2E fixtures, and fuzzer for NetAppHostGroup #13989
🤖 AI Factory started investigating CI check failures for this pull request.
Note: We recommend waiting for the 'ready-for-human' label before leaving review comments. Comments added while the system is actively working may be associated with outdated commits once a new commit is pushed, causing them to be ignored.
An AI coding agent investigated the failed checks on commit 93f3d7b1569882e1f9b2256d471c1843d400f79d:
All failures were due to transient proxy.golang.org network/peer errors (stream error: INTERNAL_ERROR; received from peer) encountered while downloading Go modules during CI.
Running ./dev/ci/presubmits/validate-ensure, ./dev/ci/presubmits/validate-generated-files, and make ensure locally completes cleanly with exit code 0 and produces no repository diffs.
No repository changes were made as the failures were caused by external infrastructure issues.
<!-- factory:task-output kind=Change task=recipe-care-ci-20261014-130409-64d9 -->
🤖 AI Factory started reviewing this pull request in a sandbox.
The change implements the direct controller, KRM round-trip fuzzer, and minimal/maximal test fixtures for NetAppHostGroup. GAPIC REST client usage, LRO waiting, field mask diff calculation, structured diff reporting, status reconciliation, and static reconciler registration conform to Greenfield controller requirements. No defects or omissions were found.
<!-- factory:task-output kind=Review task=recipe-review-20261014-135827-3331 -->
🤖 AI Factory started addressing review feedback for this pull request.
Step 2 Review: NetAppHostGroup (netapp.cnrm.cloud.google.com/v1alpha1) — PASS
Reviewed against the Step 2 Greenfield Direct Controller, E2E Fixtures, and Fuzzer checklist:
1. Client Creation (pkg/controller/direct/netapp/netapphostgroup_controller.go):
- Uses the official GAPIC REST client (cloud.google.com/go/netapp/apiv1, gcp.NewRESTClient) initialized with m.config.RESTClientOptions().
- Normalizes references via common.NormalizeReferences(ctx, reader, obj, nil).
2. Default Reconciler Registration (pkg/controller/resourceconfig/static_config.go):
- Registers NetAppHostGroup under netapp.cnrm.cloud.google.com with DefaultController: k8s.ReconcilerTypeDirect and SupportedControllers: []k8s.ReconcilerType{k8s.ReconcilerTypeDirect}.
3. Proto Diffs & UpdateMask:
- compareHostGroup masks actual fields through NetAppHostGroupSpec_FromProto / NetAppHostGroupSpec_ToProto, aligns Name, and computes top-level field diffs and updateMask using common.DiffForTopLevelFields.
4. Structured Reporting:
- Assigns diffs.Object = updateOp.GetUnstructured() before invoking structuredreporting.ReportDiff(ctx, diffs).
5. KRM Status Updates:
- Invokes a.updateStatus(ctx, ...) at the end of Create and at the end of Update across both the diff and no-op branches, populating status.ObservedState and status.ExternalRef after refetching the latest state via GetHostGroup.
6. LRO Wait:
- Properly awaits op.Wait(ctx) on CreateHostGroup, UpdateHostGroup, and DeleteHostGroup, and gracefully handles direct.IsNotFound(err) in Find and Delete.
7. Test Coverage, Fuzzer & Export Pipeline:
- AdapterForURL() is properly implemented (id.FromExternal(url) + m.client(ctx)).
- Export() sets u.Object = uObj before u.SetName(a.id.HostGroup) and u.SetGroupVersionKind(krm.NetAppHostGroupGVK), and populates obj.Spec.ResourceID, obj.Spec.ProjectRef = &refs.ProjectRef{External: a.id.Project}, and obj.Spec.Location.
- pkg/controller/direct/netapp/netapphostgroup_fuzzer.go registers round-trip fuzzing for all spec fields (.type, .hosts, .os_type, .description, .labels), status fields (.state, .create_time), and f.IdentityField(".name").
- Includes both netapphostgroup-minimal and netapphostgroup-maximal E2E test fixtures (create.yaml, update.yaml, _http.log, _audit_probe.log, _generated_object_*.golden.yaml, _identities.yaml) recorded against real GCP, removing all 7 netapphostgroups entries from tests/apichecks/testdata/exceptions/alpha-missingfields.txt. All 30 CI checks pass.
/lgtm
/approve
/assign @acpana
Approved these changes.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/GoogleCloudPlatform/k8s-config-connector/pull/13989#pullrequestreview-5553717330" title="Approved">acpana</a>, <a href="https://github.com/GoogleCloudPlatform/k8s-config-connector/pull/13989#pullrequestreview-5524136990" title="Approved">seans3</a>
The full list of commands accepted by this bot can be found here.
The pull request process is described here
<details >
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":[]} -->
seans3
hopper-coder-bot
This PR implements the direct reconciler controller, KRM fuzzer, and minimal/maximal end-to-end test fixtures recorded against real GCP for
NetAppHostGroup(netapp.cnrm.cloud.google.com/v1alpha1).Changes
pkg/controller/direct/netapp/netapphostgroup_controller.gosupportingFind,Create,Update,Delete, andExportusing the GAPIC REST client (cloud.google.com/go/netapp/apiv1).NetAppHostGroupinpkg/controller/resourceconfig/static_config.gowithReconcilerTypeDirect.pkg/controller/direct/netapp/netapphostgroup_fuzzer.goregistered withfuzztesting.RegisterKRMFuzzer.pkg/test/resourcefixture/testdata/basic/netapp/v1alpha1/netapphostgroup/exercising all spec fields._http.log,_generated_object_*.golden.yaml,_identities.yaml) and probe logs (_audit_probe.log) recorded against live GCP projectcnrm-barni-4inus-central1usingRECORD_AUDIT_PROBE=1 ./hack/record-gcp.tests/apichecks/testdata/exceptions/alpha-missingfields.txtshowing full field coverage.Validation
dev/ci/presubmits/fuzz-roundtripperspassed.go test ./pkg/crd/template/...passed.go test ./tests/apichecks/...passed.make fmt && make vetpassed.Fixes #13988
``
release-note
``NONE
This pull request was generated by an AI coding agent.
<!-- factory:task-output kind=Change task=recipe-fix-20261014-120420-adf0 -->