k8s/http-symfony

Symfony based HttpClient factory for k8s/client

1.1.0 2022-06-20 15:14 UTC

This package is auto-updated.

Last update: 2024-12-18 17:24:27 UTC


README

This library provides a Symfony based HttpClient factory for the k8s/client library.

General Use with the K8s library / Configuration Options

  1. Install the library:

composer require k8s/http-symfony

  1. Construct the main client for k8s/client through the K8sFactory:
use K8s\Client\K8sFactory;

# Load the client from the default KubeConfig
$k8s = (new K8sFactory())->loadFromKubeConfig();

Your new client will have all the HttpClient options needed pre-populated when used.

Default HTTP Options Configuration

To specify extra defaults for the Symfony HTTP client, you can construct it like this:

use K8s\HttpSymfony\ClientFactory;
use K8s\Client\K8sFactory;

# Pass any Symfony HTTP client options here.
# The below would allow for self-signed certificates.
$httpFactory = new ClientFactory([
    'verify_peer' => false,
    'verify_host' => false,
]);

$k8s = (new K8sFactory())->loadFromKubeConfig(null, $httpFactory);