一键导入
kcc-direct-controller-logic-brownfield
Implement the core reconciliation logic (Adapter) and E2E fixtures for a direct controller migrating from legacy
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implement the core reconciliation logic (Adapter) and E2E fixtures for a direct controller migrating from legacy
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Automate the initial scaffolding of a KCC "direct" resource, including CRD types and generation scripts. Use this when starting a new "direct" implementation for a GCP resource.
Creates or updates the _identity.go and _reference.go files for a Config Connector resource, ensuring they follow the canonical gcpurls.Template pattern. Use this when you need to make sure the identity and reference is up to date for a KCC resource or when implementing IdentityV2 and refs.Ref for a resource.
Standards and workflows for creating direct KRM Go types for an existing CRD while maintaining strict schema compatibility.
Comprehensive review guide and criteria for PRs adding or modifying features in legacy resources (TF patches, DCL patches, CRD changes, MockGCP alignment, and Direct Controller alignment).
Implement the controller, mappers, and fuzzer for a direct KCC resource, ensuring package isolation and CI compliance. Use this when implementing the main reconciliation logic for a "direct" resource.
Guides modifying, patching, and updating resources and fields managed by the Terraform/legacy controller, including patching the local/vendored Terraform Google Beta provider.
| name | kcc-direct-controller-logic-brownfield |
| description | Implement the core reconciliation logic (Adapter) and E2E fixtures for a direct controller migrating from legacy |
This skill guides the implementation of the Adapter interface
resource_kind: The KCC Kind.service_name: The GCP service name (short, e.g., apigee).api_version: The KCC API version.Implement Adapter Logic:
Update pkg/controller/direct/<service>/<resource_lower>_controller.go.
Find, Create, Update, and Delete.Find).Verify and Record against MockGCP / Fix Discrepancies: Run the fixtures tests against mock GCP to check behavior, update golden files, and verify correctness.
When the direct controller becomes available for a resource, the test framework automatically injects the 'direct' annotation into the test YAML and generates golden logs using the direct controller. If both the legacy and direct controllers are available, the framework also records the legacy controller logs (_http_old_controller.log, _final_object_old_controller.golden.yaml, and _exported_old_controller.golden.yaml) along with the diff files between the two controllers (_final_object.diff and _http.diff).
Step 2.a: Run compare-mock
Run the test using hack/compare-mock:
hack/compare-mock "fixtures/^<testname>$"
This command will execute the tests against MockGCP and automatically generate/update the golden files (such as _generated_object_<testname>-direct.golden.yaml) and _http.log under the test case directory.
Step 2.b: Fix discrepancies in the Adapter
If there are any errors or discrepancies between the legacy reconciler and the direct reconciler behavior (indicated by the test failing or having incorrect updates in _http.log or golden objects), iteratively update your direct controller.
Focus on the Adapter implementation:
Find: Check if fields are correctly read, populated, and mapped from the GCP SDK response.Create / Update: Ensure fields are correctly mapped to the GCP SDK request and correct APIs are called. Pay attention to differences in Patch/Put calls due to incorrect diffing logic in the Update method.Delete: Check that deletion logic works and returns correct status/error code.If a fix is needed in any place other than the Adapter in the controller code, please carefully asses it and make a well scoped change.
Run the compare-mock command again after making updates to verify if the changes resolve the issues. Repeat until the tests pass and the updated golden files and HTTP logs accurately match expectations.
Append any reconciliation alignment issues to .gemini/journals/<service>.md using the format described in the kcc-agentic-journaler skill.