lib/containers/k8s.pm

install_k3s Deploy k3s using k3s-install script that is either pulled from upstream or distro

uninstall_k3s Uninstalls k3s

install_kubectl Installs kubectl from the respositories

install_helm Installs helm from our upstream or repositories

apply_manifest Apply a kubernetes manifest

wait_for_k8s_job_complete Wait until the job is complete

wait_for_pod_ready

wait_for_pod_ready(labels => "app=myapp", timeout => 60, delay => 12, retry => 5)
wait_for_pod_ready(pod_name => "myapp-12345", timeout => 60, delay => 12, retry => 5)

Waits until the Pod is in Ready status. You can specify either a label selector or the full Pod name.

find_pods Find pods using kubectl queries

validate_pod_logs Validates that the logs contains a text

get_pod_name

Gets the full Pod name based on a Label and the Value of that Label.
e.g. get_pod_logs("component", "nginx")

We are getting the Pods by label instead of other methods as that makes it re-usable regardless of
Workload type, e.g. Deployments, StatefulSets, Jobs and etc. 

get_pod_logs

get_pod_logs($pod_name)
e.g. get_pod_logs("postgrest-7f9d46ff77-87hj4")

Gets the logs from a Pod running on Kubernetes and uploads them to the OpenQA Job.

get_namespace_events

Gets the Events from the currently active Kubernetes Namespace and uploads them to the OpenQA Job.

gather_k8s_logs

gather_k8s_logs($label, @list_of_components)

Gets Events, general Pod status and specific Pod logs and uploads them to the OpenQA Job.

dump_k3s_debug_info

dump_k3s_debug_info()

Dumps k3s and kubectl status and logs for debugging purposes.