Add cmd for importing Kubernetes API schemas #194
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ℹ️ This command was renamed to
timoni mod vendor k8s
in #197This PR adds a new command for simplifying the import and generation of CUE schemas for Kubernetes APIs.
The
timoni mod import k8s
along withtimoni mod import crd
improve the UX of developing and maintaining app modules.Motivation
Currently module authors have to install Go, create a dummy Go module, run
go get
for all the Kubernetes API Go packages for a specific Kubernetes version, then runcue get go
for each API group to generate CUE schemas out of the Go types. Keeping this schemas up to date with the Kubernetes releases is a tedious process, since the Go types depend on each other e.g.k8s.io/api/apps/v1@0.28.2
depends onk8s.io/api/core/v1
which depends various packages underk8s.io/apimachinery
.Solution
Timoni offers a simple command for importing and updating all the Kubernetes builtin APIs for a specific minor version.
The
timoni mod import k8s
command pulls the CUE schemas from GitHub Container Registry. These schemas are generated after each Kubernetes minor release in the kubernetes-cue-schema repository and published as OCI artifacts at ghcr.io/stefanprodan/timoni/kubernetes-schema.For each Kubernetes minor version, a dedicated set of CUE schemas are generated for the following Kubernetes GA APIs:
k8s.io/api/admission/v1
k8s.io/api/admissionregistration/v1
k8s.io/api/apps/v1
k8s.io/api/authentication/v1
k8s.io/api/authorization/v1
k8s.io/api/autoscaling/v2
k8s.io/api/autoscaling/v1
k8s.io/api/batch/v1
k8s.io/api/certificates/v1
k8s.io/api/coordination/v1
k8s.io/api/core/v1
k8s.io/api/discovery/v1
k8s.io/api/events/v1
k8s.io/api/networking/v1
k8s.io/api/node/v1
k8s.io/api/policy/v1
k8s.io/api/rbac/v1
k8s.io/api/scheduling/v1
k8s.io/api/storage/v1