Skip to content

Commit

Permalink
Added debug function to pods (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
b-t-927 authored Jun 27, 2023
1 parent 2040386 commit 1d6fa8a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Repositories/PodRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 1d6fa8a

Please sign in to comment.