From 1d6fa8abaf6de33db13a8f7c09f83e53f169723c Mon Sep 17 00:00:00 2001 From: Bruce <1644078+brucedevcom@users.noreply.github.com> Date: Tue, 27 Jun 2023 22:40:50 +0100 Subject: [PATCH] Added debug function to pods (#109) --- src/Repositories/PodRepository.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Repositories/PodRepository.php b/src/Repositories/PodRepository.php index 56f6ac6..5f08b61 100644 --- a/src/Repositories/PodRepository.php +++ b/src/Repositories/PodRepository.php @@ -32,4 +32,22 @@ public function exec(Pod $pod, array $queryParams = []) $response = $this->client->sendRequest('POST', '/' . $this->uri . '/' . $pod->getMetadata('name') . '/exec', $queryParams); return $response; } + + /** + * Attach an ephemeralContainer to a pod. + * + * @param Pod $pod Pod object + * @param array $spec array representing the relevant strategic spec + * @see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#ephemeralcontainer-v1-core EphemeralContainer spec + * + * @return array + */ + public function debug(Pod $pod, array $spec): array + { + $patch = json_encode($spec); + + $this->client->setPatchType('strategic'); + + return $this->sendRequest('PATCH', '/' . $this->uri . '/' . $pod->getMetadata('name') . '/ephemeralcontainers', [], $patch, $this->namespace); + } }