PYTEST_HELM_CHARTS.CLUSTERS
This module introduces classes for handling different clusters.
Cluster(kube_config_path)— Represents an abstract cluster.</>ExistingCluster— Implementation of Cluster that uses kube.config file to connect to external existing cluster.</>
pytest_helm_charts.clusters.Cluster(kube_config_path=None)
Represents an abstract cluster.
kube_config_path(str, optional) —
_kube_client—kube_client(HTTPClient, optional) — Returns the HTTP client you can use to access Kubernetes API of the cluster under test.
Please refer to pykube to get docs for HTTPClient.</>kube_config_path—
create()(HTTPClient) — Creates an instance of a cluster and returns HTTPClient to connect to it.</>destroy()— Destroys the cluster created earlier with a call to create.</>kubectl(subcmd_string,std_input,output_format,use_shell,**kwargs)(str) — Execute command by running 'kubectl' binary.</>
create() → HTTPClient
Creates an instance of a cluster and returns HTTPClient to connect to it.
kubectl(subcmd_string, std_input='', output_format='json', use_shell=False, **kwargs)
Execute command by running 'kubectl' binary.
If your cluster delivers the kube.config file, run a kubectl command against the cluster and return the output. Otherwise, exception is raised.
subcmd_string(str) — Command to run, like "delete pod abc"std_input(str) — Use this to pass a manifest file directly as a string (results in 'kubectl [cmd] -f -')output_format(str) — Option "--output" as passed to 'kubectl'. Default is 'json', make sure to change to "" for commands that don't return JSON.use_shell(bool, optional) — Whether the 'kubectl' command should be invoked directly (when 'False') or wrapped in system shell ('True'). 'False' by default.**kwargs(str) —kwargs— arbitrary dictionary of options and values that will be passed directly to 'kubectl'
The output printed by 'kubectl', if the command succeeded (exit code was 0)
subprocess.CalledProcessError— If the command exited with non-zero exit code
pytest_helm_charts.clusters.ExistingCluster(kube_config_path)
Implementation of Cluster that uses kube.config file to connect to external existing cluster.
kube_config_path(str) —
_kube_client—kube_client(HTTPClient, optional) — Returns the HTTP client you can use to access Kubernetes API of the cluster under test.
Please refer to pykube to get docs for HTTPClient.</>kube_config_path—
create()(HTTPClient) — Creates an instance of a cluster and returns HTTPClient to connect to it.</>destroy()— Destroys the cluster created earlier with a call to create.</>kubectl(subcmd_string,std_input,output_format,use_shell,**kwargs)(str) — Execute command by running 'kubectl' binary.</>
kubectl(subcmd_string, std_input='', output_format='json', use_shell=False, **kwargs)
Execute command by running 'kubectl' binary.
If your cluster delivers the kube.config file, run a kubectl command against the cluster and return the output. Otherwise, exception is raised.
subcmd_string(str) — Command to run, like "delete pod abc"std_input(str) — Use this to pass a manifest file directly as a string (results in 'kubectl [cmd] -f -')output_format(str) — Option "--output" as passed to 'kubectl'. Default is 'json', make sure to change to "" for commands that don't return JSON.use_shell(bool, optional) — Whether the 'kubectl' command should be invoked directly (when 'False') or wrapped in system shell ('True'). 'False' by default.**kwargs(str) —
The output printed by 'kubectl', if the command succeeded (exit code was 0)
subprocess.CalledProcessError— If the command exited with non-zero exit code
create() → HTTPClient
Creates an instance of a cluster and returns HTTPClient to connect to it.