kcc-direct-base-types-implementer

Enforces baseline standards for KCC direct resource type definitions in Go.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When developing new direct resources for Google Cloud Config Connector, generated _types.go files often miss mandatory conventions such as CRD labels, reference field patterns, and proto annotations, leading to failed API checks and inconsistent CRDs. This Skill defines the shared baseline standards that every new KRM type must satisfy, for both greenfield and brownfield resources.

Core Features & Use Cases

  • Type Definition Standards: Enforces copyright headers, kubebuilder CRD labels, observedGeneration typing, acronym capitalization, and correct placement of service-generated fields under status.observedState.
  • Reference Field Implementation: Guides creation of <kind>_reference.go and <kind>_identity.go files for external-only references, including Ref interface methods and identity parsing with gcpurls templates.
  • Proto Annotation Mapping: Specifies the +kcc:spec:proto, +kcc:observedstate:proto, and +kcc:proto annotations required for automatic mapper generation.
  • Use Case: After running the type generator for a new GCP service like Network Security, use this Skill to verify the generated _types.go, move manual structs out of types.generated.go, and add an external-only reference for a dependent resource.

Quick Start

Review the generated _types.go file for my new Config Connector direct resource and fix it to comply with the KCC baseline standards.

Frequently Asked Questions about kcc-direct-base-types-implementer

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

FAQPage Schema
How do I implement a reference field for a Config Connector direct resource?

Define a `<Kind>Ref` struct implementing `refsv1beta1.Ref` in its own `<kind>_reference.go` file under `apis/<service>/v1alpha1`, never inside `_types.go`. If the target resource lacks full KCC support, implement it as an external-only reference with a matching `<kind>_identity.go` for parsing the external format.

What labels are required on KCC direct resource types?

Every direct resource type must include the kubebuilder metadata labels `cnrm.cloud.google.com/managed-by-kcc=true` and `cnrm.cloud.google.com/system=true`. A stability-level label is also appended depending on whether the resource is greenfield or brownfield.

Where should service-generated fields like etag go in KCC types?

Service-generated values such as `etag` must not appear under `spec`. They belong under `status`, specifically within `observedState`, since they are outputs of the GCP service rather than user-specified configuration.

Why does my KCC resource fail the missingrefs API check?

The check fails when fields referencing other GCP resources are plain strings instead of proper KCC reference types ending in `Ref`. You must implement proper references such as `ProjectRef` or `PubSubTopicRef` rather than adding exceptions to `missingrefs.txt`.

How do I handle recursive or deeply nested types in KCC CRDs?

Comment out recursive fields or represent them as simple custom types when they trigger OpenAPI validation errors or conversion panics. Avoid `x-kubernetes-preserve-unknown-fields` except for raw dynamic JSON payloads where data loss would otherwise occur.

What proto annotations are needed for KCC mapper generation?

Annotate the Spec struct with `+kcc:spec:proto`, the ObservedState struct with `+kcc:observedstate:proto`, and nested helper structs with `+kcc:proto` pointing to the corresponding GCP proto types. These annotations enable automatic mapper generation.