| 1 | package Kubernetes::Comb::CRD; | ||||||||||
| 2 | # ABSTRACT: IO::K8s resource map provider for the Comb custom resource | ||||||||||
| 3 | 27 | our $VERSION = '0.001'; | |||||||||
| 4 | |||||||||||
| 5 | 27 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 27 | with 'IO::K8s::Role::ResourceMap'; | |||||||||
| 7 | |||||||||||
| 8 | 27 | ▶ | use Module::Runtime qw( use_module ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 27 | ▶ | use Types::Standard qw( Str ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 27 | ▶ | use Kubernetes::Comb::CRD::Comb; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 27 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 27 | has crd_class => ( | |||||||||
| 15 | is => 'ro', | ||||||||||
| 16 | isa => Str, | ||||||||||
| 17 | default => 'Kubernetes::Comb::CRD::Comb' | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | 340 | ▶ | sub resource_map { | ||||||||
|
Subroutine
resource_map: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 22 | 340 | my ( $self ) = @_; | |||||||||
| 23 | 340 | my $class = $self->crd_class; | |||||||||
| 24 | 340 | ▶ | use_module($class) unless $class->can('kind'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | return { | ||||||||||
| 26 | 340 | $class->kind => '+'.$class, | |||||||||
| 27 | $class->api_version.'/'.$class->kind => '+'.$class | ||||||||||
| 28 | }; | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | 27 | 1; | |||||||||
| 33 | |||||||||||
| 34 | __END__ | ||||||||||
| 35 | |||||||||||
| 36 | =pod | ||||||||||
| 37 | |||||||||||
| 38 | =encoding UTF-8 | ||||||||||
| 39 | |||||||||||
| 40 | =head1 NAME | ||||||||||
| 41 | |||||||||||
| 42 | Kubernetes::Comb::CRD - IO::K8s resource map provider for the Comb custom resource | ||||||||||
| 43 | |||||||||||
| 44 | =head1 VERSION | ||||||||||
| 45 | |||||||||||
| 46 | version 0.001 | ||||||||||
| 47 | |||||||||||
| 48 | =head1 SYNOPSIS | ||||||||||
| 49 | |||||||||||
| 50 | use Kubernetes::REST; | ||||||||||
| 51 | use Kubernetes::Comb::CRD; | ||||||||||
| 52 | |||||||||||
| 53 | my $rest = Kubernetes::REST->new( | ||||||||||
| 54 | server => ..., | ||||||||||
| 55 | credentials => ..., | ||||||||||
| 56 | with => [ 'Kubernetes::Comb::CRD' ] | ||||||||||
| 57 | ); | ||||||||||
| 58 | my $combs = $rest->list('Comb', namespace => 'platform'); | ||||||||||
| 59 | |||||||||||
| 60 | # a CR class in another API group | ||||||||||
| 61 | my $k8s = IO::K8s->new( | ||||||||||
| 62 | with => [ Kubernetes::Comb::CRD->new(crd_class => 'MyApp::CRD::Comb') ] | ||||||||||
| 63 | ); | ||||||||||
| 64 | |||||||||||
| 65 | =head1 DESCRIPTION | ||||||||||
| 66 | |||||||||||
| 67 | Registers the Comb custom resource with L<IO::K8s>, so a client resolves the | ||||||||||
| 68 | Kind C<Comb> -- and its qualified name, C<comb.internal/v1/Comb> by default -- | ||||||||||
| 69 | to the CR class and inflates Comb objects. Takes the place of the provider | ||||||||||
| 70 | classes IO::K8s ships for its bundled CRDs (C<IO::K8s::Cilium>, ...). | ||||||||||
| 71 | |||||||||||
| 72 | =head2 crd_class | ||||||||||
| 73 | |||||||||||
| 74 | The CR class to register. Defaults to L<Kubernetes::Comb::CRD::Comb>; a | ||||||||||
| 75 | subclass for another API group goes here. Loaded on first use unless it is | ||||||||||
| 76 | already. | ||||||||||
| 77 | |||||||||||
| 78 | =head2 resource_map | ||||||||||
| 79 | |||||||||||
| 80 | Returns the map L<IO::K8s::Role::ResourceMap> asks for: the Kind and the | ||||||||||
| 81 | qualified C<apiVersion/Kind> of L</crd_class>, both pointing at the class. The | ||||||||||
| 82 | qualified entry is there for clients that take a plain C<resource_map> instead | ||||||||||
| 83 | of providers, like L<Net::Async::Kubernetes>. | ||||||||||
| 84 | |||||||||||
| 85 | =head1 SEE ALSO | ||||||||||
| 86 | |||||||||||
| 87 | =over | ||||||||||
| 88 | |||||||||||
| 89 | =item * L<Kubernetes::Comb::CRD::Comb> | ||||||||||
| 90 | |||||||||||
| 91 | =item * L<IO::K8s/with> | ||||||||||
| 92 | |||||||||||
| 93 | =back | ||||||||||
| 94 | |||||||||||
| 95 | =head1 SUPPORT | ||||||||||
| 96 | |||||||||||
| 97 | =head2 Issues | ||||||||||
| 98 | |||||||||||
| 99 | Please report bugs and feature requests on GitHub at | ||||||||||
| 100 | L<https://github.com/Getty/p5-kubernetes-comb/issues>. | ||||||||||
| 101 | |||||||||||
| 102 | =head2 IRC | ||||||||||
| 103 | |||||||||||
| 104 | Join C<#kubernetes> on C<irc.perl.org> or message Getty directly. | ||||||||||
| 105 | |||||||||||
| 106 | =head1 CONTRIBUTING | ||||||||||
| 107 | |||||||||||
| 108 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||
| 109 | |||||||||||
| 110 | =head1 AUTHOR | ||||||||||
| 111 | |||||||||||
| 112 | Torsten Raudssus <getty@cpan.org> | ||||||||||
| 113 | |||||||||||
| 114 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 115 | |||||||||||
| 116 | This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>. | ||||||||||
| 117 | |||||||||||
| 118 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 119 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 120 | |||||||||||
| 121 | =cut | ||||||||||