kcc-direct-controller-logic-brownfield

Implements Adapter reconciliation logic and E2E fixtures for direct controllers migrating from legacy.

1.1k|377|Updated Apr 8, 2019
One-click install
npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill kcc-direct-controller-logic-brownfield
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kcc-direct-controller-logic-brownfield
Source: https://github.com/GoogleCloudPlatform/k8s-config-connector/tree/main/.gemini/skills/kcc-direct-controller-logic-brownfield
Command: npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill kcc-direct-controller-logic-brownfield

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrating a Config Connector resource from a legacy Terraform or DCL-based reconciler to the direct controller architecture requires implementing the Adapter interface (Find, Create, Update, Delete) and verifying behavioral parity against golden fixtures, which is error-prone without a guided workflow.

Core Features & Use Cases

  • Adapter Implementation Guidance: Walks through implementing Find, Create, Update, and Delete in the direct controller file with correct error handling such as 404 handling in Find.
  • Ratcheting Exclusion Removal: Ensures the resource is removed from the re-reconciliation exclusion list in tests/e2e/ratcheting.go so re-reconciliation tests run.
  • MockGCP Verification Loop: Runs hack/compare-mock to generate golden files and HTTP logs, then iteratively fixes discrepancies between legacy and direct reconciler behavior.
  • Use Case: When migrating ComputeFirewallPolicy to a direct controller, use this Skill to implement the Adapter, record real GCP logs, and align golden fixtures until MockGCP tests pass.

Quick Start

Implement the direct controller Adapter for the ComputeDisk resource in the compute service and verify it against MockGCP fixtures.

Frequently Asked Questions about kcc-direct-controller-logic-brownfield

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a direct controller Adapter in Config Connector?

Implement the Find, Create, Update, and Delete methods in pkg/controller/direct/<service>/<resource>_controller.go, using generated and manual mappers. Handle errors correctly, such as returning not-found for 404 responses in Find.

How do I verify a direct controller against MockGCP fixtures?

Run hack/compare-mock with the fixture test name pattern to execute tests against MockGCP and regenerate golden files and _http.log. Fix discrepancies in the Adapter and rerun until tests pass.

When must I re-record real GCP logs for KCC E2E tests?

Whenever a test case configuration, manifest file like create.yaml or update.yaml, or controller runtime mapping changes, you must re-record against real GCP using hack/record-gcp or E2E_GCP_TARGET=real. Never manually edit the recorded logs.

Why does the re-reconciliation test not run for my resource?

The resource is likely still in the ratcheting exclusion list in tests/e2e/ratcheting.go. Remove its case block from the switch in ShouldTestRereconiliation so the re-reconciliation test step executes.

What are common pitfalls when migrating legacy KCC controllers to direct?

Common issues include incorrect field mapping in Find, wrong Patch versus Put calls from faulty diff logic in Update, and non-idempotent Delete handling. Journals also note empty LRO responses and server-generated resource IDs requiring refetch after create.