コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function findByLabels(array $labels)
 {
     $labelSelector = HttpAdapter::createLabelSelector($labels);
     $url = $this->namespaceClient->prefixPath('/ingresses?labelSelector=' . $labelSelector);
     $url = '/apis/extensions/v1beta1' . $url;
     return $this->connector->get($url, ['class' => IngressList::class]);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function findByName($name)
 {
     try {
         return $this->connector->get($this->namespaceClient->prefixPath(sprintf('/serviceaccounts/%s', $name)), ['class' => ServiceAccount::class, 'groups' => ['Default', 'show']]);
     } catch (ClientError $e) {
         if ($e->getStatus()->getCode() === 404) {
             throw new ServiceAccountNotFound();
         }
         throw $e;
     }
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function findOneByName($name)
 {
     try {
         return $this->connector->get($this->namespaceClient->prefixPath(sprintf('/services/%s', $name)), ['class' => Service::class]);
     } catch (ClientError $e) {
         if ($e->getStatus()->getCode() === 404) {
             throw new ServiceNotFound(sprintf('Service named "%s" is not found', $name));
         }
         throw $e;
     }
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function findOneByName($name)
 {
     try {
         return $this->connector->get($this->namespaceClient->prefixPath(sprintf('/persistentvolumeclaims/%s', $name)), ['class' => PersistentVolumeClaim::class, 'groups' => ['Default', 'show']]);
     } catch (ClientError $e) {
         if ($e->getStatus()->getCode() === 404) {
             throw new PersistentVolumeClaimNotFound();
         }
         throw $e;
     }
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function findOneByName($name)
 {
     try {
         return $this->connector->get('/namespaces/' . $name, ['class' => KubernetesNamespace::class]);
     } catch (ClientError $e) {
         if ($e->getStatus()->getCode() === 404) {
             throw new NamespaceNotFound(sprintf('Namespace named "%s" is not found', $name));
         }
         throw $e;
     }
 }
コード例 #6
0
 /**
  * {@inheritdoc}
  */
 public function findOneByName($name)
 {
     try {
         $url = $this->namespaceClient->prefixPath(sprintf('/deployments/%s', $name));
         $url = '/apis/extensions/v1beta1' . $url;
         return $this->connector->get($url, ['class' => Deployment::class]);
     } catch (ClientError $e) {
         if ($e->getStatus()->getCode() === 404) {
             throw new DeploymentNotFound(sprintf('Deployment named "%s" is not found', $name));
         }
         throw $e;
     }
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function findByLabels(array $labels)
 {
     $labelSelector = HttpAdapter::createLabelSelector($labels);
     $path = $this->namespaceClient->prefixPath('/replicationcontrollers?labelSelector=' . $labelSelector);
     /** @var ReplicationControllerList $found */
     $found = $this->connector->get($path, ['class' => ReplicationControllerList::class]);
     return $found;
 }
コード例 #8
0
 /**
  * Get pod's logs.
  *
  * @param Pod $pod
  *
  * @return string
  */
 private function getLogs(Pod $pod)
 {
     $name = $pod->getMetadata()->getName();
     return $this->connector->get($this->namespaceClient->prefixPath(sprintf('/pods/%s/log', $name)));
 }
コード例 #9
0
 /**
  * {@inheritdoc}
  */
 public function findAll()
 {
     return $this->connector->get('/nodes', ['class' => NodeList::class]);
 }
コード例 #10
0
 /**
  * {@inheritdoc}
  */
 public function findByObject(KubernetesObject $object)
 {
     $url = $this->namespaceClient->prefixPath('/events') . '?' . http_build_query(['fieldSelector' => http_build_query(['involvedObject.kind' => $object->getKind(), 'involvedObject.name' => $object->getMetadata()->getName()], null, ',')]);
     return $this->connector->get($url, ['class' => EventList::class]);
 }