View Source K8s.Middleware (k8s v2.4.2)

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)

Summary

Functions