Skip to content

Types

lightkube.types

OnErrorHandler = typing.Callable[[Exception, int], OnErrorResult] module-attribute

CascadeType

Bases: Enum

Attributes:

  • ORPHAN

    orphan the dependents

  • BACKGROUND

    allow the garbage collector to delete the dependents in the background

  • FOREGROUND

    a cascading policy that deletes all dependents in the foreground

BACKGROUND = 'Background' class-attribute instance-attribute

FOREGROUND = 'Foreground' class-attribute instance-attribute

ORPHAN = 'Orphan' class-attribute instance-attribute

ExecResponse

Bases: NamedTuple

Response from an exec command, containing stdout, stderr and exit code.

Attributes:

  • stdout (Optional[Union[str, bytes]]) –

    The command's stdout, if captured.

  • stderr (Optional[Union[str, bytes]]) –

    The command's stderr, if captured.

  • exit_code (int) –

    The command's exit code.

exit_code: int = 0 class-attribute instance-attribute

stderr: Optional[Union[str, bytes]] = None class-attribute instance-attribute

stdout: Optional[Union[str, bytes]] = None class-attribute instance-attribute

OnErrorAction

Bases: Enum

Attributes:

  • RETRY

    Retry to perform the API call again from the last version

  • STOP

    Stop silently the iterator

  • RAISE

    Raise the error on the caller scope

RAISE = 2 class-attribute instance-attribute

RETRY = 0 class-attribute instance-attribute

STOP = 1 class-attribute instance-attribute

OnErrorResult(action: OnErrorAction, sleep: float = 0) dataclass

action: OnErrorAction instance-attribute

sleep: float = 0 class-attribute instance-attribute

PatchType

Bases: Enum

Attributes:

APPLY = 'application/apply-patch+yaml' class-attribute instance-attribute

JSON = 'application/json-patch+json' class-attribute instance-attribute

MERGE = 'application/merge-patch+json' class-attribute instance-attribute

STRATEGIC = 'application/strategic-merge-patch+json' class-attribute instance-attribute

on_error_raise(e: Exception, count: int) -> OnErrorResult

Raise the error on the caller scope

Source code in src/lightkube/types.py
57
58
59
def on_error_raise(e: Exception, count: int) -> OnErrorResult:
    """Raise the error on the caller scope"""
    return OnErrorResult(OnErrorAction.RAISE)

on_error_retry(e: Exception, count: int) -> OnErrorResult

Retry to perform the API call again from the last version

Source code in src/lightkube/types.py
67
68
69
def on_error_retry(e: Exception, count: int) -> OnErrorResult:
    """Retry to perform the API call again from the last version"""
    return OnErrorResult(OnErrorAction.RETRY)

on_error_stop(e: Exception, count: int) -> OnErrorResult

Stop silently the iterator

Source code in src/lightkube/types.py
62
63
64
def on_error_stop(e: Exception, count: int) -> OnErrorResult:
    """Stop silently the iterator"""
    return OnErrorResult(OnErrorAction.STOP)