Hi all, fresh out of the CI-press, the jhack snap offers on edge a new set of commands: `jhack imatrix`

.

The purpose of these commands is to manage and visualize many relations at once in your models. Suppose you have a large model, like kubeflow, where tens of charms are cross-related in complex ways. And suppose you are debugging the bundle and the relations and you want to quickly cross-relate all things relatable or, vice versa, quickly get rid of all relations at once without touching the applications.

Another situation is where you are exploring a bundle, or just deploy several bundles or applications individually, and you wish to ask ‘what could I relate with what?’

# jhack imatrix view

This command will pretty-print the Integration Matrix (`imatrix`

for friends) of the applications available in your model. It will take the directionality of the relation into account: the Y axis presents the providers, and the X axis contains the requirers. Every application will appear on both axis, and the diagonal will always be empty: juju does not allow relating applications with themselves – if not with peer relations, that cannot just be switched off and on at will.

Let’s try this out with `cos-lite`

, which just went GA. No better way to poke some holes in a fresh bundle than to flood it intermittently with `relation-created`

/`relation-removed`

hooks. No way this can go wrong.

By running `imatrix view`

after deploying `cos-lite`

we get something like:

There’s a lot of charms, so the matrix gets large quickly. The command also supports `include`

and `exclude`

flags to limit the range of applications to be cross-checked.

We can put this command on a watch with the `watch`

flag, so it will keep updating in the background.
One of the most useful things about this command is that it will not only show which relations are there at this specific moment in time, but also those relations which are not there, but could be. So if we nuke `prometheus:grafana-*`

, we’ll get:

So we are well aware that some integrations are missing, and which ones.

# jhack imatrix fill

With `jhack imatrix fill`

we can collect all possible relations which are currently not active, and flip them to active. After running this command, the matrix should go back to its original, all-green state.

# jhack imatrix clear

With `jhack imatrix clear`

we can collect all currently active relations and nuke them. After running this command, the matrix should go to an all-red, fully unrelated state. The only relations surviving this operation should be the peer-type ones.

# Having fun with cos lite

Just for fun, what happens if you repeatedly do:
`jhack imatrix clear;jhack imatrix fill`

?

Go and try it out