api

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2026 License: MPL-2.0

README

devsy-org/api

API type definitions and generated clients for the Devsy platform.

Code Generation

All generated code (zz_generated.*, pkg/clientset/, pkg/listers/, pkg/informers/, pkg/openapi/) is produced by hack/generate.go.

Prerequisites
  • Go 1.25+
  • Task (go install github.com/go-task/task/v3/cmd/task@latest)
Run all generators
task generate
Run individual generators
task generate:register    # API registration (zz_generated.api.register.go)
task generate:deepcopy    # DeepCopy methods
task generate:defaults    # Defaulter functions
task generate:conversion  # Conversion functions
task generate:openapi     # OpenAPI definitions
task generate:clients     # Clientset, listers, informers
Install tools only
task generate:install
Verify generation is up to date
task verify

Generator Architecture

hack/generate.go is a Go program that orchestrates two categories of generators:

  1. API Register Generator — Uses github.com/devsy-org/apiserver/pkg/generate to scan all +resource-annotated types under pkg/apis/... and produces zz_generated.api.register.go files containing internal (hub) types, scheme registration, storage wiring, and registry interfaces. Includes a GroupConverter hook that deduplicates import aliases when multiple modules expose packages with the same trailing path segments.

  2. k8s.io/code-generator tools — Standard Kubernetes code generators invoked as subprocesses:

    • deepcopy-genDeepCopyInto / DeepCopyObject methods
    • defaulter-genSetDefaults_* functions
    • conversion-genConvert_* functions between versioned and internal types
    • client-gen — Typed clientset
    • lister-gen — Listers for informer caches
    • informer-gen — SharedInformerFactory and informers
    • openapi-gen — OpenAPI v2 schema definitions (from k8s.io/kube-openapi)
Import Alias Fix

The upstream register generator builds import aliases by joining the last two path segments of a Go package (e.g. storage + v1storagev1). When two different modules expose a package with identical trailing segments — such as github.com/devsy-org/agentapi/.../storage/v1 and github.com/devsy-org/api/.../storage/v1 — it produces duplicate aliases.

hack/generate.go fixes this via a GroupConverter callback that runs after type parsing. It detects duplicate aliases and rewrites the secondary one to include a distinguishing prefix (e.g. agentstoragev1), matching the convention already used in hand-written source files.

Directories

Path Synopsis
hack/generate.go orchestrates all code generation for the devsy-org/api module.
hack/generate.go orchestrates all code generation for the devsy-org/api module.
pkg
apis
+domain=devsy.sh
+domain=devsy.sh
apis/audit
+k8s:openapi-gen=true +groupName=audit.devsy.sh
+k8s:openapi-gen=true +groupName=audit.devsy.sh
apis/audit/v1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package +k8s:defaulter-gen=TypeMeta +groupName=audit.devsy.sh
+k8s:openapi-gen=true +k8s:deepcopy-gen=package +k8s:defaulter-gen=TypeMeta +groupName=audit.devsy.sh
apis/management
Package api is the internal version of the API.
Package api is the internal version of the API.
apis/management/install
Package api is the internal version of the API.
Package api is the internal version of the API.
apis/management/v1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/devsy-org/api/pkg/apis/management +k8s:defaulter-gen=TypeMeta +groupName=management.devsy.sh
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/devsy-org/api/pkg/apis/management +k8s:defaulter-gen=TypeMeta +groupName=management.devsy.sh
apis/storage
+k8s:openapi-gen=true +groupName=storage.devsy.sh
+k8s:openapi-gen=true +groupName=storage.devsy.sh
apis/storage/v1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package +k8s:defaulter-gen=TypeMeta +groupName=storage.devsy.sh
+k8s:openapi-gen=true +k8s:deepcopy-gen=package +k8s:defaulter-gen=TypeMeta +groupName=storage.devsy.sh
apis/ui
Package api is the internal version of the API.
Package api is the internal version of the API.
apis/ui/v1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=ui.devsy.sh
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=ui.devsy.sh
apis/virtualcluster
Package api is the internal version of the API.
Package api is the internal version of the API.
apis/virtualcluster/install
Package api is the internal version of the API.
Package api is the internal version of the API.
apis/virtualcluster/v1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/devsy-org/api/pkg/apis/virtualcluster +k8s:defaulter-gen=TypeMeta +groupName=virtualcluster.devsy.sh
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/devsy-org/api/pkg/apis/virtualcluster +k8s:defaulter-gen=TypeMeta +groupName=virtualcluster.devsy.sh
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/management/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/management/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
clientset/versioned/typed/storage/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/storage/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
clientset/versioned/typed/virtualcluster/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/virtualcluster/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
managerfactory
Package managerfactory re-exports the interfaces from apiserver/pkg/managerfactory.
Package managerfactory re-exports the interfaces from apiserver/pkg/managerfactory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL