NAME

Kubernetes::Comb::CRD::Comb - The Comb custom resource

VERSION

version 0.001

SYNOPSIS

use Kubernetes::Comb::CRD::Comb;

my $cr = Kubernetes::Comb::CRD::Comb->new(
  metadata => { name => 'nats', namespace => 'platform' },
  spec     => { class => 'MyApp::Comb::NATS', dependsOn => [ 'db' ] }
);
print $cr->to_yaml;

# the CustomResourceDefinition, as an IO::K8s object
my $crd = Kubernetes::Comb::CRD::Comb->to_crd;
$rest->ensure_crd('Kubernetes::Comb::CRD::Comb');   # Kubernetes::REST

# another API group: a three-line subclass, passed as crd_class
package MyApp::CRD::Comb;
use Moo; extends 'Kubernetes::Comb::CRD::Comb';
sub api_version { 'comb.example.com/v1' }

DESCRIPTION

The Comb custom resource: default group comb.internal/v1 (.internal is reserved for private use and never collides with a real domain), kind Comb, plural combs, namespaced, with the status subresource. Whoever manages Combs watches these and builds a live Comb instance from each; the instance writes its own status back.

IO::K8s fixes api_version when the class is loaded, so another API group is a subclass, not a runtime switch: the subclass overrides api_version, and everything else -- kind and resource_plural, the schema, "to_crd" -- follows it. Keep Comb as the last segment of the subclass's package name: IO::K8s derives kind from it. Pass the subclass wherever a crd_class is taken, for example to Kubernetes::Comb::CRD and to the Comb itself.

spec

Kubernetes::Comb::CRD::CombSpec; a hashref is inflated.

status

Kubernetes::Comb::CRD::CombStatus; a hashref is inflated. Written through the status subresource only.

to_crd

my $crd = Kubernetes::Comb::CRD::Comb->to_crd;
my $crd = Kubernetes::Comb::CRD::Comb->to_crd(
  group  => 'comb.example.com',
  kind   => 'Comb',
  plural => 'combs'
);

Returns the CustomResourceDefinition as an IO::K8s object, with the openAPIV3Schema generated from these classes and the status subresource enabled. group, kind and plural default to what the class says; each may be overridden. An overridden value only describes the definition -- a CR class that talks to that group, kind or plural is still a subclass (see "DESCRIPTION"), so pass the overrides only to publish a definition for such a subclass without loading it. Croaks on unknown arguments and on an empty value.

This extends "to_crd" in IO::K8s::Role::APIObject, so "ensure_crd" in Kubernetes::REST installs the same definition, status subresource included.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-kubernetes-comb/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.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.