RFE: Add feature for listing relations together with charm options

Bug #1864199 reported by Andre Ruiz
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Wishlist
Unassigned

Bug Description

This is a RFE (Request for Enhancement) for Juju.

Charm relations could be allowed to go along with a charm definition instead of all together in the end of the bundle. The bundle would be much better organized.

Like the "bindings:", "options:", "to:", there could be a "relations:" entry relating that charm to some other (it would also make it WAY easier to comment a charm out for testing for example).

Even the format definition could be simplified, since you don't need to specify the complete left side anymore (could be optional). Of course relations are two way, but generally one application wants something from the other so the charm that needs something would be defined later and the relation would go there.

So, for example, for openstack, you start with mysql, then keystone, then go on with other charms that always use the ones before (just for logic and readability, they could still be two way no matter where they are defined — you just pick one of them to define the relation on).

I guess this feature is not complicated to implement bug would make one's life much easier when making large changes to a juju bundle. Specially in the Field Engineering Team and Solutions Q&A Team where we have to play with lots of variations of bundles while testing stuff.

Revision history for this message
Andre Ruiz (andre-ruiz) wrote :

Examples:

Instead of:

applications:
  mysql:
    charm: cs:percona-cluster
    bindings:
      "": *oam-space
      cluster: *internal-space
      shared-db: *internal-space
      ha: *internal-space
      db: *internal-space
      db-admin: *internal-space
    options:
      innodb-buffer-pool-size: 256M
      enable-binlogs: True
      performance-schema: True
      max-connections: *mysql-connections
      tuning-level: *mysql-tuning-level
      source: *openstack-origin
    num_units: 1
    to:
    - lxd:0
  keystone:
    charm: cs:keystone
    bindings:
      "": *oam-space
      public: *public-space
      admin: *admin-space
      internal: *internal-space
      shared-db: *internal-space
    options:
      vip: *keystone-vip
      admin-password: openstack
      openstack-origin: *openstack-origin
      preferred-api-version: 3
      region: *openstack-region
      token-provider: 'fernet'
      worker-multiplier: *worker-multiplier
    num_units: 3
    to:
    - lxd:6
    - lxd:7
    - lxd:8
relations:
- [ "keystone:shared-db", "mysql:shared-db" ]

You could use something like:

applications:
  mysql:
    charm: cs:percona-cluster
    bindings:
      "": *oam-space
      cluster: *internal-space
      shared-db: *internal-space
      ha: *internal-space
      db: *internal-space
      db-admin: *internal-space
    options:
      innodb-buffer-pool-size: 256M
      enable-binlogs: True
      performance-schema: True
      max-connections: *mysql-connections
      tuning-level: *mysql-tuning-level
      source: *openstack-origin
    num_units: 1
    to:
    - lxd:0
  keystone:
    charm: cs:keystone
    bindings:
      "": *oam-space
      public: *public-space
      admin: *admin-space
      internal: *internal-space
      shared-db: *internal-space
    options:
      vip: *keystone-vip
      admin-password: openstack
      openstack-origin: *openstack-origin
      preferred-api-version: 3
      region: *openstack-region
      token-provider: 'fernet'
      worker-multiplier: *worker-multiplier
    num_units: 3
    to:
    - lxd:6
    - lxd:7
    - lxd:8
    relations:
      - shared-db/mysql:shared-db

This may seem like a small change but would greatly simplify copying parts of bundles around.

Revision history for this message
Pedro Guimarães (pguimaraes) wrote :

Totally agreed. Some comments: defining a relation on at least one of the charms should be enough to get the relation set; if the relations differs (e.g. charm 1 I define endpoint A and charm 2 I define endpoint B), it fails

Tim Penhey (thumper)
Changed in juju:
status: New → Triaged
importance: Undecided → Wishlist
tags: added: bundles usability
Revision history for this message
Vern Hart (vern) wrote :

I like this very much.

Seems like this could be implemented relatively easily. With a first pass parsing of the bundle, any per-application relation could be simply translated to a relation in the relations section.

If we see:

  applications:
    oneapp:
      relations:
        - interfaceX/otherapp:interfaceY

It would get directly translated to:

  relations:
    - ["oneapp:interfaceX", "otherapp:interfaceY"]

Any validation or further parsing can continue as is.

Of course, this wouldn't change bundle exporting. That would be a whole other level.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.