I feel like maybe this isn’t a proper use-case, but is there any reason not to store a 224kb base-64 encoded string in a Juju relation key?
I’ve got a directory containing the config for acme.sh that I need to propagate to the other units by the leader. I was thinking of just doing leader-set "acme-config=$(tar -cz .acme.sh | base64)".
I thought that resources could only be set by the user deploying the charm. In this case the value needs to be set by the leader unit, not the user/charm store.
I wonder if this is a good use-case for charm-controlled resources, actually. If it doesn’t already exist.
The size shouldn’t really increase a lot because the only thing going in there now is essentially SSL certificates and a little bit of config data. Even if you have a lot more certs I would hope that the gzip compression will help reduce the impact, but I’ll have to test it.
As a point of comparison, the easyrsa charm sends certificates via relation data:
def create_global_client_cert():
# ...
client_cert = leader_get('client_certificate')
client_key = leader_get('client_key')
if not client_cert or not client_key:
hookenv.log("Unable to find global client cert on "
"leadership data, generating...")
client_cert, client_key = create_client_certificate()
# Set the client certificate and key on leadership data.
leader_set({'client_certificate': client_cert})
leader_set({'client_key': client_key})