How to bind endpoints within a bundle

Generally, you can configure more complex networks using Network spaces and deploy charms with a binding, as described in Deploying to spaces. However, the same can also be achieved with a bundle and is done by including a bindings field to a charm’s definition. For example:

mysql:
  charm: "mysql"
  num_units: 1
  bindings:
    shared-db: database
    cluster: internal

This is equivalent to:

juju deploy mysql --bind "shared-db=database cluster=internal"

The following connects application endpoints to specific spaces and includes a default space, default-space, for any interfaces not specified:

juju deploy --bind "default-space db=db-space db-admin=admin-space" mysql

Using a bundle file, the above deploy command can be mirrored with the following:

mysql:
  charm: "mysql"
  num_units: 1
  bindings:
    "": default-space
    db: db-space
    db-admin: admin-space

The "" key in the bindings map represents all endpoints and can be used to declare the default space for all endpoints. In the above example, any endpoints that are not explicitly bound will be automatically bound to default-space.


Last updated 7 months ago.