fix(core): update
This commit is contained in:
parent
178c1d2df1
commit
cdb69c5f17
@ -97,11 +97,12 @@ export class DockerService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lets configure secrets
|
||||||
const secretArray: any[] = [];
|
const secretArray: any[] = [];
|
||||||
for (const secret of serviceCreationDescriptor.secrets) {
|
for (const secret of serviceCreationDescriptor.secrets) {
|
||||||
secretArray.push({
|
secretArray.push({
|
||||||
File: {
|
File: {
|
||||||
Name: 'secret.json',
|
Name: 'secret.json', // TODO: make sure that works with multiple secrets
|
||||||
UID: '33',
|
UID: '33',
|
||||||
GID: '33',
|
GID: '33',
|
||||||
Mode: 384
|
Mode: 384
|
||||||
@ -111,6 +112,15 @@ export class DockerService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lets configure limits
|
||||||
|
const limits = {
|
||||||
|
MemoryBytes: 1000 * 1000000
|
||||||
|
};
|
||||||
|
|
||||||
|
if (serviceCreationDescriptor.resources) {
|
||||||
|
limits.MemoryBytes = serviceCreationDescriptor.resources.memorySizeMB * 1000000;
|
||||||
|
}
|
||||||
|
|
||||||
const response = await dockerHost.request('POST', '/services/create', {
|
const response = await dockerHost.request('POST', '/services/create', {
|
||||||
Name: serviceCreationDescriptor.name,
|
Name: serviceCreationDescriptor.name,
|
||||||
TaskTemplate: {
|
TaskTemplate: {
|
||||||
@ -127,7 +137,10 @@ export class DockerService {
|
|||||||
Monitor: 15000000000,
|
Monitor: 15000000000,
|
||||||
MaxFailureRatio: 0.15
|
MaxFailureRatio: 0.15
|
||||||
},
|
},
|
||||||
ForceUpdate: 1
|
ForceUpdate: 1,
|
||||||
|
Resources: {
|
||||||
|
Limits: limits
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Networks: networkArray,
|
Networks: networkArray,
|
||||||
|
@ -12,4 +12,7 @@ export interface IServiceCreationDescriptor {
|
|||||||
secrets: DockerSecret[];
|
secrets: DockerSecret[];
|
||||||
ports: string[];
|
ports: string[];
|
||||||
accessHostDockerSock?: boolean;
|
accessHostDockerSock?: boolean;
|
||||||
|
resources?: {
|
||||||
|
memorySizeMB: number
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user