How to test-deploy local subordinate charms?

I am trying for the first time to write my own subordinate charm…

usually I test locally with a simple

juju deploy .

and if I need to relate my charm to others… I go ahead and perform those relate commands via CLI… but when I try to deploy my first subordinate dev/beta charm… I get an error

$ juju deploy . --to postgresql/0
ERROR attempting to deploy ".": subordinate charm "sync" lacks "requires" relation with container scope
$ juju deploy .
ERROR attempting to deploy ".": subordinate charm "sync" lacks "requires" relation with container scope

as you can see I am attempting to relate … but feels like I should be passing something else to tell my subordinate who to attach to?? Thanks for taking a look

I think this is likely a missing subordinate relation definition in your metadata.yaml file. Take a look at metadata.yaml - charm-ubuntu-advantage - [no description] as an example.

You have the subordinate: true definition, but you also need a relation that includes scope: container. If you’re not planning to pass any information over the relation you can use the implicit juju-info relation as we do here, or if you plan to pass information over the relation you’ll want to choose another relation name and interface name.

In terms of documentation about this I found Subordinate applications but I’m not sure where that’s exposed particularly.

1 Like