k8s v0.5.2 K8s.Middleware

Interface for interacting with cluster middleware

While middlewares are applied to K8s.Middleware.Requests they are registerd by a cluster name which is an atom.

This allows multiple connections to be used (different credentials) with the same middleware stack.

Any cluster name that has not been initialized, will automatically have the default stack applied.

Examples

Using default middleware

iex> conn = %K8s.Conn{}
...> req = %K8s.Middlware.Request{}
...> K8s.Middleware.run(req)

Adding middlware to a cluster

iex> conn = %K8s.Conn{cluster_name: :foo}
...> K8s.Middleware.add(:foo, :request, MyMiddlewareModule)
...> req = %K8s.Middlware.Request{}
...> K8s.Middleware.run(req)

Setting/Replacing middleware on a cluster

iex> conn = %K8s.Conn{cluster_name: :foo}
...> K8s.Middleware.set(:foo, :request, [MyMiddlewareModule, OtherModule])
...> req = %K8s.Middlware.Request{}
...> K8s.Middleware.run(req)

Link to this section Summary

Types

Middleware type

Functions

Applies middlewares registered to a K8s.Cluster to a K8s.Middleware.Request

Link to this section Types

Link to this type

type_t()

type_t() :: :request | :response

Middleware type

Link to this section Functions

Applies middlewares registered to a K8s.Cluster to a K8s.Middleware.Request