/** * {@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]); }
/** * {@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; } }
/** * {@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; } }
/** * {@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; } }
/** * {@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; } }
/** * {@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; } }
/** * {@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; }
/** * 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 findAll() { return $this->connector->get('/nodes', ['class' => NodeList::class]); }
/** * {@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]); }