Code Generation

This page covers code generation and manifest workflows for kubernetes-nmstate.

Code Generation

# Generate CRDs from api/ types
make gen-crds

# Generate Kubernetes client code
make gen-k8s

# Generate RBAC manifests
make gen-rbac

# Run all generators
make generate

# Verify generated code is up to date
make check-gen

Important: Always run make generate after modifying types in api/v1 or api/v1beta1, or after changing controller RBAC markers.

Tip: When using Claude Code, you can run /review-api-changes to automatically review your API changes for compatibility and best practices.

Manifests and Deployment

Note: This section covers the Operator Lifecycle Manager (OLM) framework for operator distribution.

# Generate deployment manifests
make manifests

# Generate OLM bundle
make bundle

# Verify bundle is valid
make check-bundle

Manifests are generated in build/_output/manifests/ by rendering the Helm chart in charts/kubernetes-nmstate/; the rendered operator manifests live under build/_output/manifests/kubernetes-nmstate/templates/. The chart templates get populated with correct image references during cluster-sync, while make manifests remains available for manifest-based deployment flows.

Vendoring

# Update vendor directory
make vendor

This tidies both the main module and the api/ module, then vendors dependencies. Go modules are used with GOFLAGS=-mod=vendor and GOPROXY=direct.

Next Steps

For advanced topics, see: Advanced Topics