Relation scope clarification

John Meinel john at
Tue Oct 17 19:16:05 UTC 2017

Why is the subordinate container scoped? The specific scope of container is
that you only see the single instance that you share a machine with.
Typically subordinates will use something like the juju-info relation
because all they really care about is to be colocated on the same machine.

I can't claim to have deep knowledge here, but I would guess that if one
end of a relation is normally scoped, and the other is container scoped,
then the intent is that the relation itself is container scoped and each
unit of each application only sees the other unit that shares the same

Now in the telegraf case, I would expect telegraf to have 2 types of
relations. 1 which is container scoped that means "I want to monitor this
application", and *another* which must be global scoped which means "I want
to use this application to store my data" (assuming telegraf is trying to
connect to pgsql because it wants to record stuff in a database, if it just
wanted to sit in the same machine and monitor postgres than I would have
expected it to use juju-info for that relation.)

I can't say that I've paged in all the bug comments yet, so I may be
speaking from misinformation.


On Tue, Oct 17, 2017 at 3:16 PM, Stuart Bishop <stuart.bishop at>

> 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.
> 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>
> --
> Juju mailing list
> Juju at
> Modify settings or unsubscribe at:
> mailman/listinfo/juju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Juju mailing list