Download the PHP package benagricola/eks-auth without Composer
On this page you can find all versions of the php package benagricola/eks-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benagricola/eks-auth
More information about benagricola/eks-auth
Files in benagricola/eks-auth
Package eks-auth
Short Description Provides a pre-authenticated HTTPClient for consumption by existing PHP Kubernetes Client libraries
License MIT
Homepage https://github.com/benagricola/php-eks-auth
Informations about the package eks-auth
PHP EKS Auth
This library uses the AWS V3 SDK to create an authenticated GuzzleHttp\Client
instance that can be passed to your compatible PHP Kubernetes client (only tested with maclof/kubernetes-client
).
All you need to authenticate with an EKS cluster is valid AWS credentials in your environment.
This library will pull the EKS endpoint details from AWS based on $clusterName
and $region
, using the default credential provider from aws-sdk-php
.
The GuzzleHttp\Client
instance will be preconfigured with a DynamicCertificate
Middleware that writes the CA certificate of the cluster to a temporary file so it can be passed to the underlying HTTP Handler (usually Curl).
The temporary certificate file is created and deleted on every request so does not need to be cleaned up, and means connections are fully verified.
Usage
Require it:
Then use it in your project:
Note: This library only catches and re-throws an error when the requested cluster does not exist. You should wrap the ClientFactory->getClient()
call in a try{} catch(Exception $e){}
block to avoid throwing all sorts of errors from the underlying libraries.
Contributing
Submit a pull request. I'm not a PHP dev so the codebase has no tests.