kubernetes_asyncio.utils.create_from_yaml module

exception kubernetes_asyncio.utils.create_from_yaml.FailToCreateError(api_exceptions: list[ApiException])

Bases: ApiException

An exception class for handling error if an error occurred when handling a yaml file.

async kubernetes_asyncio.utils.create_from_yaml.create_from_dict(k8s_client: ApiClient, data: dict, verbose: bool = False, namespace: str = 'default', **kwargs: Any) Any

Perform an action from a yaml file. Pass True for verbose to print confirmation information. Input: yaml_file: string. Contains the path to yaml file. data: a dictionary holding valid kubernetes objects verbose: If True, print confirmation from the create action.

Default is False.

namespace: string. Contains the namespace to create all

resources inside. The namespace must preexist otherwise the resource creation will fail. If the API object in the yaml file already contains a namespace definition this parameter has no effect.

Returns: An k8s api object or list of apis objects created from dict. When a single object is generated, return type is dependent on output_list. Throws a FailToCreateError exception if creation of any object fails with helpful messages from the server. Available parameters for creating <kind>: :param async_req bool :param bool include_uninitialized: If true, partially initialized

resources are included in the response.

Parameters:
  • pretty (str) – If ‘true’, then the output is pretty printed.

  • dry_run (str) – When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

async kubernetes_asyncio.utils.create_from_yaml.create_from_yaml(k8s_client: ApiClient, yaml_file: str, verbose: bool = False, namespace: str = 'default', **kwargs: Any) Any

Perform an action from a yaml file. Pass True for verbose to print confirmation information. Input: yaml_file: string. Contains the path to yaml file. k8s_client: an ApiClient object, initialized with the client args. verbose: If True, print confirmation from the create action.

Default is False.

namespace: string. Contains the namespace to create all

resources inside. The namespace must preexist otherwise the resource creation will fail. If the API object in the yaml file already contains a namespace definition this parameter has no effect.

Returns: An k8s api object or list of apis objects created from YAML. When a single object is generated, return type is dependent on output_list. Throws a FailToCreateError exception if creation of any object fails with helpful messages from the server. Available parameters for creating <kind>: :param async_req bool :param bool include_uninitialized: If true, partially initialized

resources are included in the response.

Parameters:
  • pretty (str) – If ‘true’, then the output is pretty printed.

  • dry_run (str) – When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

async kubernetes_asyncio.utils.create_from_yaml.create_from_yaml_single_item(k8s_client: ApiClient, yml_object: dict, verbose: bool = False, namespace: str = 'default', **kwargs: Any) Any