Dev api and codegen

From GoogleCloudPlatform/k8s-bridge · View interactive version

Dev api and codegen is an AI agent skill from the GitHub repository GoogleCloudPlatform/k8s-bridge. Adds or modifies Kubernetes Custom Resource Definition (CRD) Go types in api/, Kubebuilder validation markers, RBAC annotations, Kustomize bases, and Helm chart templates, values, and CRD schemas; regenerates manifests, ClusterRoles, and DeepCopy methods via make manifests and make generate; and aud

How to use this skill

Skill file

API, Codegen, Packaging, and Parity Audit Workflow (`dev-api-and-codegen`)

1. Preconditions & Inputs

Before modifying API schemas, RBAC markers, or chart templates, or running a pre-PR parity audit, read references/parity-checklist.md for the source-to-derived parity matrix.


2. Guardrails


3. Step-by-Step Procedure

Step 1: Edit `WorkloadMixing` Go Types or Controller `+kubebuilder:rbac` Markers

  1. CRD Schema & Validation: Edit struct fields and Kubebuilder markers in api/v1alpha1/workloadmixing_types.go (keep paired validation and defaults in internal/controller/slurmjob/translator.go in sync; see references/parity-checklist.md).
  2. Controller RBAC Permissions: If controller permissions changed, update the +kubebuilder:rbac annotations above Reconcile in internal/controller/*/*_controller.go.

Step 2: Run Code and Manifest Generation

Regenerate CRDs, RBAC roles, helm/crds/, and DeepCopy methods:

make manifests generate

Step 3: Synchronize Paired Artifacts & Audit Pre-PR Repository Parity

Walk through every modified row in references/parity-checklist.md and synchronize all derived/paired artifacts.


4. Verification

Verify that version sync, code generation, formatting, static analysis, Kustomize/Helm rendering, and unit/envtest suites succeed with zero uncommitted drift:

make version-sync manifests generate fmt vet lint kustomize
git diff --exit-code
./bin/kustomize build config/default > /dev/null && ./bin/kustomize build config/samples > /dev/null
helm lint ./helm && helm template k8s-bridge ./helm --namespace k8s-bridge-system > /dev/null
make test

5. Handoffs & Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.