mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 10:46:22 +00:00
Merge pull request #2215 from balena-os/fix-service-network
Revert "Do not expose ports from image if service network mode"
This commit is contained in:
commit
8981ee58cf
@ -346,9 +346,7 @@ export class Service {
|
||||
'Config.ExposedPorts',
|
||||
{},
|
||||
);
|
||||
if (!serviceNetworkMode) {
|
||||
expose = expose.concat(_.keys(imageExposedPorts));
|
||||
}
|
||||
// Also add any exposed ports which are implied from the portMaps
|
||||
const exposedFromPortMappings = _.flatMap(portMaps, (port) =>
|
||||
port.toExposedPortArray(),
|
||||
|
@ -1082,35 +1082,6 @@ describe('compose/service: unit tests', () => {
|
||||
return expect(dockerSvc.isEqualConfig(composeSvc, { test: 'qwerty' })).to
|
||||
.be.false;
|
||||
});
|
||||
|
||||
it('should omit exposing ports from the source image', async () => {
|
||||
const s = await Service.fromComposeObject(
|
||||
{
|
||||
appId: '1234',
|
||||
serviceName: 'foo',
|
||||
releaseId: 2,
|
||||
serviceId: 3,
|
||||
imageId: 4,
|
||||
composition: {
|
||||
network_mode: 'service: test',
|
||||
expose: ['433/tcp'],
|
||||
},
|
||||
},
|
||||
{
|
||||
appName: 'test',
|
||||
imageInfo: {
|
||||
Config: {
|
||||
ExposedPorts: {
|
||||
'8080/tcp': {},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as any,
|
||||
);
|
||||
|
||||
// Only explicitely exposed ports are set if network_mode: service is used
|
||||
expect(s.config.expose).to.deep.equal(['433/tcp']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Security options', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user