LEFT | RIGHT |
1 Subordinate services | 1 Subordinate services |
2 ===================== | 2 ===================== |
3 | 3 |
4 Services are composed of one or more service units. A service unit | 4 Services are composed of one or more service units. A service unit |
5 runs the service's software and is the smallest entity managed by | 5 runs the service's software and is the smallest entity managed by |
6 juju. Service units are typically run in an isolated container on a | 6 juju. Service units are typically run in an isolated container on a |
7 machine with no knowledge or access to other services deployed onto | 7 machine with no knowledge or access to other services deployed onto |
8 the same machine. Subordinate services allows for units of different | 8 the same machine. Subordinate services allows for units of different |
9 services to be deployed into the same container and to have knowledge | 9 services to be deployed into the same container and to have knowledge |
10 of each other. | 10 of each other. |
(...skipping 22 matching lines...) Expand all Loading... |
33 ----- | 33 ----- |
34 | 34 |
35 Principal service | 35 Principal service |
36 A traditional service or charm in whose container subordinate | 36 A traditional service or charm in whose container subordinate |
37 services will execute. | 37 services will execute. |
38 | 38 |
39 Subordinate service/charm | 39 Subordinate service/charm |
40 A service designed for and deployed to the running container of | 40 A service designed for and deployed to the running container of |
41 another service unit. | 41 another service unit. |
42 | 42 |
43 Subordinate relation | 43 Container relation |
44 A qualified relation type between principal services and their | 44 A `scope: container` relationship. While modeled identically to |
45 subordinate service units. While modeled identically to | 45 traditional, `scope: global`, relationships, juju only implements |
46 traditional relationships, juju only implements the relationship | 46 the relationship between the units belonging to the same |
47 between the unit of the principal and the subordinate service or | 47 container. |
48 charm in the same container. | 48 |
49 | 49 |
50 | 50 |
51 Relations | 51 Relations |
52 --------- | 52 --------- |
53 | 53 |
54 When a traditional relation is added between two services, all the | 54 When a traditional relation is added between two services, all the |
55 service units for the first service will receive relation events about | 55 service units for the first service will receive relation events about |
56 all service units for the second service. Subordinate services have a | 56 all service units for the second service. Subordinate services have a |
57 very tight relationship with their principal service, so it makes | 57 very tight relationship with their principal service, so it makes |
58 sense to be able to restrict that communication in some cases so that | 58 sense to be able to restrict that communication in some cases so that |
(...skipping 28 matching lines...) Expand all Loading... |
87 container. Subordinate units inherit the public/private address of the | 87 container. Subordinate units inherit the public/private address of the |
88 principal service. The container of the principal defines the network | 88 principal service. The container of the principal defines the network |
89 setup. | 89 setup. |
90 | 90 |
91 | 91 |
92 Declaring subordinate charms | 92 Declaring subordinate charms |
93 ---------------------------- | 93 ---------------------------- |
94 | 94 |
95 When a charm author wishes to indicate their charm should operate as a | 95 When a charm author wishes to indicate their charm should operate as a |
96 subordinate service only a small changes to the subordinate charms | 96 subordinate service only a small changes to the subordinate charms |
97 metadata is required. Declaring a required interface with `scope: | 97 metadata is required. Adding `subordinate: true` as a top-level |
98 container` in the interface definition of the charms metadata will | 98 attribute indicates the charm is intended only to deploy in an |
99 result in a subordinate deployment. Subordinate services may still | 99 existing container. Subordinate charms should then declare a required |
100 declare traditional relations to any service. The deployment is | 100 interface with `scope: container` in the relation definition of the |
101 delayed until a container relation is added. | 101 charms metadata. Subordinate services may still declare traditional |
| 102 relations to any service. The deployment is delayed until a container |
| 103 relation is added. |
| 104 |
| 105 `subordinate: false` charms (the default) may still declare relations |
| 106 as `scope: container`. Principal charms providing or requiring `scope: |
| 107 container` relations will only be able to form relations with |
| 108 `subordinate: true` charms. |
102 | 109 |
103 The example below shows adding a container relation to a charm. :: | 110 The example below shows adding a container relation to a charm. :: |
104 | 111 |
105 requires: | 112 requires: |
106 logging-directory: | 113 logging-directory: |
107 interface: logging | 114 interface: logging |
108 scope: container | 115 scope: container |
109 | 116 |
110 | 117 |
111 | 118 |
112 Status of subordinates | 119 Status of subordinates |
113 ---------------------- | 120 ---------------------- |
114 | 121 |
115 The status output contains details about subordinate units under the | 122 The status output contains details about subordinate units under the |
116 status of the principal service unit that it is sharing the container | 123 status of the principal service unit that it is sharing the container |
117 with. The subordinate unit's output matches the formatting of existing | 124 with. The subordinate unit's output matches the formatting of existing |
118 unit entries but omits `machine`, `public-address` and `subordinates` | 125 unit entries but omits `machine`, `public-address` and `subordinates` |
119 (which are all the same as the principal unit). | 126 (which are all the same as the principal unit). |
120 | 127 |
121 The subordinate service is listed in the top level `services` | 128 The subordinate service is listed in the top level `services` |
122 dictionary in an abbreviated form. The `subordinate-to: []` list is | 129 dictionary in an abbreviated form. The `subordinate-to: []` list is |
123 added to the service which contains the names of all services this | 130 added to the service which contains the names of all services this |
124 service is subordinate to. `units` is displayed as a list of principal | 131 service is subordinate to. :: |
125 unit names under which instances of this service are found. :: | |
126 | 132 |
127 services: | 133 services: |
128 logging: | 134 rsyslog: |
129 charm: local:series/logging-1 | 135 charm: local:series/rsyslog-1 |
130 subordinate-to: [wordpress] | 136 subordinate-to: [wordpress] |
131 relations: | 137 relations: |
132 logging-directory: wordpress | 138 rsyslog-directory: wordpress |
133 wordpress: | 139 wordpress: |
134 machine: 0 | 140 machine: 0 |
135 public-address: wordpress-0.example.com | 141 public-address: wordpress-0.example.com |
136 charm: local:series/wordpress-3 | 142 charm: local:series/wordpress-3 |
137 relations: {loggin: logging} | 143 relations: {rsyslog-directory: rsyslog} |
138 units: | 144 units: |
139 wordpress/0: | 145 wordpress/0: |
140 relations: | 146 relations: |
141 logging: {state: up} | 147 rsyslog: {state: up} |
142 state: started | 148 state: started |
143 subordinates: | 149 subordinates: |
144 logging/0: | 150 rsyslog/0: |
145 relations: | 151 relations: |
146 logging: {state: up} | 152 rsyslog-directory: {state: up} |
147 | 153 |
148 | 154 |
149 | 155 |
150 Usage | 156 Usage |
151 ----- | 157 ----- |
152 | 158 |
153 Assume the following deployment:: | 159 Assume the following deployment:: |
154 | 160 |
155 juju deploy mysql | 161 juju deploy mysql |
156 juju deploy wordpress | 162 juju deploy wordpress |
157 juju add-relation mysql wordpress | 163 juju add-relation mysql wordpress |
158 | 164 |
159 Now we'll create a subordinate logging service:: | 165 Now we'll create a subordinate rsyslog service:: |
160 | 166 |
161 juju deploy logging | 167 juju deploy rsyslog |
162 juju add-relation logging mysql | 168 juju add-relation rsyslog mysql |
163 juju add-relation logging wordpress | 169 juju add-relation rsyslog wordpress |
164 | 170 |
165 This will create a logging service unit inside each of the containers | 171 This will create a rsyslog service unit inside each of the containers |
166 holding the mysql and wordpress units. The logging service has a | 172 holding the mysql and wordpress units. The rsyslog service has a |
167 standard client-server relation to both wordpress and mysql but these | 173 standard client-server relation to both wordpress and mysql but these |
168 new relationships are implemented only between the principal unit and | 174 new relationships are implemented only between the principal unit and |
169 the subordinate unit . A subordinate unit may still have standard | 175 the subordinate unit . A subordinate unit may still have standard |
170 relations established with any unit in its environment as usual. | 176 relations established with any unit in its environment as usual. |
LEFT | RIGHT |