Command Line Interface for IOC Management#

The python project edge-containers-cli is installed as part of the Python section of the initial tutorial Set up a Developer Workstation. It provides a command line function ec with support for:

  • deploying, managing and monitoring IOC and service instances

The CLI is just a thin wrapper around the underlying tools that do the real work:

kubectl:

the command line interface to the Kubernetes APIs

helm:

the command line interface to the Kubernetes Helm package manager

podman/docker:

CLIs for container engines

git:

the git version control system client

ec is useful because it saves typing and provides a consistent interface when working on multiple ec-services repository s. This is because it uses the environment setup by the beamline repo’s environment.sh script. See The Environment Configuration File.

To see the available commands, run ec --help.

It may be instructive to understand the underlying tools and how they are being called. For this reason ec supports a -v option to show the underlying commands being executed. e.g.

(venv) (main) [hgv27681@pc0116 bl47p]$ ec -v ps
kubectl get namespace p47-iocs -o name
helm list -n p47-iocs -o json
kubectl get pods -n p47-iocs -o jsonpath='{range .items[*]}{..labels.app}{","}{..containerStatuses[0].ready}{","}{..containerStatuses[0].restartCount}{","}{.status.startTime}{"\n"}{end}'
             name ready restarts              started namespace app_version
 bl47p-ea-dcam-01  true        0 2024-02-09T12:34:18Z  p47-iocs  2024.2.1b2
 bl47p-ea-dcam-02  true        0 2024-02-09T15:10:06Z  p47-iocs    2024.2.1
bl47p-ea-panda-01  true        0 2024-02-09T21:57:23Z  p47-iocs  2024.2.1b2
  bl47p-mo-ioc-01  true        0 2024-02-09T15:42:24Z  p47-iocs    2024.2.1
       epics-opis  true        0 2024-02-09T21:55:21Z  p47-iocs    2024.2.2
(venv) (main) [hgv27681@pc0116 bl47p]$