Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/travisghansen/kubernetes-client-php
No nonsense PHP Client for the Kubernetes API
https://github.com/travisghansen/kubernetes-client-php
api client k8s kubernetes php
Last synced: about 1 month ago
JSON representation
No nonsense PHP Client for the Kubernetes API
- Host: GitHub
- URL: https://github.com/travisghansen/kubernetes-client-php
- Owner: travisghansen
- License: apache-2.0
- Created: 2018-09-04T22:31:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-04T00:11:01.000Z (7 months ago)
- Last Synced: 2024-09-28T21:02:24.175Z (about 2 months ago)
- Topics: api, client, k8s, kubernetes, php
- Language: PHP
- Size: 51.8 KB
- Stars: 33
- Watchers: 5
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Intro
No nonsense PHP client for the Kubernetes API. It supports standard `REST` calls along with `watch`es for a continuous
feed of data. Because no models are used it's usable with `CRD`s and other functionality/endpoints that may not be
built-in.# Example
See [sample.php](sample.php)# Watches
Watches can (will) stay connected indefinitely, automatically reconnecting after server-side timeout. The client will
keep track of the most recent `resourceVersion` processed to automatically start where you left off.Watch callback closures should have the following signature:
```
$callback = function($event, $watch)..
```
Receiving the watch allows access to the client (and any other details on the watch) and also provides an ability to
stop the watch (break the loop) based off of event logic.* `GET /apis/batch/v1beta1/watch/namespaces/{namespace}/cronjobs/{name}` (specific resource)
* `GET /apis/batch/v1beta1/watch/namespaces/{namespace}/cronjobs` (resource type namespaced)
* `GET /apis/batch/v1beta1/watch/cronjobs` (resource type cluster-wide)
* https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#watchOther notes:
- if using labelSelectors triggered events will fire with ADDED / DELETED types if the label is added/delete
(ie: ADDED/DELETED do not necessarily equate to literally being added/deleted from k8s)# Development
Note on `resourceVersion` per the doc:
> When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to
> changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote
> storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; -
> if set to non zero, then the result is at least as fresh as given rv.Note that it's only changes **after** the version.
## TODO
* Introduce threads for callbacks?
* Do codegen on swagger docs to provide and OO interface to requests/responses?## Links
* https://github.com/swagger-api/swagger-codegen/blob/master/README.md
* https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#api-conventions
* https://kubernetes.io/docs/reference/using-api/client-libraries/#community-maintained-client-libraries
* https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/
* https://kubernetes.io/docs/reference/using-api/api-concepts/
* https://kubernetes.io/docs/concepts/overview/kubernetes-api/
* https://stackoverflow.com/questions/1342583/manipulate-a-string-that-is-30-million-characters-long/1342760#1342760
* https://github.com/kubernetes/client-go/blob/master/README.md
* https://github.com/kubernetes-client/python-base/blob/master/watch/watch.py
* https://github.com/kubernetes-client/python/issues/124## Async
* https://github.com/spatie/async/blob/master/README.md
* https://github.com/krakjoe/pthreads/blob/master/README.md
* http://php.net/manual/en/function.pcntl-fork.php