Skip to content

Commit

Permalink
job maker
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasfinsight committed Oct 13, 2020
1 parent da9d444 commit 7c857bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Core/Job/AbstractJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Dealroadshow\K8S\API\Batch\Job;
use Dealroadshow\K8S\Data\Collection\StringMap;
use Dealroadshow\K8S\Data\PodSpec;
use Dealroadshow\K8S\Framework\Core\LabelSelector\LabelSelectorConfigurator;
use Dealroadshow\K8S\Framework\Core\MetadataConfigurator;
use Dealroadshow\K8S\Framework\Core\Pod\Affinity\AffinityConfigurator;
use Dealroadshow\K8S\Framework\Core\Pod\Containers\PodContainers;
Expand All @@ -14,6 +15,10 @@

abstract class AbstractJob implements JobInterface
{
public function labelSelector(LabelSelectorConfigurator $selector): void
{
}

public function backoffLimit(): ?int
{
return null;
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Job/JobInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
namespace Dealroadshow\K8S\Framework\Core\Job;

use Dealroadshow\K8S\API\Batch\Job;
use Dealroadshow\K8S\Framework\Core\LabelSelector\LabelSelectorConfigurator;
use Dealroadshow\K8S\Framework\Core\ManifestInterface;
use Dealroadshow\K8S\Framework\Core\Pod\PodTemplateSpecInterface;

interface JobInterface extends PodTemplateSpecInterface, ManifestInterface
{
public function labelSelector(LabelSelectorConfigurator $selector): void;
public function backoffLimit(): ?int;
public function activeDeadlineSeconds(): ?int;
public function ttlSecondsAfterFinished(): ?int;
Expand Down
4 changes: 4 additions & 0 deletions src/ResourceMaker/JobMaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Dealroadshow\K8S\API\Batch\Job;
use Dealroadshow\K8S\Framework\App\AppInterface;
use Dealroadshow\K8S\Framework\Core\Job\JobInterface;
use Dealroadshow\K8S\Framework\Core\LabelSelector\LabelSelectorConfigurator;
use Dealroadshow\K8S\Framework\Core\ManifestInterface;
use Dealroadshow\K8S\Framework\Core\Pod\PodTemplateSpecProcessor;

Expand All @@ -27,6 +28,9 @@ protected function makeResource(ManifestInterface $manifest, AppInterface $app):
{
$job = new Job();

$labelSelector = new LabelSelectorConfigurator($job->spec()->selector());
$manifest->labelSelector($labelSelector);

$app->metadataHelper()->configureMeta($manifest, $job);
$this->specProcessor->process($manifest, $job->spec()->template(), $app);

Expand Down

0 comments on commit 7c857bd

Please sign in to comment.