| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::K8s::Types; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Type::Tiny type library for Kubernetes resources |
|
3
|
|
|
|
|
|
|
our $VERSION = '1.008'; |
|
4
|
29
|
|
|
29
|
|
135707
|
use Type::Library -base, -declare => qw( IntOrStr Quantity Time ); |
|
|
29
|
|
|
|
|
60230
|
|
|
|
29
|
|
|
|
|
296
|
|
|
5
|
29
|
|
|
29
|
|
39120
|
use Type::Utils -all; |
|
|
29
|
|
|
|
|
289885
|
|
|
|
29
|
|
|
|
|
347
|
|
|
6
|
29
|
|
|
29
|
|
85819
|
use Types::Standard -types; |
|
|
29
|
|
|
|
|
114197
|
|
|
|
29
|
|
|
|
|
167
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Re-export common Types::Standard types |
|
9
|
29
|
|
|
29
|
|
246738
|
BEGIN { extends 'Types::Standard' } |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Kubernetes scalar types |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
declare IntOrStr, as Str; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
declare Quantity, as Str, |
|
16
|
|
|
|
|
|
|
where { /\A[+-]?(\d+\.?\d*|\d*\.\d+)([eE][+-]?\d+|Ki|Mi|Gi|Ti|Pi|Ei|[mkMGTPE])?\z/ }, |
|
17
|
|
|
|
|
|
|
message { "Value '$_' is not a valid Kubernetes Quantity" }; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
declare Time, as Str, |
|
20
|
|
|
|
|
|
|
where { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})\z/ }, |
|
21
|
|
|
|
|
|
|
message { "Value '$_' is not a valid RFC3339 timestamp" }; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Core V1 Types |
|
24
|
|
|
|
|
|
|
class_type 'Pod', { class => 'IO::K8s::Api::Core::V1::Pod' }; |
|
25
|
|
|
|
|
|
|
class_type 'PodSpec', { class => 'IO::K8s::Api::Core::V1::PodSpec' }; |
|
26
|
|
|
|
|
|
|
class_type 'PodStatus', { class => 'IO::K8s::Api::Core::V1::PodStatus' }; |
|
27
|
|
|
|
|
|
|
class_type 'Container', { class => 'IO::K8s::Api::Core::V1::Container' }; |
|
28
|
|
|
|
|
|
|
class_type 'Service', { class => 'IO::K8s::Api::Core::V1::Service' }; |
|
29
|
|
|
|
|
|
|
class_type 'ServiceSpec', { class => 'IO::K8s::Api::Core::V1::ServiceSpec' }; |
|
30
|
|
|
|
|
|
|
class_type 'ConfigMap', { class => 'IO::K8s::Api::Core::V1::ConfigMap' }; |
|
31
|
|
|
|
|
|
|
class_type 'Secret', { class => 'IO::K8s::Api::Core::V1::Secret' }; |
|
32
|
|
|
|
|
|
|
class_type 'Namespace', { class => 'IO::K8s::Api::Core::V1::Namespace' }; |
|
33
|
|
|
|
|
|
|
class_type 'Node', { class => 'IO::K8s::Api::Core::V1::Node' }; |
|
34
|
|
|
|
|
|
|
class_type 'PersistentVolume', { class => 'IO::K8s::Api::Core::V1::PersistentVolume' }; |
|
35
|
|
|
|
|
|
|
class_type 'PersistentVolumeClaim', { class => 'IO::K8s::Api::Core::V1::PersistentVolumeClaim' }; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Apps V1 Types |
|
38
|
|
|
|
|
|
|
class_type 'Deployment', { class => 'IO::K8s::Api::Apps::V1::Deployment' }; |
|
39
|
|
|
|
|
|
|
class_type 'DeploymentSpec', { class => 'IO::K8s::Api::Apps::V1::DeploymentSpec' }; |
|
40
|
|
|
|
|
|
|
class_type 'ReplicaSet', { class => 'IO::K8s::Api::Apps::V1::ReplicaSet' }; |
|
41
|
|
|
|
|
|
|
class_type 'StatefulSet', { class => 'IO::K8s::Api::Apps::V1::StatefulSet' }; |
|
42
|
|
|
|
|
|
|
class_type 'DaemonSet', { class => 'IO::K8s::Api::Apps::V1::DaemonSet' }; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Batch V1 Types |
|
45
|
|
|
|
|
|
|
class_type 'Job', { class => 'IO::K8s::Api::Batch::V1::Job' }; |
|
46
|
|
|
|
|
|
|
class_type 'JobSpec', { class => 'IO::K8s::Api::Batch::V1::JobSpec' }; |
|
47
|
|
|
|
|
|
|
class_type 'JobStatus', { class => 'IO::K8s::Api::Batch::V1::JobStatus' }; |
|
48
|
|
|
|
|
|
|
class_type 'CronJob', { class => 'IO::K8s::Api::Batch::V1::CronJob' }; |
|
49
|
|
|
|
|
|
|
class_type 'CronJobSpec', { class => 'IO::K8s::Api::Batch::V1::CronJobSpec' }; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Networking V1 Types |
|
52
|
|
|
|
|
|
|
class_type 'Ingress', { class => 'IO::K8s::Api::Networking::V1::Ingress' }; |
|
53
|
|
|
|
|
|
|
class_type 'IngressSpec', { class => 'IO::K8s::Api::Networking::V1::IngressSpec' }; |
|
54
|
|
|
|
|
|
|
class_type 'NetworkPolicy', { class => 'IO::K8s::Api::Networking::V1::NetworkPolicy' }; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# RBAC V1 Types |
|
57
|
|
|
|
|
|
|
class_type 'Role', { class => 'IO::K8s::Api::Rbac::V1::Role' }; |
|
58
|
|
|
|
|
|
|
class_type 'RoleBinding', { class => 'IO::K8s::Api::Rbac::V1::RoleBinding' }; |
|
59
|
|
|
|
|
|
|
class_type 'ClusterRole', { class => 'IO::K8s::Api::Rbac::V1::ClusterRole' }; |
|
60
|
|
|
|
|
|
|
class_type 'ClusterRoleBinding', { class => 'IO::K8s::Api::Rbac::V1::ClusterRoleBinding' }; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Meta V1 Types |
|
63
|
|
|
|
|
|
|
class_type 'ObjectMeta', { class => 'IO::K8s::Apimachinery::Pkg::Apis::Meta::V1::ObjectMeta' }; |
|
64
|
|
|
|
|
|
|
class_type 'LabelSelector', { class => 'IO::K8s::Apimachinery::Pkg::Apis::Meta::V1::LabelSelector' }; |
|
65
|
|
|
|
|
|
|
class_type 'Status', { class => 'IO::K8s::Apimachinery::Pkg::Apis::Meta::V1::Status' }; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# API Extensions Types |
|
68
|
|
|
|
|
|
|
class_type 'CustomResourceDefinition', { class => 'IO::K8s::ApiextensionsApiserver::Pkg::Apis::Apiextensions::V1::CustomResourceDefinition' }; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Export tags |
|
71
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
|
72
|
|
|
|
|
|
|
k8s_scalars => [qw( IntOrStr Quantity Time )], |
|
73
|
|
|
|
|
|
|
core => [qw( Pod PodSpec PodStatus Container Service ServiceSpec |
|
74
|
|
|
|
|
|
|
ConfigMap Secret Namespace Node |
|
75
|
|
|
|
|
|
|
PersistentVolume PersistentVolumeClaim )], |
|
76
|
|
|
|
|
|
|
apps => [qw( Deployment DeploymentSpec ReplicaSet StatefulSet DaemonSet )], |
|
77
|
|
|
|
|
|
|
batch => [qw( Job JobSpec JobStatus CronJob CronJobSpec )], |
|
78
|
|
|
|
|
|
|
networking => [qw( Ingress IngressSpec NetworkPolicy )], |
|
79
|
|
|
|
|
|
|
rbac => [qw( Role RoleBinding ClusterRole ClusterRoleBinding )], |
|
80
|
|
|
|
|
|
|
meta => [qw( ObjectMeta LabelSelector Status )], |
|
81
|
|
|
|
|
|
|
); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ]; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |