Tango control subpackage with Kubernetes support (ska_tangoctl.tango_kontrol)

Read and display Kubernetes and Tango stuff.

class ska_tangoctl.tango_kontrol.TangoKontrol(logger: Logger, k8s_ctx: str | None, k8s_cluster: str | None, domain_name: str | None)[source]

Read Tango devices running in a Kubernetes cluster.

__init__(logger: Logger, k8s_ctx: str | None, k8s_cluster: str | None, domain_name: str | None)[source]

Initialize this thing.

Parameters:
  • logger – logging handle

  • k8s_ctx – Kubernetes context

  • k8s_cluster – Kubernetes

  • domain_name – Kubernetes domain name

__repr__() str[source]

Do the string thing.

Returns:

string representation

get_contexts_dict() dict[source]

Read contexts/clusters in Kubernetes.

Returns:

dictionary with host and context names

get_contexts_list() tuple[source]

Read contexts/clusters in Kubernetes.

Returns:

tuple with host and context names

get_namespaces_dict() dict[source]

Read namespaces in Kubernetes cluster.

Returns:

dictionary with devices

get_namespaces_list() tuple[source]

Read namespaces in Kubernetes cluster.

Returns:

tuple with context name, cluster name and list with devices

get_pods_dict(ns_name: str | None) dict[source]

Read pods in Kubernetes namespace.

Parameters:

ns_name – namespace name

Returns:

dictionary with devices

get_pods_json(ns_name: str | None, pod_cmd: str) list[source]

Read pods in Kubernetes namespace.

Parameters:
  • ns_name – namespace name

  • pod_cmd – command to run on pod

Returns:

dictionary with pod information

list_pod_names(ns_name: str | None) int[source]

Display pods in Kubernetes namespace.

Parameters:

ns_name – namespace name

Returns:

error condition

pod_run_cmd(k8s: KubernetesInfo, ns_name: str, pod_name: str, pod_cmd: str) dict[source]

Run a command in specified pod.

Parameters:
  • k8s – K8S info handle

  • ns_name – namespace

  • pod_name – pod name

  • pod_cmd – command to run

Returns:

dictionary with output information

print_k8s_info() None[source]

Print kubernetes context and namespace.

print_pod(ns_name: str | None, pod_name: str | None, pod_cmd: str) int[source]

Display pods in Kubernetes namespace.

Parameters:
  • ns_name – namespace name

  • pod_name – pod name

  • pod_cmd – command to run

Returns:

error condition

print_pod_procs() int[source]

Print processes running in pod.

Returns:

error condition

print_pods(ns_name: str | None, pod_cmd: str) int[source]

Display pods in Kubernetes namespace.

Parameters:
  • ns_name – namespace name

  • pod_cmd – command to run

Returns:

error condition

read_config() None[source]

Read configuration.

read_tango_host(ntango: int, ntangos: int) int[source]

Read info from Tango host.

Parameters:
  • ntango – index number,

  • ntangos – index count

Returns:

error condition

reset() None[source]

Reset it to defaults.

run_info() int[source]

Read information on Tango devices.

Returns:

error condition

show_contexts() int[source]

Display contexts in Kubernetes.

Returns:

error condition

show_namespaces() int[source]

Display namespaces in Kubernetes cluster.

Returns:

error condition

show_pod(pod_cmd: str) int[source]

Display pods in Kubernetes namespace.

Parameters:

pod_cmd – command to run

Returns:

error condition

show_pod_log() int[source]

Read pod logs.

Returns:

error condition

show_pods(pod_cmd: str) int[source]

Display pods in Kubernetes namespace.

Parameters:

pod_cmd – command to run

Returns:

error condition

show_services() int[source]

Display services in Kubernetes namespace.

Returns:

error condition