| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::K8s::APIObject; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Base class for top-level Kubernetes API objects |
|
3
|
|
|
|
|
|
|
our $VERSION = '1.008'; |
|
4
|
26
|
|
|
26
|
|
5479
|
use v5.10; |
|
|
26
|
|
|
|
|
126
|
|
|
5
|
26
|
|
|
26
|
|
12498
|
use IO::K8s::Resource (); |
|
|
26
|
|
|
|
|
118
|
|
|
|
26
|
|
|
|
|
945
|
|
|
6
|
26
|
|
|
26
|
|
158
|
use Import::Into; |
|
|
26
|
|
|
|
|
93
|
|
|
|
26
|
|
|
|
|
670
|
|
|
7
|
26
|
|
|
26
|
|
118
|
use Package::Stash; |
|
|
26
|
|
|
|
|
177
|
|
|
|
26
|
|
|
|
|
590
|
|
|
8
|
26
|
|
|
26
|
|
129
|
use Moo::Role (); |
|
|
26
|
|
|
|
|
45
|
|
|
|
26
|
|
|
|
|
5801
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub import { |
|
12
|
318
|
|
|
318
|
|
1131
|
my $class = shift; |
|
13
|
318
|
|
|
|
|
1513
|
my %params = @_; |
|
14
|
318
|
|
|
|
|
1406
|
my $caller = caller; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# First, do everything IO::K8s::Resource does |
|
17
|
318
|
|
|
|
|
6941
|
IO::K8s::Resource->import::into($caller); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Install CRD overrides *before* applying the role |
|
20
|
|
|
|
|
|
|
# This way the role sees these methods and doesn't install its defaults |
|
21
|
318
|
|
|
|
|
5375
|
my $is_crd = 0; |
|
22
|
318
|
100
|
|
|
|
2073
|
if (my $api_ver = $params{api_version}) { |
|
23
|
114
|
|
|
|
|
980
|
my $stash = Package::Stash->new($caller); |
|
24
|
114
|
|
|
386
|
|
1511
|
$stash->add_symbol('&api_version', sub { $api_ver }); |
|
|
386
|
|
|
|
|
106186
|
|
|
25
|
114
|
|
|
|
|
462
|
$is_crd = 1; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
318
|
100
|
|
|
|
1541
|
if (my $plural = $params{resource_plural}) { |
|
28
|
114
|
|
|
|
|
806
|
my $stash = Package::Stash->new($caller); |
|
29
|
114
|
|
|
48
|
|
1187
|
$stash->add_symbol('&resource_plural', sub { $plural }); |
|
|
48
|
|
|
|
|
303
|
|
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Apply the APIObject role (provides metadata, labels, conditions, owners) |
|
33
|
318
|
|
|
|
|
1814
|
Moo::Role->apply_roles_to_package($caller, 'IO::K8s::Role::APIObject'); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# CRDs get SpecBuilder automatically (deep-path spec manipulation) |
|
36
|
318
|
100
|
|
|
|
1038818
|
if ($is_crd) { |
|
37
|
114
|
|
|
|
|
537
|
Moo::Role->apply_roles_to_package($caller, 'IO::K8s::Role::SpecBuilder'); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Register metadata attribute using the k8s DSL |
|
41
|
|
|
|
|
|
|
# This allows _inflate_struct to properly inflate metadata as ObjectMeta |
|
42
|
|
|
|
|
|
|
# The k8s function skips attribute creation if it already exists (from the role) |
|
43
|
318
|
|
|
|
|
415797
|
$caller->can('k8s')->('metadata', 'Meta::V1::ObjectMeta'); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |