Is There a Size Limit on Juju Relation Key-Value Pairs?

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)".

Would a resource not be an option in your use-case?

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.

Ah, I figured out how to take the directory size down from 224kb to 12.9kb. That isn’t that bad size-wise.

As far as I’m aware, there isn’t a size limit that Juju imposes. However that doesn’t mean that storing huge blobs is a good idea.

Perhaps worth actually doing some testing on this, but I wouldn’t expect to see any real impact with something < 100k.

1 Like

OK, cool. Thanks.

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})

From
https://github.com/charmed-kubernetes/layer-easyrsa/blob/adb63e6deffb9389eae69290388c70c5bae869b3/reactive/easyrsa.py#L254-270

1 Like