-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from gd-jroberts/master
Add HPA support
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php namespace Maclof\Kubernetes\Collections; | ||
|
||
use Maclof\Kubernetes\Models\HorizontalPodAutoscaler; | ||
|
||
class HorizontalPodAutoscalerCollection extends Collection | ||
{ | ||
/** | ||
* The constructor. | ||
* | ||
* @param array $data | ||
*/ | ||
public function __construct(array $data) | ||
{ | ||
parent::__construct($this->getHorizontalPodAutoscalers(isset($data['items']) ? $data['items'] : [])); | ||
} | ||
|
||
/** | ||
* Get an array of autoscalers. | ||
* | ||
* @param array $items | ||
* @return array | ||
*/ | ||
protected function getHorizontalPodAutoscalers(array $items) | ||
{ | ||
foreach ($items as &$item) { | ||
$item = new HorizontalPodAutoscaler($item); | ||
} | ||
|
||
return $items; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php namespace Maclof\Kubernetes\Models; | ||
|
||
class HorizontalPodAutoscaler extends \Maclof\Kubernetes\Models\Model | ||
{ | ||
/** | ||
* The api version. | ||
* | ||
* @var string | ||
*/ | ||
protected $apiVersion = 'autoscaling/v2beta1'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php namespace Maclof\Kubernetes\Repositories; | ||
|
||
use Maclof\Kubernetes\Collections\HorizontalPodAutoscalerCollection; | ||
|
||
class HorizontalPodAutoscalerRepository extends Repository | ||
{ | ||
protected $uri = 'horizontalpodautoscalers'; | ||
|
||
protected function createCollection($response) | ||
{ | ||
return new HorizontalPodAutoscalerCollection($response); | ||
} | ||
} |