/**
  * {@inheritdoc}
  */
 public function findOneByName($name)
 {
     try {
         return $this->connector->get($this->namespaceClient->prefixPath(sprintf('/secrets/%s', $name)), ['class' => Secret::class]);
     } catch (ClientError $e) {
         if ($e->getStatus()->getCode() === 404) {
             throw new SecretNotFound();
         }
         throw $e;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function update(Ingress $ingress)
 {
     $ingressName = $ingress->getMetadata()->getName();
     $currentIngress = $this->findOneByName($ingressName);
     if ($ingress->getSpecification() == $currentIngress->getSpecification()) {
         return $currentIngress;
     }
     $url = $this->namespaceClient->prefixPath(sprintf('/ingresses/%s', $ingressName));
     $url = '/apis/extensions/v1beta1' . $url;
     return $this->connector->patch($url, $ingress, ['class' => Ingress::class]);
 }
 /**
  * {@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;
 }
 /**
  * {@inheritdoc}
  */
 public function delete(Service $service)
 {
     try {
         $path = $this->namespaceClient->prefixPath(sprintf('/services/%s', $service->getMetadata()->getName()));
         return $this->connector->delete($path, null, ['class' => Status::class]);
     } catch (ClientError $e) {
         if ($e->getStatus()->getCode() === 404) {
             throw new ServiceNotFound();
         }
         throw $e;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function create(ServiceAccount $serviceAccount)
 {
     return $this->connector->post($this->namespaceClient->prefixPath('/serviceaccounts'), $serviceAccount, ['class' => ServiceAccount::class]);
 }
예제 #6
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)));
 }
 /**
  * {@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]);
 }
 /**
  * {@inheritdoc}
  */
 public function create(PersistentVolumeClaim $claim)
 {
     return $this->connector->post($this->namespaceClient->prefixPath('/persistentvolumeclaims'), $claim, ['class' => PersistentVolumeClaim::class]);
 }
 /**
  * {@inheritdoc}
  */
 public function rollback(Deployment\DeploymentRollback $deploymentRollback)
 {
     $url = $this->namespaceClient->prefixPath(sprintf('/deployments/%s/rollback', $deploymentRollback->getName()));
     $url = '/apis/extensions/v1beta1' . $url;
     return $this->connector->post($url, $deploymentRollback, ['class' => Deployment\DeploymentRollback::class]);
 }