One of the key pieces of information for users from juju status
is the application version. Taking Mattermost as an example I ran the following to deploy it on a model provisioned in MicroK8s:
juju deploy cs:~mattermost-charmers/mattermost
juju deploy cs:~postgresql-charmers/postgresql-k8s
juju relate mattermost postgresql:db
This gives a juju status
that looks something like this:
Model Controller Cloud/Region Version SLA Timestamp
mattermost microk8s-localhost microk8s/localhost 2.9-rc10 unsupported 09:06:38+02:00
App Version Status Scale Charm Store Channel Rev OS Address Message
mattermost mattermost:v5.33.3-20.04_edge active 1 mattermost charmstore stable 21 kubernetes 10.152.183.7
postgresql registry.jujucharms.com/pos... active 1 postgresql-k8s charmstore stable 11 kubernetes
Unit Workload Agent Address Ports Message
mattermost/1* active idle 10.1.234.22 8065/TCP
postgresql/0* active idle 10.1.234.20 5432/TCP Pod configured
Relation provider Requirer Interface Type Message
postgresql:db mattermost:db pgsql regular
postgresql:peer postgresql:peer peer peer
Itās very easy to see the version of Mattermost being run from this output (v5.33.3-20.04_edge).
As we move towards the sidecar pattern for charms Iām wondering how we display similar information. Iāve got a proof of concept version of the Mattermost charm using the sidecar pattern, and deployed it locally for testing as follows:
git checkout -b sidecar https://git.launchpad.net/~mthaddon/charm-k8s-mattermost/+git/charm-k8s-mattermost
cd charm-k8s-mattermost
charmcraft build
juju deploy ./mattermost.charm --resource mattermost-image=mattermostcharmers/mattermost:v5.33.3-20.04_edge
juju deploy cs:~postgresql-charmers/postgresql-k8s
juju relate mattermost postgresql:db
Doing that gives me (after a little while) the following from juju status
:
Model Controller Cloud/Region Version SLA Timestamp
mattermost microk8s-localhost microk8s/localhost 2.9-rc10 unsupported 08:51:53+02:00
App Version Status Scale Charm Store Channel Rev OS Address Message
mattermost active 1 mattermost local 0 ubuntu
postgresql registry.jujucharms.com/pos... active 1 postgresql-k8s charmstore stable 11 kubernetes
Unit Workload Agent Address Ports Message
mattermost/0* active idle 10.1.234.18
postgresql/0* active idle 10.1.234.20 5432/TCP Pod configured
Relation provider Requirer Interface Type Message
postgresql:db mattermost:db pgsql regular
postgresql:peer postgresql:peer peer peer
There are two problems that jump out here. The first one is that the app version for PostgreSQL is reported as registry.jujucharms.com/posā¦
which is not very user friendly. This is because the charm is configured with a resource for the docker image, and that resource is uploaded to registry.jujucharms.com as part of the publishing process. This isnāt a problem we need to worry about for too long though, because this charm doesnāt use the sidecar pattern, and at some point in the future will be adapted to that.
However, thereās another problem, which is that thereās no app version reported for Mattermost at all. I believe this is something that can be set via charm code, but how can the charm code know what version of Mattermost is running, especially given that someone can change the image resource used at deploy time? Is there a way to query the image for a particular container? I donāt think there is, so Iāve filed https://github.com/canonical/operator/issues/509.
Also, what happens when this is uploaded to charmhub and a resource is attached in terms of the image location and displaying that in a useful way to end users? Currently if I look at the image for postgresql in this model, which uses a resource that was uploaded to the charmstore, I get an image location of registry.jujucharms.com/postgresql-charmers/postgresql-k8s/postgresql-image@sha256:3046a3dc76ee23417f889675bce3a4c08f223b87d1e378eeea3e7490cd27fbc5
. How do we translate that into something thatās useful to end users?