pypz.operators.k8s module

class pypz.operators.k8s.KubernetesOperator(name: str = None, *args, **kwargs)

Bases: Operator, ABC

__context: Instance

Reference to the context aka parent object. Derived automatically in the override implementation of __setattr__.

__depends_on: set

Set of other instances that is this instance depending on. Note however that the type of the dependencies are checked dynamically in runtime, since dependencies can only be defined on the same type of instance.

__expected_parameters: dict[str, ExpectedParameter]

Map of expected parameters defined as descriptor of the class. Key is the name of the parameter, value is the parameter descriptor. Used to check, if an expected (described) parameter value shall be set upon instance parameter setting.

__full_name: str

Full name of the instance which uniquely identifies it up to its topmost context. For example, if an instance A has a parent context B, which has a parent context C, then the full name of A is ‘C.B.A’. This value is calculated and the result is stored after the first calculation to avoid recalculation every time.

__logger: ContextLogger

Context logger. For more information refer to Operator.Logger class

__logger_plugins: set[LoggerPlugin]

Collection of logger addons to store for context logging

__nested_instance_type: Type[NestedInstanceType] | None

Stores the specified type of the nested instances. This is required to be able to discover those instances

__nested_instances: dict[str, NestedInstanceType]

This dictionary holds all the instances that are nested in the context of this instance object

__parameters: dict

The interpreted instance parameters i.e., cascading and templates are interpreted

__replicas: list[Operator.Replica]

List of replica instances

__replication_group_index: int

Specifies the group index, if the operator is replicated.

__replication_origin: Operator | None

Reference to the original instance, which was the base for the replication

__simple_name: str

Name of the instance, which is represented by the object created from the implementation class. If not provided and there is a parent context, then the parent context will use the name of the variable.

__spec_classes: set

Set of specs classes that are in the class hierarchy i.e., which specs classes are contributing to the implementation of this class

__spec_name: str

The name of the spec constructed of module and qualified class name. Notice that we separate the module name and the class name so that we can identify them at loading by name.

_abc_impl = <_abc._abc_data object>
_operator_image_name: str | None

PARAMETER - Name of the docker image, where the operator can be found. This is optional for the execution, but is required at deployment.

_replication_factor: int

PARAMETER - The replication factor specifies, how many replicas shall be created along the original instance.

container_security_context

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

containers

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

env

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

env_from

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

health_check

Including health check plugin by default.

host_affinity

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

host_anti_affinity

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

image_pull_policy

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

labels

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

liveness_probe

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

node_affinity

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

node_anti_affinity

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

node_selector

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

pod_security_context

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

readiness_probe

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

resources

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

restart_policy

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

service_account_name

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

startup_probe

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

termination_grace_period_seconds

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

tolerations

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

volume_mounts

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update

volumes

Convenience class to represent an optional parameter Usage:

class TestImpl(Instance):
    required_param = RequiredParameter(str)
    optional_param = OptionalParameter(str)
    def __init__(self):
        self.required_param = None
        self.optional_param = "defaultValue"
Parameters:
  • parameter_type – (str, int, float, set, list, dict, type(None))

  • alt_name – alternative name for the parameter, if specified it acts as reference to the parameter

  • on_update – callback to react on value update