diff --git a/.gitignore b/.gitignore index 178b016..1fe449b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ /clover.xml /composer.lock /.idea +/.settings/ +/.buildpath +/.project diff --git a/README.md b/README.md index 37c8f47..8e9d18d 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ $ composer require maclof/kubernetes-client * Events * Config Maps * Endpoints +* Persistent Volume * Persistent Volume Claims ### batch/v1 diff --git a/src/Client.php b/src/Client.php index aefb374..8ea7ca5 100644 --- a/src/Client.php +++ b/src/Client.php @@ -16,6 +16,7 @@ use Maclof\Kubernetes\Repositories\IngressRepository; use Maclof\Kubernetes\Repositories\JobRepository; use Maclof\Kubernetes\Repositories\NodeRepository; +use Maclof\Kubernetes\Repositories\PersistentVolumeRepository; use Maclof\Kubernetes\Repositories\PersistentVolumeClaimRepository; use Maclof\Kubernetes\Repositories\PodRepository; use Maclof\Kubernetes\Repositories\ReplicaSetRepository; @@ -23,6 +24,7 @@ use Maclof\Kubernetes\Repositories\SecretRepository; use Maclof\Kubernetes\Repositories\ServiceRepository; use Maclof\Kubernetes\Repositories\NamespaceRepository; +use Maclof\Kubernetes\Models\PersistentVolume; /** * @method NodeRepository nodes() @@ -35,6 +37,7 @@ * @method ConfigMapRepository configMaps() * @method EndpointRepository endpoints() * @method PersistentVolumeClaimRepository persistentVolumeClaims() + * @method PersistentVolumeRepository persistentVolume() * @method JobRepository jobs() * @method CronJobRepository cronJobs() * @method DaemonSetRepository daemonSets() @@ -130,6 +133,7 @@ class Client 'events' => 'Repositories\EventRepository', 'configMaps' => 'Repositories\ConfigMapRepository', 'endpoints' => 'Repositories\EndpointRepository', + 'persistentVolume' => 'Repositories\PersistentVolumeRepository', 'persistentVolumeClaims' => 'Repositories\PersistentVolumeClaimRepository', 'namespaces' => 'Repositories\NamespaceRepository', diff --git a/src/Collections/PersistentVolumeCollection.php b/src/Collections/PersistentVolumeCollection.php new file mode 100644 index 0000000..616f7ce --- /dev/null +++ b/src/Collections/PersistentVolumeCollection.php @@ -0,0 +1,27 @@ +getPersistentVolume(isset($data['items']) ? $data['items'] : [])); + } + + protected function getPersistentVolume(array $items) + { + foreach ($items as &$item) { + $item = new PersistentVolume($item); + } + + return $items; + } +} + diff --git a/src/Models/PersistentVolume.php b/src/Models/PersistentVolume.php new file mode 100644 index 0000000..dde8270 --- /dev/null +++ b/src/Models/PersistentVolume.php @@ -0,0 +1,12 @@ +getApiVersion(); + if ($apiVersion == 'v1') { + $apiVersion = null; + } + + return $this->client->sendRequest($method, $uri, $query, $body, $namespace, $apiVersion); + } +} +