Relation scope clarification

Stuart Bishop stuart.bishop at canonical.com
Tue Oct 17 11:16:11 UTC 2017


Hi.

A server declares a relation with standard scope. Lets use PostgreSQL
for example, which declares the following in metadata.yaml:

provides:
  db:
    interface: pgsql

A client happens to be a subordinate, and declares its end of the
relation as container scoped. So in its metadata.yaml:

requires:
  postgresql:
    interface: pgsql
    scope: container

My first question is: Is this supported by Juju? Can charms have a
relation with a different scope at each end? I know it works in most
cases, but is it supported or just an accident of implementation?

If the answer to that is yes, my second question is: If the relation
fails when the two charms declare a different scope, whose fault is
it?

The problem I have is that if one end of the relation declares
container scope, then the relation is container scoped, and
relation-get calls attempting to inspect relation data of peers fail.
Is this a Juju bug, or does the PostgreSQL charm need to understand
this limitation and use some other mechanism if it wants the pgsql
relation to work in either global or container scope?

Should relation-get return an error if a charm attempts to access
relation info from a peer unit, rather than only working if both ends
of the relation agree that the relation scope is global.

There are several bugs open on this issue dealing with large scale
deployments and I'm not sure how to proceed.
https://bugs.launchpad.net/juju/+bug/1721295 is the juju one. I think
I can update the PostgreSQL charm to support requirements, but I'm
worried I would just be digging a deeper hole.

-- 
Stuart Bishop <stuart.bishop at canonical.com>



More information about the Juju mailing list