← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for NetAppHostGroup #13989

Merged
hopper-coder-bot merged 16 files (1171 lines) on Oct 16, 2026 21:22 UTC
View on GitHub
hopper-coder-bot hopper-coder-bot commented on Oct 14, 2026 12:51 UTC
Author

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


  • Direct Controller: Implemented pkg/controller/direct/netapp/netapphostgroup_controller.go supporting Find, Create, Update, Delete, and Export using the GAPIC REST client (cloud.google.com/go/netapp/apiv1).

  • Reconciler Registration: Registered NetAppHostGroup in pkg/controller/resourceconfig/static_config.go with ReconcilerTypeDirect.

  • Fuzzer: Implemented round-trip KRM fuzzer in pkg/controller/direct/netapp/netapphostgroup_fuzzer.go registered with fuzztesting.RegisterKRMFuzzer.

  • E2E Test Fixtures: Created minimal and maximal fixtures under pkg/test/resourcefixture/testdata/basic/netapp/v1alpha1/netapphostgroup/ exercising all spec fields.

  • Real GCP Recording: Golden files (_http.log, _generated_object_*.golden.yaml, _identities.yaml) and probe logs (_audit_probe.log) recorded against live GCP project cnrm-barni-4 in us-central1 using RECORD_AUDIT_PROBE=1 ./hack/record-gcp.

  • API Checks: Regenerated tests/apichecks/testdata/exceptions/alpha-missingfields.txt showing full field coverage.
  • Validation


  • dev/ci/presubmits/fuzz-roundtrippers passed.

  • go test ./pkg/crd/template/... passed.

  • go test ./tests/apichecks/... passed.

  • make fmt && make vet passed.
  • 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 -->

    Diff: 1171 lines (+1164 / -7) across 16 files Reviewer: seans3 Review duration: 3390m
    All Vouch review confidence checks passed
    Residual risk 0.13 = Change Risk (0.72) × (1 − Review Confidence (0.82)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 1171 lines diff across 16 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.72 · 5 substantive comment(s)
    0.72
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    82%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    9 items
    argus-watcher-bot argus-watcher-bot commented on Oct 14, 2026 13:04 UTC
    Bot

    🤖 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.

    hopper-coder-bot hopper-coder-bot commented on Oct 14, 2026 13:25 UTC
    Author

    An AI coding agent investigated the failed checks on commit 93f3d7b1569882e1f9b2256d471c1843d400f79d:

  • Presubmit (build-images)

  • ci-presubmit (validate-ensure, validate-generated-files)
  • 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 -->

    argus-watcher-bot argus-watcher-bot commented on Oct 14, 2026 13:57 UTC
    Bot

    🤖 AI Factory started reviewing this pull request in a sandbox.

    reviewbot-robot reviewbot-robot commented on Oct 14, 2026 14:11 UTC
    Reviewer

    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 -->

    argus-watcher-bot argus-watcher-bot commented on Oct 14, 2026 14:19 UTC
    Bot

    🤖 AI Factory started addressing review feedback for this pull request.

    seans3 seans3 approved these changes on Oct 14, 2026 20:20 UTC
    Approved Reviewer

    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

    acpana acpana approved these changes on Oct 16, 2026 21:08 UTC
    Approved Reviewer

    Approved these changes.

    google-oss-prow[bot] google-oss-prow[bot] commented on Oct 16, 2026 21:08 UTC
    Bot

    [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:

  • ~~OWNERS~~ [acpana]
  • 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":[]} -->

    Reviewers
    Assignees
    hopper-coder-bot hopper-coder-bot
    Labels
    risk: low confidence: 82.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 71.5% (HIGH) · Higher = larger blast radius
    71.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 82.2% · Lower = rushed or shallow review
    82.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 12.7% · Safe to merge
    12.7%