Config CLI
When the startscript
gets executed for a lifecycle event it will usually need to retrieve metadata about the environment so that you can control how the script reacts to the event.
The Config CLI allows you to retrieve metadata.
/etc/guestconfig/configmeta.json
The metadata can be found in the pods in /etc/guestconfig/configmeta.json
.
Exploring the Config CLI
I wasn't able to find documentation on the Config CLI so let's do some exploring.
Config CLI
The Config CLI is installed automatically in containers that have a config package.
If this exercise we use the Centos 7 KubeDirectorCluster running from the previous lesson that has a config package defined:
You should still have your KubeDirectorCluster
running from the previous lesson if not, start it now.
Next open a shell session on the cluster:
Now execute the configcli application:
From here you can explore the help:
And ...
You can then retrieve specific information:
When we are done we can exit:
info
If some of the configcli commands do not work as expected, it could be due to the following issue
Using from a shell script
From a shell appconfig script (e.g. startscript) you can call the configcli directly, e.g.
Using from a Python script
info
App config scripts (e.g. startscript) can also be written in Python.
Information on writing startscript in Python is an advanced topic and will be covered later.
Exercise
Update the startscript from the previous lesson to use the configcli in some way.
References
- Config CLI source code