Download the PHP package prezly/kubernetes-client without Composer
On this page you can find all versions of the php package prezly/kubernetes-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download prezly/kubernetes-client
More information about prezly/kubernetes-client
Files in prezly/kubernetes-client
Package kubernetes-client
Short Description Minimalistic Kubernetes API client implementation
License MIT
Informations about the package kubernetes-client
Prezly's Kubernetes Client
Prezly's Kubernetes Client is a minimalistic Kubernetes API client implementation in PHP which allows you to list, fetch, update, delete and watch resources in your Kubernetes cluster.
Features
- Kubernetes Watch API support
- Unlimited authentication functionality
- No knowledge about any specific Kubernetes resources: it supports every resource or collection you have
- PHP 7.4+
- PHP 8.0
- Semver
- Tests
Installation
Use Composer package manager to add Prezly's Kubernetes Client to your project:
Authentication
Prezly's Kubernetes Client accepts a pre-configured Guzzle HTTP client as constructor argument, so you can configure it to any exotic connection, authentication or proxy setup you may have.
There's also a KubernetesClientFactory
to provide a fluent API to configure a KubernetesClient
for most common use-cases:
Logging
Prezly's Kubernetes Client can be configured with any PSR logger implementation to provide internal log for application monitoring. This is especially recommended for long-running resource-watching daemon applications.
Or you can also configure a logger with KubernetesClientFactory
fluent API:
API Interaction
Once you have a KubernetesClient instance, you can interact with Kubernetes APIs with the plain-simple REST client abstraction:
$client->get($uri, $queryParams)
— to performGET
requests$client->post($uri, $body, $queryParams)
— to performPOST
requests$client->put($uri, $body, $queryParams)
— to performPUT
requests$client->patch($uri, $body, $queryParams)
— to performPATCH
requests$client->delete($uri, $queryParams)
— to performDELETE
requests
Watching resources
KubernetesClient implements a simple yet powerful abstraction to access Kubernetes Watch API:
A watch()
call starts an infinite daemon process that will self-recover and retry from any HTTP errors.
To better monitor what's going on during a watch call it is strongly recommended configuring a logger.
Initializing state before starting watcher
You can also provide an initializer to initialize state before watch starts:
Stopping daemon
By default, the watcher will run indefinitely, but you can return false
from your watch callback to force it exit.
Credits
Brought to you with :heart: by Prezly — PR software for better, faster communication.
All versions of kubernetes-client with dependencies
ext-curl Version *
ext-json Version *
guzzlehttp/guzzle Version ^6.0|^7.0
psr/log Version ^1.0