View Source Datapio.K8s.Event (Datapio OpenCore v0.1.0)

This module allows you to create and publish custom Kubernetes Events. For more information about the Event spec, please read this reference.

Usage example:

alias Datapio.K8s.Event

{:ok, conn} = Datapio.K8s.Conn.lookup()
operation = K8s.Client.get("apps/v1", :deployment, [namespace: "default", name: "nginx-deployment"])
{:ok, deployment} = K8s.Client.run(conn, operation)

Event.new(name: "some-prefix", namespace: "default")
  |> Event.action("notify")
  |> Event.reporting_controller("my-app")
  |> Event.reporting_instance("my-app-0")
  |> Event.regarding(deployment)
  |> Event.type(:normal)
  |> Event.reason("TestMessage")
  |> Event.message("This is an example")
  |> Event.time(:now)
  |> Event.publish(conn)

Link to this section Summary

Types

Represent a partial Kubernetes Event (not publishable yet)

t()

Represent a Kubernetes Event

Functions

Specify what action was taken/failed

Specify the message describing this event

Create a new event

Publish the event to Kubernetes

Specify the reason of the event

Specify the object this event is about

Specify a secondary object this event is related to

Specify the name of the controller that emitted this Event

Specify the ID of the controller instance

Specify the time at which the event was first observed

Specify the type of the event

Link to this section Types

Specs

partial() :: t()

Represent a partial Kubernetes Event (not publishable yet)

Specs

Represent a Kubernetes Event

Link to this section Functions

Specs

action(partial(), String.t()) :: partial()

Specify what action was taken/failed

Specs

message(partial(), String.t()) :: partial()

Specify the message describing this event

Specs

new(name: String.t(), namespace: String.t()) :: partial()

Create a new event

Specs

publish(t(), K8s.Conn.t()) :: {:ok, any()} | {:error, term()}

Publish the event to Kubernetes

Specs

reason(partial(), String.t()) :: partial()

Specify the reason of the event

Link to this function

regarding(event, resource)

View Source

Specs

regarding(partial(), Datapio.K8s.Resource.t()) :: partial()

Specify the object this event is about

Link to this function

related(event, resource)

View Source

Specs

Specify a secondary object this event is related to

Link to this function

reporting_controller(event, name)

View Source

Specs

reporting_controller(partial(), String.t()) :: partial()

Specify the name of the controller that emitted this Event

Link to this function

reporting_instance(event, name)

View Source

Specs

reporting_instance(partial(), String.t()) :: partial()

Specify the ID of the controller instance

Specs

time(partial(), :now | DateTime.t()) :: partial()

Specify the time at which the event was first observed

Specs

type(partial(), :normal | :warning) :: partial()

Specify the type of the event