Merge pull request #764 from resin-io/balena-os-changes

Changes to properly support balenaOS
This commit is contained in:
Pablo Carranza Vélez 2018-10-18 15:24:42 +02:00 committed by GitHub
commit d32561e9de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -323,9 +323,13 @@ export function addFeaturesFromLabels(
}
if (checkTruthy(service.config.labels['io.balena.features.balena-socket'])) {
service.config.volumes.push('/var/run/balena.sock:/var/run/balena.sock');
service.config.volumes.push(`${constants.dockerSocket}:${constants.dockerSocket}`);
if (service.config.environment['DOCKER_HOST'] == null) {
service.config.environment['DOCKER_HOST'] = 'unix:///var/run/balena.sock';
service.config.environment['DOCKER_HOST'] = `unix://${constants.dockerSocket}`;
}
// We keep balena.sock for backwards compatibility
if (constants.dockerSocket != '/var/run/balena.sock') {
service.config.volumes.push(`${constants.dockerSocket}:/var/run/balena.sock`);
}
}

View File

@ -136,7 +136,7 @@ export default class ConfigJsonConfigBackend {
if (osVersion == null) {
throw new Error('Failed to detect OS version!');
}
if (/^Resin OS (1|2)./.test(osVersion)) {
if (/^(Resin OS|balenaOS)/.test(osVersion)) {
// In Resin OS 1.12, $BOOT_MOUNTPOINT was added and it coincides with config.json's path
if (constants.bootMountPointFromEnv != null) {
return path.join(constants.bootMountPointFromEnv, 'config.json');

View File

@ -88,7 +88,7 @@ exports.getIPAddresses = ->
# - the docker network for the supervisor API (supervisor0)
# - custom docker network bridges (br- + 12 hex characters)
_.flatten(_.map(_.omitBy(os.networkInterfaces(), (interfaceFields, interfaceName) ->
/^(?:balena|docker|rce|tun)[0-9]+|tun[0-9]+|resin-vpn|lo|resin-dns|supervisor0|br-[0-9a-f]{12}$/.test(interfaceName))
/^(?:balena|docker|rce|tun)[0-9]+|tun[0-9]+|resin-vpn|lo|resin-dns|supervisor0|balena-redsocks|resin-redsocks|br-[0-9a-f]{12}$/.test(interfaceName))
, (validInterfaces) ->
_.map(_.pickBy(validInterfaces, family: 'IPv4'), 'address'))
)