Add Missing Field

Add a missing GCP field to KCC direct controller Go types, fuzzer registrations, and proto-KRM mappers.

1.1k|367|Updated Apr 8, 2019
One-click install
npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill add-missing-field
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Add Missing Field
Source: https://github.com/GoogleCloudPlatform/k8s-config-connector/tree/main/.gemini/skills/add-missing-field
Command: npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill add-missing-field

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

KCC direct controller development often discovers that a GCP API field is missing from the generated Go types, fuzzer expectations, or proto-to-KRM mappings, which prevents reconciliation and breaks golden/mock-based tests.

Core Features & Use Cases

  • Extend KCC types for Spec and ObservedState: Add the missing field to the appropriate struct in the resource’s _types.go with correct naming and KCC reference usage for URI/URI fragments.
  • Align the fuzzer with the new field: Remove the field from unimplemented lists and register it as an expected spec or status field so apichecks and generation logic reflect reality.
  • Update mappers for correct round-tripping: Ensure _FromProto and _ToProto mappings are updated symmetrically (including manual parent mappers when generators skip nested types).
  • Regenerate outputs and tests: Run generators, update golden compare output, and create/adjust resource fixture testdata to cover the new field.
  • Patch mockgcp if needed: Provide reasonable mock behavior for the new output/observed field so unit/golden tests validate it.

Quick Start

Tell the agent which KCC API group and resource kind you are working on and the exact missing field name from the issue or fuzzer output, and ask it to add the field end-to-end (types, fuzzer, mappers, generation, tests, and golden mocks).

Frequently Asked Questions about Add Missing Field

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

FAQPage Schema
How do I add a missing GCP field to a KCC direct controller?

To add a missing GCP field to a KCC direct controller, you update Go types, register fuzzer expectations, and modify proto-to-KRM mappers. This ensures the new attribute successfully round-trips through reconciliation and passes apichecks.

Why does my KCC fuzzer fail when a GCP API field is missing?

KCC fuzzer tests fail when a GCP API field is missing because the proto-to-KRM mappings and expected spec fields are misaligned. You must remove the field from unimplemented lists and update mappers to make apichecks and generation logic reflect reality.

What is the process for updating KCC proto mappings to support a new field?

Updating KCC proto mappings requires symmetric updates to both _FromProto and _ToProto functions, including manual parent mappers for nested types. This correct round-tripping allows the controller to properly reconcile the newly added attribute.

How do I regenerate golden tests after adding a field to a Config Connector resource?

To regenerate golden tests after adding a field to a Config Connector resource, you run the generators, update golden compare output, and use WRITE_GOLDEN_OUTPUT. You also need to adjust resource fixture testdata and patch mockgcp stubs for observed outputs.

Do I need to update Spec and ObservedState structs separately for KCC direct controllers?

You must update both Spec and ObservedState structs symmetrically when adding a missing field to KCC direct controllers. This involves modifying the appropriate _types.go file with correct naming and KCC reference usage for URI fragments to ensure proper reconciliation.

When should I manually patch mockgcp when adding a missing field to KCC?

You should patch mockgcp when adding a missing field to KCC if the new attribute includes observed outputs. Providing reasonable mock behavior for the new output field ensures your unit and golden tests validate the updated reconciliation logic correctly.