NAME
kube_crd2class - Generate IO::K8s classes from a CustomResourceDefinition
VERSION
version 1.108
SYNOPSIS
# Print the class source for every served version to STDOUT
kube_crd2class -f crontabs.crd.yaml
# Choose the base package the classes are rendered under
kube_crd2class -f crontabs.crd.yaml -n My::K8s
# Write the .pm files to a directory tree instead of printing
kube_crd2class -f crontabs.crd.yaml -d generated/
DESCRIPTION
kube_crd2class turns a CustomResourceDefinition manifest into typed, documented IO::K8s class source: for every served version of the CRD it prints a .pm per modeled structure - the k8s DSL block plus a POD skeleton - so a cluster's CRDs become checked-in Perl classes without writing them by hand (the kopium / cdk8s import path).
The schema-to-DSL work is IO::K8s's (IO::K8s::CRD, IO::K8s::CRD::Emitter); this tool is the CLI hull. The -f path never talks to a cluster and reads no kubeconfig.
OPTIONS
- -f, --file=PATH
-
Path to a file holding one or more
CustomResourceDefinitionmanifests (YAML, possibly multi-document, or JSON). - -n, --namespace=PACKAGE
-
Base package for the generated classes, without the version segment. Default:
IO::K8s::plus the CamelCased leading DNS label of the CRD group. The served version name is appended per version. - -d, --output_dir=PATH
-
Write each rendered class to PATH/relative/path.pm instead of printing it, logging every written path to STDERR.
- --from_cluster=KIND
-
Generate from a Kubernetes Kind (for example
CronTab) that a live cluster already serves through aCustomResourceDefinition, instead of reading a file: the cluster's CRDs are listed and the one whosespec.names.kindmatches is fed through the same emitter pipeline as--file. Reaching the cluster honours--kubeconfigand--context(see Kubernetes::REST::CLI::Role::Connection). Dies with a clear message if no CRD - or more than one - serves the Kind.
SEE ALSO
Kubernetes::REST, Kubernetes::REST::CLI::Crd2Class, IO::K8s::CRD, IO::K8s::CRD::Emitter, kube_client, kube_watch
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/pplu/kubernetes-rest/issues.
IRC
Join #kubernetes on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHORS
Torsten Raudssus <getty@cpan.org>
Jose Luis Martinez Torres <jlmartin@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2019-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004