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