Skip to content

Commit dabfe06

Browse files
committed
Add container requirements section under Labels
This also removes the container contracts page as this feature is being replaced by container requirements. See: https://balena.fibery.io/Work/Project/Refactoring-container-contracts-1205 Change-type: minor Depends-on: balena-io/balena-cli#2922
1 parent bb96131 commit dabfe06

File tree

2 files changed

+59
-125
lines changed

2 files changed

+59
-125
lines changed

pages/learn/develop/container-contracts.md

-124
This file was deleted.

pages/learn/develop/multicontainer.md

+59-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,60 @@ In addition to the settings above, there are some {{ $names.company.lower }} spe
113113

114114
{{> "general/labels" }}
115115

116-
[docker-compose]:https://docs.docker.com/compose/overview/
116+
### Container requirements
117+
118+
**Note** Container requirements are available when using balenaCLI >= X.X.X (!TODO)
119+
120+
An additional set of labels allows to ensure the compatibility of a device when it comes to run a service. For example, before updating to a new release, it may be desirable to ensure that the device is running a specific version of [Supervisor][supervisor] or has a specific version of the [NVIDIA Tegra Linux Driver Package][l4t] (L4T).
121+
122+
The following set of requirement labels are enforced via the supervisor. Each service may define one or more requirements and if any of them is not met for any non-[optional](#optional-containers) service, then the release will be **rejected** and no changes will be performed for the new release.
123+
124+
| Label | Description | Valid from Supervisor |
125+
| -------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------- |
126+
| io.{{ $names.company.short }}.features.requires.sw.supervisor | Device Supervisor version (specified as a [version range][version-range]) | 10.16.17 |
127+
| io.{{ $names.company.short }}.features.requires.sw.l4t | [L4T][l4t] version (specified as a [version range][version-range]) | 10.16.17 |
128+
| io.{{ $names.company.short }}.features.requires.hw.device-type | The [device type][device-type] as given by `BALENA_MACHINE_NAME` | 11.1.0 |
129+
| io.{{ $names.company.short }}.features.requires.arch.sw | The [architecture][arch] as given by `BALENA_ARCH` | 14.10.11 |
130+
131+
For example, the following composition defines requirements on the supervisor and l4t version on the first service, and on the device type and architecture on the second service.
132+
133+
```yaml
134+
version: '2'
135+
services:
136+
first-service:
137+
build: ./first-service
138+
labels:
139+
io.balena.features.requires.sw.supervisor: '>=14'
140+
io.balena.features.requires.sw.l4t: '>=32.2.0'
141+
second-service:
142+
image: my-second-image
143+
labels:
144+
io.balena.features.requires.hw.device-type: 'jetson-nano'
145+
io.balena.features.requires.arch.sw: 'aarch64'
146+
```
147+
148+
#### Optional containers
149+
150+
By default, when a container requirement is not met, none of the services are deployed to the device. However, in a multi-container release, it is possible to ignore those services that do not meet requirements with the other services being deployed as normal. To do so, we make use of the `io.balena.features.optional: 1` label to indicate which services should be considered optional.
151+
152+
In the `docker-compose.yml` file, add the `io.balena.features.optional: 1` to the labels list for each service you wish to mark as optional. In the following example, even if the `first-service` requirements fail, the `second-service` service will still be deployed.
153+
154+
```Dockerfile
155+
version: '2'
156+
services:
157+
first-service:
158+
build: ./first-service
159+
labels:
160+
io.balena.features.requires.hw.device-type: 'jetson-nano'
161+
io.balena.features.optional: '1'
162+
second-service:
163+
build: ./second-service
164+
```
165+
166+
**Note** When updating between releases, if the new version of and optional service has unmet requirements, the old version of the service will still be killed.
167+
168+
[docker-compose]: https://docs.docker.com/compose/overview/
169+
117170
[simple-app]:{{ $links.githubLabs }}/multicontainer-getting-started
118171
[compose-features]:https://docs.docker.com/compose/compose-file/compose-file-v2/
119172
[compose-support]:/reference/supervisor/docker-compose
@@ -124,3 +177,8 @@ In addition to the settings above, there are some {{ $names.company.lower }} spe
124177
[services-masterclass]:/learn/more/masterclasses/services-masterclass/
125178
[core-dump-link]:https://en.wikipedia.org/wiki/Core_dump
126179
[feature-labels]:/learn/develop/multicontainer/#labels
180+
[l4t]: https://developer.nvidia.com/embedded/linux-tegra
181+
[supervisor]: /reference/supervisor/supervisor-api/
182+
[device-type]:/reference/base-images/devicetypes/
183+
[arch]: /reference/base-images/balena-base-images/#supported-architectures-distros-and-languages
184+
[version-range]: https://www.npmjs.com/package/semver

0 commit comments

Comments
 (0)