pypz.deployers.k8s module

exception pypz.deployers.k8s.DeploymentConflictException

Bases: Exception

exception pypz.deployers.k8s.DeploymentException

Bases: Exception

exception pypz.deployers.k8s.DeploymentNotFoundException

Bases: Exception

class pypz.deployers.k8s.KubernetesDeployer(namespace: str = 'default', configuration: Configuration = None, config_file: Any = None)

Bases: Deployer

_abc_impl = <_abc._abc_data object>
_env_var_operator_exec_mode = 'PYPZ_OPERATOR_EXEC_MODE'
_env_var_operator_name = 'PYPZ_OPERATOR_INSTANCE_NAME'
_generate_pod_manifest(operator: Operator, execution_mode: ExecutionMode) dict
_label_key_exec_mode = 'pypz.io/exec-mode'
_label_key_instance_name = 'pypz.io/instance-name'
_label_key_instance_type = 'pypz.io/instance-type'
_label_key_part_of = 'pypz.io/part-of'
_label_value_operator = 'operator'
_label_value_pipeline = 'pipeline'
_pipeline_config_secret_key = 'pipeline-config'
_retrieve_config_secret(pipeline_name: str) V1Secret | None
_retrieve_deployed_pipeline_from_secret(secret: V1Secret) Pipeline | None
_retrieve_operator_pod(operator_full_name: str) V1Pod | None
_retrieve_operator_pods(pipeline_name: str) list[V1Pod]
deploy(pipeline: Pipeline, execution_mode: ExecutionMode = ExecutionMode.Standard, ignore_operators: list[Operator] = None, wait: bool = True) None

Shall implement the logic to deploy a pipeline by its instance.

Parameters:
  • pipeline – pipeline instance to be deployed

  • execution_mode – execution mode of the operators (check ExecutionMode for details)

  • ignore_operators – list of operator instance to be excluded from the deployment

  • wait – True - block until completion; False - don’t block until completion

destroy(pipeline_name: str, force: bool = False, wait: bool = True) None

Shall implement the logic to destroy a pipeline by its name.

Parameters:
  • pipeline_name – name of the deployed pipeline entity

  • force – True - kill without grace period; False - with grace period

  • wait – True - block until completion; False - don’t block until completion

destroy_operator(operator_full_name: str, force: bool = False, wait: bool = True) None

Shall implement the logic to destroy a single operator by its name.

Parameters:
  • operator_full_name – full name of the deployed operator

  • force – True - kill without grace period; False - with grace period

  • wait – True - block until completion; False - don’t block until completion

is_deployed(pipeline_name: str) bool

Shall implement the logic to check, if a pipeline with the specified name has been deployed.

Parameters:

pipeline_name – name of the pipeline to check

Returns:

True, if deployed, False if not

restart_operator(operator_full_name: str, force: bool = False, wait: bool = True)

Shall implement the logic to restart a single operator in a pipeline by its name. If the operator does not exist, it shall rather create it without throwing an exception.

Parameters:
  • operator_full_name – full name of the deployed operator

  • force – True - kill without grace period; False - with grace period

  • wait – True - block until completion; False - don’t block until completion

retrieve_deployed_pipeline(pipeline_name: str) Pipeline | None

Shall implement the logic to retrieve and create the deployed pipeline instance by its name.

Parameters:

pipeline_name – name of the pipeline

Returns:

Pipeline object, if existing, None if not existing

retrieve_operator_logs(operator_full_name: str, **kwargs) str | None

Shall implement the logic to retrieve the logs from a deployed operator by its name.

Parameters:

operator_full_name – full name of the deployed operator

Returns:

operator logs as string

retrieve_operator_state(operator_full_name: str) DeploymentState

Shall implement the logic to retrieve the state of a single operator by its name.

Parameters:

operator_full_name – full name of the deployed operator

Returns:

check DeploymentState for details

retrieve_pipeline_deployments() set[str]

Shall implement the logic to get the names of all deployed pipelines.

Returns:

set of names of the deployed pipelines

static sanitize(string: str) str
class pypz.deployers.k8s.KubernetesParameter(imagePullPolicy: str | None = None, restartPolicy: str | None = None, env: list[dict] | None = None, envFrom: list[dict] | None = None, volumeMounts: list[dict] | None = None, containers: list[dict] | None = None, volumes: list[dict] | None = None, terminationGracePeriodSeconds: int | None = None, serviceAccountName: str | None = None, labels: dict | None = None, containerSecurityContext: dict | None = None, podSecurityContext: dict | None = None, hostAffinity: dict | None = None, hostAntiAffinity: dict | None = None, nodeAffinity: dict | None = None, nodeSelector: dict | None = None, tolerations: list | None = None, nodeAntiAffinity: dict | None = None)

Bases: object

This class represents all Pod fields that can be updated via instance parameters