| 1 | package Net::Kubernetes::Resource::ReplicationController; | ||||||||||||
| 2 | # ABSTRACT: Object representatioon of a Kubernetes Replication Controller | ||||||||||||
| 3 | 4 | $Net::Kubernetes::Resource::ReplicationController::VERSION = '1.03'; | |||||||||||
| 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 | 0 | ▶ | sub scale { | ||||||||||
|
Subroutine
scale: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||
| 17 | 0 | my($self, $replicas, $timeout) = @_; | |||||||||||
| 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__ | ||||||||||||