brc cic
brc cic
CLI-in-CLI
Synopsis
Several Workloads provide their own format of Command Line Interface (CLI). Running them on Kubernetes, makes these CLIs out of reach. This command provides a way to access these CLIs through a single interface. Furthermore, it allows establishment of shell access to the Workloads.
The option --namespace
by default points to a Kubernetes namespace of the default Kubernetes context. You
may explicitly provide the context in the format of <context-name>.<namespace>
to access the cluster using
particular kubectl
context. The format bare.<machine-name>
is reserved for bare-metal machine
access where SSH is used to access the machine named <machine-name>
. In this case
the <element>
is the name of the Snap package on the target machine and the <command>
is the
name of the corresponding Snap application in that package.
Class 1: run
targets
The run
script located at $ROOT_DIR/run
, according to the Hydra conventions provides some
commands to run that depends on the particular Workload. All the parameters that come after the --
are
passed as space-separated arguments to the run
script, where the first argument is the command to run.
The full command is equivalent to running:
# example 1: brc cic --namespace <namespace> <element> run -- <command> <?parameters>
kubectl exec --namespace <namespace> --interactive --tty <pod> -- $ROOT_DIR/run <command> <?parameters>
# example 2: brc cic --namespace <context>.<namespace> <element> run -- <command> <?parameters>
kubectl --context <context> exec --namespace <namespace> --interactive --tty <pod> -- $ROOT_DIR/run <command> <?parameters>
# example 3: brc cic --namespace bare.<machine-name> <element> run -- <command> <?parameters>
ssh -t <machine-name> sudo <element>.<command> <?parameters>
- This class assumes option
--follow
is provided. There is no need to explicitly mention it. - For the bare-metal machines, if the command is not provided, the default command of the Snap is executed, which by
Hydra conventions is the
main
command. - For the Kubernetes environments, the
<command>
is mandatory by the Hydra conventions.
Class 2: shell
targets
The shell
target executes to the shell environment of the <element>
workload. This shell refers
to Hydra shell (/bin/hsh
) that is provided by the workload. The Hydra shell is a replica to Bash v5.
In case of passing parameters after the --
, they are passed as arguments to the Hydra shell, merged into a
single string and passed via the -c
option. The full command is equivalent to running:
# example 1: brc cic --namespace <namespace> <element> shell
kubectl exec --namespace <namespace> --interactive --tty <pod> -- /bin/hsh
# example 2: brc cic --namespace <namespace> <element> shell -- <command> <?parameters>
kubectl exec --namespace <namespace> --interactive --tty <pod> -- /bin/hsh -c '<command> <?parameters>'
# example 3: brc cic --namespace <context>.<namespace> <element> shell -- <command> <?parameters>
kubectl --context <context> exec --namespace <namespace> --interactive --tty <pod> -- /bin/hsh -c '<command> <?parameters>'
# example 4: brc cic --namespace bare.<machine-name> <element> shell -- <command>
ssh -t <machine-name> sudo snap run --shell <element>.<command>
- This class assumes option
--follow
is provided. There is no need to explicitly mention it. - For the bare-metal machines, the parameters cannot be provided directly to the shell, but a command must be provided.
Class 3: Application redirections
If any other term than run
or shell
is provided, the command assumes that the there is a pipe
named by the $LOGS_DIR/<command>.pipe
inside the container that could be used to send commands to a binary
and the output appears at $LOGS_DIR/<command>.out
which is outputted using tail --follow
command.
- This class does not support bare-metal machines.
- If the container is not running or the pipe is not found, it outputs an error.
- If the option
--follow
is provided, the output is streamed to the console, otherwise the interactive or tty modes would not be activated.
brc cic [flags]
Examples
brc cic --namespace [<?context>.]<namespace> <element> <application> [-- <?command> <?parameters>]
Options
-f, --follow Specify if the logs should be streamed.
-h, --help help for cic
Options inherited from parent commands
-n, --namespace string namespace to perform the operations (default "trirematics")
-v, --verbose debug output
SEE ALSO
- brc - BubbleRAN Commandline