KubernetesError#

exception controller.exceptions.KubernetesError(message, *, user=None, kind=None, namespace=None, name=None, status=None, body=None)#

Bases: SlackException

An API call to Kubernetes failed.

Parameters:
  • message (str) – Summary of error.

  • user (str | None, default: None) – Username on whose behalf the request is being made.

  • namespace (str | None, default: None) – Namespace of object being acted on.

  • name (str | None, default: None) – Name of object being acted on.

  • kind (str | None, default: None) – Kind of object being acted on.

  • status (int | None, default: None) – Status code of failure, if any.

  • body (str | None, default: None) – Body of failure message, if any.

classmethod from_exception(message, exc, *, user=None, kind=None, namespace=None, name=None)#

Create an exception from a Kubernetes API exception.

Parameters:
  • message (str) – Brief explanation of what was being attempted.

  • exc (ApiException) – Kubernetes API exception.

  • user (str | None, default: None) – User on whose behalf the operation was being performed.

  • kind (str | None, default: None) – Kind of object being acted on.

  • namespace (str | None, default: None) – Namespace of object being acted on.

  • name (str | None, default: None) – Name of object being acted on.

Returns:

Newly-created exception.

Return type:

KubernetesError

to_slack()#

Convert to a Slack message for Slack alerting.

Returns:

Slack message suitable for posting as an alert.

Return type:

safir.slack.blockkit.SlackMessage