-
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.
Cleanup + fixes + add support for daemon sets
- Loading branch information
Showing
15 changed files
with
139 additions
and
21 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
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\DaemonSet; | ||
|
||
class DaemonSetCollection extends Collection | ||
{ | ||
/** | ||
* The constructor. | ||
* | ||
* @param array $data | ||
*/ | ||
public function __construct(array $data) | ||
{ | ||
parent::__construct($this->getDaemonSets(isset($data['items']) ? $data['items'] : [])); | ||
} | ||
|
||
/** | ||
* Get an array of daemon sets. | ||
* | ||
* @param array $items | ||
* @return array | ||
*/ | ||
protected function getDaemonSets(array $items) | ||
{ | ||
foreach ($items as &$item) { | ||
$item = new DaemonSet($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 DaemonSet extends Model | ||
{ | ||
/** | ||
* The api version. | ||
* | ||
* @var string | ||
*/ | ||
protected $apiVersion = 'extensions/v1beta1'; | ||
} |
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
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\DaemonSetCollection; | ||
|
||
class DaemonSetRepository extends Repository | ||
{ | ||
protected $uri = 'daemonsets'; | ||
|
||
protected function createCollection($response) | ||
{ | ||
return new DaemonSetCollection($response); | ||
} | ||
} |
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
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
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,4 @@ | ||
{ | ||
"kind": "CronJob", | ||
"apiVersion": "batch\/v2alpha1" | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"kind": "Job", | ||
"apiVersion": "extensions\/v1beta1" | ||
"apiVersion": "batch\/v1" | ||
} |
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,29 @@ | ||
<?php | ||
|
||
use Maclof\Kubernetes\Models\CronJob; | ||
|
||
class CronJobTest extends TestCase | ||
{ | ||
public function test_get_schema() | ||
{ | ||
$job = new CronJob; | ||
|
||
$schema = $job->getSchema(); | ||
$fixture = $this->getFixture('cron-jobs/empty.json'); | ||
|
||
$this->assertEquals($schema, $fixture); | ||
} | ||
|
||
public function test_get_metadata() | ||
{ | ||
$job = new CronJob([ | ||
'metadata' => [ | ||
'name' => 'test', | ||
], | ||
]); | ||
|
||
$metadata = $job->getMetadata('name'); | ||
|
||
$this->assertEquals($metadata, 'test'); | ||
} | ||
} |