kubernetes / php-client
Full Kubernetes API client
Installs: 81 197
Dependents: 1
Suggesters: 0
Security: 0
Stars: 60
Watchers: 7
Forks: 7
Open Issues: 7
Requires
- php: >=7.2
- kubernetes/php-runtime: ^1
Requires (Dev)
- ext-json: *
- allansun/openapi-parser: ^1
- cpliakas/git-wrapper: ^2.0
- mattketmo/camel: ^1.1
- phpunit/phpunit: ^7|^8|^9
- symfony/console: ^4|^5
- symfony/filesystem: ^4|^5
- symfony/monolog-bridge: ^4|^5
- zendframework/zend-code: 3.3.*
- dev-master
- v1.22.0-alpha.0
- v1.21.11.x-dev
- v1.21.11
- v1.21.4-rc.0
- v1.21.3-rc.0
- v1.21.2-rc.0
- v1.21.1-rc.0
- v1.21.0-alpha.0
- v1.20.9-rc.0
- v1.20.8.x-dev
- v1.20.8
- v1.20.8-rc.0
- v1.20.7-rc.0
- v1.20.6-rc.0
- v1.20.5-rc.0
- v1.20.4-rc.0
- v1.20.3-rc.0
- v1.20.2-rc.0
- v1.20.1-rc.1
- v1.20.1-rc.0
- v1.20.0-beta.2
- v1.20.0-beta.1
- v1.20.0-beta.0
- v1.20.0-alpha.3
- v1.20.0-alpha.2
- v1.20.0-alpha.1
- v1.20.0-alpha.0
- v1.19.14-rc.0
- v1.19.13-rc.0
- v1.19.12-rc.0
- v1.19.11-rc.0
- v1.19.10-rc.0
- v1.19.9-rc.0
- v1.19.8-rc.0
- v1.19.7-rc.0
- v1.19.6-rc.1
- v1.19.6-rc.0
- v1.19.5-rc.0
- v1.19.4.x-dev
- v1.19.4
- v1.19.4-rc.0
- v1.19.3.x-dev
- v1.19.3
- v1.19.3-rc.0
- v1.19.2.x-dev
- v1.19.2-patch.0
- v1.19.2
- v1.19.2-rc.0
- v1.19.1.x-dev
- v1.19.1
- v1.19.1-rc.0
- v1.19.0.x-dev
- v1.19.0
- v1.19.0-rc.4
- v1.19.0-rc.3
- v1.19.0-rc.2
- v1.19.0-rc.1
- v1.19.0-rc.0
- v1.19.0-beta.2
- v1.19.0-beta.1
- v1.19.0-beta.0
- v1.19.0-alpha.3
- v1.19.0-alpha.2
- v1.19.0-alpha.1
- v1.19.0-alpha.0
- v1.18.21-rc.0
- v1.18.20-rc.0
- v1.18.19-rc.0
- v1.18.18-rc.0
- v1.18.17-rc.0
- v1.18.16-rc.0
- v1.18.15-rc.0
- v1.18.14-rc.1
- v1.18.14-rc.0
- v1.18.13-rc.0
- v1.18.12.x-dev
- v1.18.12
- v1.18.12-rc.1
- v1.18.11.x-dev
- v1.18.11
- v1.18.11-rc.0
- v1.18.10.x-dev
- v1.18.10
- v1.18.10-rc.0
- v1.18.9.x-dev
- v1.18.9-patch.0
- v1.18.9
- v1.18.9-rc.0
- v1.18.8.x-dev
- v1.18.8
- v1.18.8-rc.1
- v1.18.8-rc.0
- v1.18.7.x-dev
- v1.18.7
- v1.18.7-rc.0
- v1.18.6.x-dev
- v1.18.6
- v1.18.6-rc.0
- v1.18.5.x-dev
- v1.18.5
- v1.18.5-rc.1
- v1.18.5-rc.0
- v1.18.4.x-dev
- v1.18.4
- v1.18.4-rc.0
- v1.18.3.x-dev
- v1.18.3
- v1.18.3-beta.0
- v1.18.2.x-dev
- v1.18.2
- v1.18.2-beta.0
- v1.18.1.x-dev
- v1.18.1
- v1.18.1-beta.0
- v1.18.0.x-dev
- v1.18.0
- v1.18.0-rc.1
- v1.18.0-beta.2
- v1.18.0-beta.1
- v1.18.0-beta.0
- v1.18.0-alpha.5
- v1.18.0-alpha.4
- v1.18.0-alpha.3
- v1.18.0-alpha.2
- v1.18.0-alpha.1
- v1.18.0-alpha.0
- v1.17.18-rc.0
- v1.17.17-rc.0
- v1.17.16-rc.1
- v1.17.16-rc.0
- v1.17.15-rc.0
- v1.17.14.x-dev
- v1.17.14
- v1.17.14-rc.0
- v1.17.13.x-dev
- v1.17.13
- v1.17.13-rc.0
- v1.17.12.x-dev
- v1.17.12-patch.0
- v1.17.12
- v1.17.12-rc.0
- v1.17.11.x-dev
- v1.17.11
- v1.17.11-rc.1
- v1.17.11-rc.0
- v1.17.10.x-dev
- v1.17.10
- v1.17.10-rc.0
- v1.17.9.x-dev
- v1.17.9
- v1.17.9-rc.0
- v1.17.8.x-dev
- v1.17.8
- v1.17.8-rc.1
- v1.17.8-rc.0
- v1.17.7.x-dev
- v1.17.7
- v1.17.7-rc.0
- v1.17.6.x-dev
- v1.17.6
- v1.17.6-beta.0
- v1.17.5.x-dev
- v1.17.5
- v1.17.5-beta.0
- v1.17.4.x-dev
- v1.17.4
- v1.17.4-beta.0
- v1.17.3.x-dev
- v1.17.3
- v1.17.3-beta.0
- v1.17.2.x-dev
- v1.17.2
- v1.17.2-beta.0
- v1.17.1.x-dev
- v1.17.1
- v1.17.1-beta.0
- v1.17.0.x-dev
- v1.17.0
- v1.17.0-rc.2
- v1.17.0-rc.1
- v1.17.0-beta.2
- v1.17.0-beta.1
- v1.17.0-beta.0
- v1.17.0-alpha.3
- v1.17.0-alpha.2
- v1.17.0-alpha.1
- v1.17.0-alpha.0
- v1.16.16-rc.0
- v1.16.15.x-dev
- v1.16.15-patch.0
- v1.16.15
- v1.16.15-rc.0
- v1.16.14.x-dev
- v1.16.14
- v1.16.14-rc.0
- v1.16.13.x-dev
- v1.16.13
- v1.16.13-rc.0
- v1.16.12.x-dev
- v1.16.12
- v1.16.12-rc.1
- v1.16.12-rc.0
- v1.16.11.x-dev
- v1.16.11
- v1.16.11-rc.0
- v1.16.10.x-dev
- v1.16.10
- v1.16.10-beta.0
- v1.16.9.x-dev
- v1.16.9
- v1.16.9-beta.0
- v1.16.8.x-dev
- v1.16.8
- v1.16.8-beta.0
- v1.16.7.x-dev
- v1.16.7
- v1.16.7-beta.0
- v1.16.6.x-dev
- v1.16.6
- v1.16.6-beta.0
- v1.16.5.x-dev
- v1.16.5
- v1.16.5-beta.1
- v1.16.5-beta.0
- v1.16.4.x-dev
- v1.16.4
- v1.16.4-beta.0
- v1.16.3.x-dev
- v1.16.3
- v1.16.3-beta.0
- v1.16.2.x-dev
- v1.16.2
- v1.16.2-beta.0
- v1.16.1.x-dev
- v1.16.1
- v1.16.1-beta.0
- v1.16.0.x-dev
- v1.16.0
- v1.16.0-rc.2
- v1.16.0-rc.1
- v1.16.0-beta.2
- v1.16.0-beta.1
- v1.16.0-beta.0
- v1.16.0-alpha.3
- v1.16.0-alpha.2
- v1.16.0-alpha.1
- v1.16.0-alpha.0
- v1.15.13-beta.0
- v1.15.12.x-dev
- v1.15.12-patch.0
- v1.15.12
- v1.15.12-beta.0
- v1.15.11.x-dev
- v1.15.11
- v1.15.11-beta.0
- v1.15.10.x-dev
- v1.15.10
- v1.15.10-beta.0
- v1.15.9.x-dev
- v1.15.9
- v1.15.9-beta.0
- v1.15.8.x-dev
- v1.15.8
- v1.15.8-beta.1
- v1.15.8-beta.0
- v1.15.7.x-dev
- v1.15.7
- v1.15.7-beta.0
- v1.15.6.x-dev
- v1.15.6
- v1.15.6-beta.0
- v1.15.5.x-dev
- v1.15.5
- v1.15.5-beta.0
- v1.15.4.x-dev
- v1.15.4
- v1.15.4-beta.0
- v1.15.3.x-dev
- v1.15.3
- v1.15.3-beta.0
- v1.15.2.x-dev
- v1.15.2
- v1.15.2-beta.0
- v1.15.1.x-dev
- v1.15.1
- v1.15.1-beta.0
- v1.15.0.x-dev
- v1.15.0
- v1.15.0-rc.1
- v1.15.0-beta.2
- v1.15.0-beta.1
- v1.15.0-beta.0
- v1.15.0-alpha.3
- v1.15.0-alpha.2
- v1.15.0-alpha.1
- v1.15.0-alpha.0
- v1.14.11-beta.1
- v1.14.11-beta.0
- v1.14.10.x-dev
- v1.14.10-patch.0
- v1.14.10
- v1.14.10-beta.0
- v1.14.9.x-dev
- v1.14.9
- v1.14.9-beta.0
- v1.14.8.x-dev
- v1.14.8
- v1.14.8-beta.0
- v1.14.7.x-dev
- v1.14.7
- v1.14.7-beta.0
- v1.14.6.x-dev
- v1.14.6
- v1.14.6-beta.0
- v1.14.5.x-dev
- v1.14.5
- v1.14.5-beta.0
- v1.14.4.x-dev
- v1.14.4
- v1.14.4-beta.0
- v1.14.3.x-dev
- v1.14.3
- v1.14.3-beta.0
- v1.14.2.x-dev
- v1.14.2
- v1.14.2-beta.0
- v1.14.1.x-dev
- v1.14.1
- v1.14.1-beta.0
- v1.14.0.x-dev
- v1.14.0
- v1.14.0-rc.1
- v1.14.0-beta.2
- v1.14.0-beta.1
- v1.14.0-beta.0
- v1.14.0-alpha.3
- v1.14.0-alpha.2
- v1.14.0-alpha.1
- v1.13.13-beta.0
- v1.13.12.x-dev
- v1.13.12-patch.0
- v1.13.12
- v1.13.12-beta.0
- v1.13.11.x-dev
- v1.13.11
- v1.13.11-beta.0
- v1.13.10.x-dev
- v1.13.10
- v1.13.10-beta.0
- v1.13.9.x-dev
- v1.13.9
- v1.13.9-beta.0
- v1.13.8.x-dev
- v1.13.8
- v1.13.8-beta.0
- v1.13.7.x-dev
- v1.13.7
- v1.13.7-beta.0
- v1.13.6.x-dev
- v1.13.6
- v1.13.6-beta.0
- v1.13.5.x-dev
- v1.13.5
- v1.13.5-beta.0
- v1.13.4.x-dev
- v1.13.4
- v1.13.4-beta.0
- v1.13.3.x-dev
- v1.13.3
- v1.13.3-beta.0
- v1.13.2.x-dev
- v1.13.2
- v1.13.2-beta.0
- v1.13.1.x-dev
- v1.13.1
- v1.13.1-beta.0
- v1.13.0.x-dev
- v1.13.0
- v1.12.11-beta.0
- v1.12.10.x-dev
- v1.12.10-patch.0
- v1.12.10
- v1.12.10-beta.0
- v1.12.9.x-dev
- v1.12.9
- v1.12.9-beta.0
- v1.12.8.x-dev
- v1.12.8
- v1.12.8-beta.0
- v1.12.7.x-dev
- v1.12.7
- v1.12.7-beta.0
- v1.12.6.x-dev
- v1.12.6
- v1.12.6-beta.0
- v1.12.5.x-dev
- v1.12.5
- v1.12.5-beta.0
- v1.12.4.x-dev
- v1.12.4
- v1.11.11-beta.0
- v1.11.10.x-dev
- v1.11.10-patch.0
- v1.11.10
- v1.11.10-beta.0
- v1.11.9.x-dev
- v1.11.9
- v1.11.9-beta.0
- v1.11.8.x-dev
- v1.11.8
- v1.11.8-beta.0
- v1.11.7.x-dev
- v1.11.7
- v1.11.7-beta.0
- v1.11.6.x-dev
- v1.11.6
- v1.10.14-beta.0
- v1.10.13.x-dev
- v1.10.13
- v1.10.13-beta.0
- v1.10.12.x-dev
- v1.10.12
- v1.9.11.x-dev
- v1.9.11
- dev-revert-84-v1.24.0
- dev-dependabot/composer/symfony/filesystem-5.4.23
- dev-dependabot/composer/symfony/console-5.4.23
- dev-dependabot/composer/guzzlehttp/psr7-2.5.0
- dev-dependabot/composer/phpunit/phpunit-9.6.7
- dev-v1.21.4-rc.0
- dev-v1.19.14-rc.0
- dev-v1.19.13-rc.0
- dev-v1.21.3-rc.0
- dev-v1.18.21-rc.0
- dev-v1.20.9-rc.0
- dev-v1.19.12-rc.0
- dev-v1.18.20-rc.0
- dev-v1.21.2-rc.0
- dev-v1.20.8-rc.0
- dev-v1.19.11-rc.0
- dev-v1.20.7-rc.0
- dev-v1.18.19-rc.0
- dev-v1.21.1-rc.0
- dev-v1.22.0-alpha.0
- dev-v1.18.18-rc.0
- dev-v1.20.6-rc.0
- dev-v1.19.10-rc.0
- dev-v1.19.9-rc.0
- dev-v1.20.5-rc.0
- dev-v1.20.4-rc.0
- dev-v1.18.17-rc.0
- dev-v1.17.18-rc.0
- dev-v1.20.3-rc.0
- dev-v1.18.16-rc.0
- dev-v1.19.8-rc.0
- dev-v1.19.7-rc.0
- dev-v1.17.17-rc.0
- dev-v1.18.15-rc.0
- dev-v1.20.2-rc.0
- dev-v1.18.14-rc.1
- dev-v1.20.1-rc.1
- dev-v1.17.16-rc.1
- dev-v1.19.6-rc.0
- dev-v1.18.14-rc.0
- dev-v1.19.6-rc.1
- dev-v1.17.16-rc.0
- dev-v1.20.1-rc.0
- dev-v1.21.0-alpha.0
- dev-v1.20.0-beta.2
- dev-v1.18.13-rc.0
- dev-v1.18.12-rc.1
- dev-v1.19.5-rc.0
- dev-v1.17.15-rc.0
- dev-v1.20.0-beta.1
- dev-v1.20.0-beta.0
- dev-v1.20.0-alpha.3
- dev-v1.18.11-rc.0
- dev-v1.17.14-rc.0
- dev-v1.19.4-rc.0
- dev-v1.20.0-alpha.2
- dev-v1.19.2-patch.0
- dev-v1.18.9-patch.0
- dev-v1.17.12-patch.0
- dev-v1.16.15-patch.0
- dev-v1.15.12-patch.0
- dev-v1.14.10-patch.0
- dev-v1.13.12-patch.0
- dev-v1.12.10-patch.0
- dev-v1.11.10-patch.0
- dev-v1.20.0-alpha.1
- dev-v1.19.3-rc.0
- dev-v1.17.13-rc.0
- dev-v1.18.10-rc.0
- dev-v1.19.2-rc.0
- dev-v1.16.16-rc.0
- dev-v1.19.1-rc.0
- dev-v1.16.15-rc.0
- dev-v1.17.12-rc.0
- dev-v1.18.9-rc.0
- dev-v1.17.11-rc.1
- dev-v1.18.8-rc.0
- dev-v1.18.8-rc.1
- dev-v1.17.11-rc.0
- dev-v1.19.0-rc.4
- dev-v1.19.0-rc.3
- dev-v1.19.0-rc.2
- dev-v1.16.14-rc.0
- dev-v1.18.7-rc.0
- dev-v1.17.10-rc.0
- dev-v1.19.0-rc.1
- dev-v1.20.0-alpha.0
- dev-v1.19.0-rc.0
- dev-v1.17.9-rc.0
- dev-v1.16.13-rc.0
- dev-v1.18.6-rc.0
- dev-v1.17.8-rc.1
- dev-v1.18.5-rc.1
- dev-v1.16.12-rc.1
- dev-v1.16.12-rc.0
- dev-v1.17.8-rc.0
- dev-v1.18.5-rc.0
- dev-v1.19.0-beta.2
- dev-v1.19.0-beta.1
- dev-v1.17.7-rc.0
- dev-v1.16.11-rc.0
- dev-v1.18.4-rc.0
- dev-v1.19.0-beta.0
- dev-v1.15.13-beta.0
- dev-v1.19.0-alpha.3
- dev-v1.19.0-alpha.2
- dev-v1.17.6-beta.0
- dev-v1.16.10-beta.0
- dev-v1.18.3-beta.0
- dev-v1.18.2-beta.0
- dev-v1.19.0-alpha.1
- dev-v1.18.1-beta.0
- dev-v1.18.0-rc.1
- dev-v1.15.12-beta.0
- dev-v1.17.5-beta.0
- dev-v1.16.9-beta.0
- dev-v1.18.0-beta.2
- dev-v1.18.0-beta.1
- dev-v1.18.0-beta.0
- dev-v1.19.0-alpha.0
- dev-v1.18.0-alpha.5
- dev-v1.18.0-alpha.4
- dev-v1.16.8-beta.0
- dev-v1.17.4-beta.0
- dev-v1.15.11-beta.0
- dev-v1.18.0-alpha.3
- dev-v1.16.7-beta.0
- dev-v1.18.0-alpha.2
- dev-v1.15.10-beta.0
- dev-v1.17.3-beta.0
- dev-v1.15.9-beta.0
- dev-v1.16.6-beta.0
- dev-v1.17.2-beta.0
- dev-v1.18.0-alpha.1
- dev-v1.16.5-beta.1
- dev-v1.15.8-beta.1
- dev-v1.14.11-beta.1
- dev-v1.14.11-beta.0
- dev-v1.15.8-beta.0
- dev-v1.16.5-beta.0
- dev-v1.17.1-beta.0
- dev-v1.17.0-rc.2
- dev-v1.17.0-rc.1
- dev-v1.17.0-beta.2
- dev-v1.14.10-beta.0
- dev-v1.16.4-beta.0
- dev-v1.15.7-beta.0
- dev-v1.17.0-beta.1
- dev-v1.18.0-alpha.0
- dev-v1.17.0-beta.0
- dev-v1.17.0-alpha.3
- dev-v1.13.13-beta.0
- dev-v1.14.9-beta.0
- dev-v1.16.3-beta.0
- dev-v1.15.6-beta.0
- dev-v1.17.0-alpha.2
- dev-v1.16.2-beta.0
- dev-v1.17.0-alpha.1
- dev-v1.15.5-beta.0
- dev-v1.16.1-beta.0
- dev-v1.13.12-beta.0
- dev-v1.14.8-beta.0
- dev-v1.16.0-rc.2
- dev-v1.16.0-rc.1
- dev-v1.16.0-beta.2
- dev-v1.16.0-beta.1
- dev-v1.14.7-beta.0
- dev-v1.15.4-beta.0
- dev-v1.13.11-beta.0
- dev-v1.16.0-beta.0
- dev-v1.17.0-alpha.0
- dev-v1.16.0-alpha.3
- dev-v1.13.10-beta.0
- dev-v1.14.6-beta.0
- dev-v1.15.3-beta.0
- dev-v1.16.0-alpha.2
- dev-v1.15.2-beta.0
- dev-v1.16.0-alpha.1
- dev-v1.14.5-beta.0
- dev-v1.13.9-beta.0
- dev-v1.12.11-beta.0
- dev-v1.15.1-beta.0
- dev-v1.15.0-rc.1
- dev-v1.13.8-beta.0
- dev-v1.14.4-beta.0
- dev-v1.15.0-beta.2
- dev-v1.12.10-beta.0
- dev-v1.15.0-beta.1
- dev-v1.14.3-beta.0
- dev-v1.15.0-beta.0
- dev-v1.16.0-alpha.0
- dev-v1.13.7-beta.0
- dev-v1.15.0-alpha.3
- dev-v1.11.11-beta.0
- dev-v1.15.0-alpha.2
- dev-v1.12.9-beta.0
- dev-v1.15.0-alpha.1
- dev-v1.14.2-beta.0
- dev-v1.14.1-beta.0
- dev-v1.13.6-beta.0
- dev-v1.12.8-beta.0
- dev-v1.11.10-beta.0
- dev-v1.14.0-rc.1
- dev-v1.14.0-beta.2
- dev-v1.11.9-beta.0
- dev-v1.13.5-beta.0
- dev-v1.12.7-beta.0
- dev-v1.14.0-beta.1
- dev-v1.14.0-beta.0
- dev-v1.15.0-alpha.0
- dev-v1.10.14-beta.0
- dev-v1.14.0-alpha.3
- dev-v1.13.4-beta.0
- dev-v1.14.0-alpha.2
- dev-v1.11.8-beta.0
- dev-v1.12.6-beta.0
- dev-v1.14.0-alpha.1
- dev-v1.13.3-beta.0
- dev-v1.13.1-beta.0
- dev-v1.10.13-beta.0
- dev-v1.13.2-beta.0
- dev-v1.12.5-beta.0
- dev-v1.11.7-beta.0
This package is auto-updated.
Last update: 2024-10-30 01:37:28 UTC
README
This is a full PHP client reverse engineered from Kubernetes' Swagger defination.
You can control your Kubernetes cluster in PHP, the programmatical way.
Kubernetes Release Compatibility
Kubernetes Version Support
Since this client is generated from Kubernetes' swagger file, it follows whatever the backward compatibilities Kubernetes has. You should use the correct version against your cluster.
One exception, in regards to compatibility, kpc
supports the equivalent Kubernetes minor release number. A minor
version is the second digit in the release number. kpc
version 1.8.0 has a minor version of 8. The numbering follows
the semantic versioning specification, MAJOR.MINOR.PATCH.
For example, kpc
1.8.0 does not support Kubernetes 1.9.2, but kpc
1.9.0 supports Kubernetes 1.9.2 and previous
Kubernetes versions. Only when kpc
minor version matches, the Kubernetes minor version does kpc
officially support
the Kubernetes release. kpc
does not stop a user from using mismatching versions of K8s, but Kubernetes releases
always require kpc
to install specific versions of components like docker, that tested against the particular
Kubernetes version.
kpc
does not neccessarily follow the PATCH number of Kubernetes release. Each minor version is generated against
latest minor version of Kubernetes lease.
Compatibility Matrix
Use the latest version of kpc for all releases of Kubernetes, with the caveat that higher versions of Kubernetes are not officially supported by kpc.
kpc Release Schedule
This project runs on an automatic nightly build against latest Kubernetes release. If you found a particular version not available please open an issue so I can generate it manually.
Installation
Add a dependency on kubernetes/php-client to your project's composer.json
by utilizing the [Composer]
(https://getcomposer.org/) package manager.
{ "require-dev": { "kubernetes/php-client": "~{KUBERNETES_VERSION}" } }
{KUBERNETES_VERSION} should match at least the minor version of your Kubernetes cluster.
For example "kubernetes/php-client": "~1.8"
should be used against Kubernetes version 1.8.x
Usage instruction
Now you need to configure authentication credentials via a static method, (you only need to do this once).
<?php require_once('./vendor/autoload.php'); use KubernetesRuntime\Client; use Kubernetes\API\ConfigMap as ConfigMapAPI; use Kubernetes\Model\Io\K8s\Api\Core\V1\ConfigMap; $master = 'https://you-kubernetes-cluster.com'; $authentication = [ 'caCert' => '/usr/local/your-ca-file-location', 'token' => 'base64-based-token' ]; // This configure function only need to run once in the whole session Client::configure($master, $authentication); $ConfigMapAPI = new ConfigMapAPI(); $ConfigMap = new ConfigMap([ 'metadata' => [ 'name' => 'kubernetes-php-client-test' ], 'data' => [ 'bar' => 'foo' ] ]); $ConfigMapAPI->create('default',$ConfigMap); $response = $ConfigMapAPI->read('default','kubernetes-php-client-test'); print_r($response); /* Kubernetes\Model\Io\K8s\Api\Core\V1\ConfigMap Object ( [apiVersion] => v1 [data] => Array ( [bar] => foo ) [kind] => ConfigMap [metadata] => Kubernetes\Model\Io\K8s\Apimachinery\Pkg\Apis\Meta\V1\ObjectMeta Object ( [annotations] => [clusterName] => [creationTimestamp] => 2018-08-07T10:32:06Z [deletionGracePeriodSeconds] => [deletionTimestamp] => [finalizers] => [generateName] => [generation] => [initializers] => [labels] => [name] => kubernetes-php-client-test [namespace] => default [ownerReferences] => [resourceVersion] => 24374466 [selfLink] => /api/v1/namespaces/default/configmaps/kubernetes-php-client-test [uid] => 21f7036f-9a2d-11e8-89e9-0eeed2d5ffa8 [isRawObject:protected] => [rawData:protected] => ) [isRawObject:protected] => [rawData:protected] => ) */
Authentication
As per discribed in the documentation, you can use whatever authentication mode suits your requirement.
$authentication
supports following configurations:
- caCert
- clientCert
- clientKey
- token
- username
- password
Should you need to modify your Client to meet your Kubernetes cluster requirement, please refer to Guzzle's
documentation to pass any extra configuration parameters
you might need in the $authentication
array.
Class naming convention
Kubernetes is written in GoLang, hence its swagger field follows Go naming convention.
Models
io.k8s.api.batch.v1beta1.CronJob
will be converted to Kubernetes\Model\Io\K8s\Api\Batch\V1beta1\CronJob
APIs
As per swagger definitions, each api endpoint is an independent entry. Luckily Kubernetes provided extra info so we can put them into groups, you can find more info in Kubernetes API
/apis/batch/v1beta1/cronjobs
can be found in Kubernetes\API\CronJob
Pre-GA release features
As shown CronJob is currently in v1beta1
status. When you create a
Kubernetes\Model\Io\K8s\Api\Batch\V1beta1\CronJob()
object, it may later be moved
Kubernetes\Model\Io\K8s\Api\Batch\V1\CronJob()
. This is a good way so you would always know which version you
should be using.
Also, by following the Kubernetes conventions, if you have upgraded your cluster, when CronJob api expects a v1
CronJob, but you haven't upgraded your code to match the version, a PHP error will be prompted:
PHP Fatal error: Uncaught TypeError: Argument 2 passed to Kubernetes\API\CronJob::create() must be an instance of
Kubernetes\Model\Io\K8s\Api\Batch\V1\CronJob, instance of Kubernetes\Model\Io\K8s\Api\Batch\V1beta1\CronJob
given,
API Implementations
This API Wrapper implements all API endpoints currently provided by Kubernetes, for full documentation on how to use it please refere to API
Patch
Operation
As specified in the Kubernetes document ,
Patch
accepts three different kinds of operations:
- JSON Patch,
Content-Type: application/json-patch+json
- Merge Patch,
Content-Type: application/merge-patch+json
- Strategic Merge Patch,
Content-Type: application/strategic-merge-patch+json
To define which operation to use, developer is supposed to specifying the Content-Type by themselves.
In order implement the API operation without modifying the Patch
model class, you can pass patchOperation
as
additional data passed into the model, acceptable options are:
- patch
- merge-patch
- strategic-merge-patch
Example:
$Patch = new \Kubernetes\Model\Io\K8s\Apimachinery\Pkg\Apis\Meta\V1\Patch([ 'patchOperation' => 'merge-patch', 'spec' => [ 'template' => [ 'spec' => [ 'containers' => [[ 'name' => 'nginx-ingress-controller', 'image' => 'quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.23.0' ]] ] ] ] ]); $DeploymentAPI = new \Kubernetes\API\Deployment(); $DeploymentAPI->patch('default','nginx-ingress', $Patch);
The above request will send a json to your server:
{ "spec": { "template": { "spec": { "containers":[{ "name": "nginx-ingress-controller", "image": "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.23.0" }] } } } }
Be noted that the 'patchOperation' field is removed from the request, and the Content-Type
header will be set as merge-patch+json