From 30a31af0f9c9e34bdbbcbb2016392857dbc19bf8 Mon Sep 17 00:00:00 2001 From: Sven Wiltink Date: Thu, 15 May 2025 17:25:20 +0200 Subject: [PATCH] initial implemention of evictions --- src/Kinds/K8sEviction.php | 43 +++++++++++++++++++++++++++++ src/KubernetesCluster.php | 1 + src/Traits/InitializesResources.php | 13 +++++++++ 3 files changed, 57 insertions(+) create mode 100644 src/Kinds/K8sEviction.php diff --git a/src/Kinds/K8sEviction.php b/src/Kinds/K8sEviction.php new file mode 100644 index 00000000..ff99767d --- /dev/null +++ b/src/Kinds/K8sEviction.php @@ -0,0 +1,43 @@ +setNamespace($this->getNamespace()) + ->setName($this->getName()); + + return $pod->resourcePath() . "/eviction"; + } + +} diff --git a/src/KubernetesCluster.php b/src/KubernetesCluster.php index 1c6a7f4e..cb0ae6e7 100644 --- a/src/KubernetesCluster.php +++ b/src/KubernetesCluster.php @@ -13,6 +13,7 @@ * @method \RenokiCo\PhpK8s\ResourcesList getAllNodes(string $namespace = 'default', array $query = ['pretty' => 1]) * @method \RenokiCo\PhpK8s\Kinds\K8sEvent event(array $attributes = []) * @method \RenokiCo\PhpK8s\Kinds\K8sEvent getEventByName(string $name, string $namespace = 'default', array $query = ['pretty' => 1]) + * @method \RenokiCo\PhpK8s\Kinds\K8sEviction eviction(array $attributes = []) * @method \RenokiCo\PhpK8s\ResourcesList getAllEventsFromAllNamespaces(array $query = ['pretty' => 1]) * @method \RenokiCo\PhpK8s\ResourcesList getAllEvents(string $namespace = 'default', array $query = ['pretty' => 1]) * @method \RenokiCo\PhpK8s\Kinds\K8sNamespace namespace(array $attributes = []) diff --git a/src/Traits/InitializesResources.php b/src/Traits/InitializesResources.php index 73148809..18ddc544 100644 --- a/src/Traits/InitializesResources.php +++ b/src/Traits/InitializesResources.php @@ -9,6 +9,7 @@ use RenokiCo\PhpK8s\Kinds\K8sDaemonSet; use RenokiCo\PhpK8s\Kinds\K8sDeployment; use RenokiCo\PhpK8s\Kinds\K8sEvent; +use RenokiCo\PhpK8s\Kinds\K8sEviction; use RenokiCo\PhpK8s\Kinds\K8sHorizontalPodAutoscaler; use RenokiCo\PhpK8s\Kinds\K8sIngress; use RenokiCo\PhpK8s\Kinds\K8sJob; @@ -54,6 +55,18 @@ public static function event($cluster = null, array $attributes = []) return new K8sEvent($cluster, $attributes); } + /** + * Create a new Eviction kind. + * + * @param \RenokiCo\PhpK8s\KubernetesCluster|null $cluster + * @param array $attributes + * @return \RenokiCo\PhpK8s\Kinds\K8sEviction + */ + public static function eviction($cluster = null, array $attributes = []) + { + return new K8sEviction($cluster, $attributes); + } + /** * Create a new Namespace kind. *