| 1 | package Net::Kubernetes::Resource::ReplicationController; | ||||||||||||
| 2 | # ABSTRACT: Object representatioon of a Kubernetes Replication Controller | ||||||||||||
| 3 | 4 | $Net::Kubernetes::Resource::ReplicationController::VERSION = '0.19'; | |||||||||||
| 4 | 4 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 4 | ▶ | use URI; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 4 | ▶ | use Time::HiRes; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | |||||||||||||
| 9 | 4 | extends 'Net::Kubernetes::Resource'; | |||||||||||
| 10 | 4 | with 'Net::Kubernetes::Resource::Role::State'; | |||||||||||
| 11 | 4 | with 'Net::Kubernetes::Resource::Role::Spec'; | |||||||||||
| 12 | 4 | with 'Net::Kubernetes::Resource::Role::HasPods'; | |||||||||||
| 13 | |||||||||||||
| 14 | |||||||||||||
| 15 | |||||||||||||
| 16 | sub scale { | ||||||||||||
| 17 | 0 | ▶ | my($self, $replicas, $timeout) = @_; | ||||||||||
|
Subroutine
scale: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||
| 18 | 0 | ▶ | $timeout ||= 5; | ||||||||||
|
Condition0%0/2
$timeout ||= 5
MC/DC0%0/1
$timeout ||= 5
$timeout
Truth table0%0/2
A
A= $timeout
| |||||||||||||
| 19 | 0 | $self->spec->{replicas} = $replicas; | |||||||||||
| 20 | 0 | $self->update; | |||||||||||
| 21 | 0 | my $st = time; | |||||||||||
| 22 | 0 | ▶ | while((time - $st) < $timeout){ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | 0 | my $pods = $self->get_pods; | |||||||||||
| 24 | 0 | ▶ | if(scalar(@$pods) == $replicas){ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 25 | 0 | return "scaled"; | |||||||||||
| 26 | } | ||||||||||||
| 27 | 0 | sleep(0.3); | |||||||||||
| 28 | } | ||||||||||||
| 29 | 0 | return 0; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 4 | return 42; | |||||||||||
| 33 | |||||||||||||
| 34 | __END__ | ||||||||||||
| 35 | |||||||||||||
| 36 | =pod | ||||||||||||
| 37 | |||||||||||||
| 38 | =encoding UTF-8 | ||||||||||||
| 39 | |||||||||||||
| 40 | =head1 NAME | ||||||||||||
| 41 | |||||||||||||
| 42 | Net::Kubernetes::Resource::ReplicationController - Object representatioon of a Kubernetes Replication Controller | ||||||||||||
| 43 | |||||||||||||
| 44 | =head1 VERSION | ||||||||||||
| 45 | |||||||||||||
| 46 | version 0.19 | ||||||||||||
| 47 | |||||||||||||
| 48 | =head1 METHODS | ||||||||||||
| 49 | |||||||||||||
| 50 | =head2 my(@pods) = $rc->get_pods() | ||||||||||||
| 51 | |||||||||||||
| 52 | Fetch a list off all pods belonging to this replication controller. | ||||||||||||
| 53 | |||||||||||||
| 54 | =head1 AUTHOR | ||||||||||||
| 55 | |||||||||||||
| 56 | Dave Mueller <dave@perljedi.com> | ||||||||||||
| 57 | |||||||||||||
| 58 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 59 | |||||||||||||
| 60 | This software is Copyright (c) 2015 by Dave Mueller. | ||||||||||||
| 61 | |||||||||||||
| 62 | This is free software, licensed under: | ||||||||||||
| 63 | |||||||||||||
| 64 | The MIT (X11) License | ||||||||||||
| 65 | |||||||||||||
| 66 | =head1 SEE ALSO | ||||||||||||
| 67 | |||||||||||||
| 68 | Please see those modules/websites for more information related to this module. | ||||||||||||
| 69 | |||||||||||||
| 70 | =over 4 | ||||||||||||
| 71 | |||||||||||||
| 72 | =item * | ||||||||||||
| 73 | |||||||||||||
| 74 | L<Net::Kubernetes|Net::Kubernetes> | ||||||||||||
| 75 | |||||||||||||
| 76 | =back | ||||||||||||
| 77 | |||||||||||||
| 78 | =head1 CONSUMES | ||||||||||||
| 79 | |||||||||||||
| 80 | =over 4 | ||||||||||||
| 81 | |||||||||||||
| 82 | =item * L<Net::Kubernetes::Resource::Role::HasPods> | ||||||||||||
| 83 | |||||||||||||
| 84 | =item * L<Net::Kubernetes::Resource::Role::Spec> | ||||||||||||
| 85 | |||||||||||||
| 86 | =item * L<Net::Kubernetes::Resource::Role::State> | ||||||||||||
| 87 | |||||||||||||
| 88 | =item * L<Net::Kubernetes::Role::APIAccess> | ||||||||||||
| 89 | |||||||||||||
| 90 | =back | ||||||||||||
| 91 | |||||||||||||
| 92 | =cut | ||||||||||||