k8s v0.2.12 K8s.Client.Runner.Base
Base HTTP processor for K8s.Client
Link to this section Summary
Link to this section Types
Link to this type
result_t()
Link to this section Functions
Link to this function
encode(body, http_method)
Link to this function
run(operation, cluster_name \\ :default)
run(operation, cluster_name \\ :default)
run(K8s.Operation.t(), atom() | nil) :: result_t()
run(K8s.Operation.t(), atom() | nil) :: result_t()
Runs a K8s.Operation
.
Examples
Note: Examples assume a cluster was registered named :test_cluster, see K8s.Cluster.register/2
.
Running a list pods operation:
operation = K8s.Client.list("v1", "Pod", namespace: :all)
{:ok, %{"items" => pods}} = K8s.Client.run(operation, :test_cluster)
Running a dry-run of a create deployment operation:
deployment = %{
"apiVersion" => "apps/v1",
"kind" => "Deployment",
"metadata" => %{
"labels" => %{
"app" => "nginx"
},
"name" => "nginx",
"namespace" => "test"
},
"spec" => %{
"replicas" => 2,
"selector" => %{
"matchLabels" => %{
"app" => "nginx"
}
},
"template" => %{
"metadata" => %{
"labels" => %{
"app" => "nginx"
}
},
"spec" => %{
"containers" => %{
"image" => "nginx",
"name" => "nginx"
}
}
}
}
}
operation = K8s.Client.create(deployment)
# opts is passed to HTTPoison as opts.
opts = [params: %{"dryRun" => "all"}]
:ok = K8s.Client.Runner.Base.run(operation, :test_cluster, opts)
Link to this function
run(operation, cluster_name, opts)
run(operation, cluster_name, opts)
run(K8s.Operation.t(), binary() | atom(), keyword()) :: result_t()
run(K8s.Operation.t(), binary() | atom(), keyword()) :: result_t()
Run an operation and pass opts
to HTTPoison.
See run/2
Link to this function
run(operation, cluster_name, body, opts \\ [])
run(operation, cluster_name, body, opts \\ [])
run(K8s.Operation.t(), atom(), map(), keyword()) :: result_t()
run(K8s.Operation.t(), atom(), map(), keyword()) :: result_t()
Run an operation with an alternative HTTP Body (map) and pass opts
to HTTPoison.
See run/2