2020-08-24 16:59:55 +00:00
|
|
|
import faker from 'nomad-ui/mirage/faker';
|
|
|
|
import { generateNetworks, generatePorts } from '../common';
|
|
|
|
|
2020-10-13 14:54:07 +00:00
|
|
|
const genResources = (CPU, Memory) => ({
|
|
|
|
Cpu: { CpuShares: CPU },
|
|
|
|
Memory: { MemoryMB: Memory },
|
|
|
|
Disk: { DiskMB: 10000 },
|
|
|
|
Networks: generateNetworks(),
|
|
|
|
Ports: generatePorts(),
|
|
|
|
});
|
|
|
|
|
2020-08-24 16:59:55 +00:00
|
|
|
export function topoSmall(server) {
|
2021-12-09 00:13:22 +00:00
|
|
|
server.createList('agent', 3, 'withConsulLink', 'withVaultLink');
|
2020-08-24 16:59:55 +00:00
|
|
|
server.createList('node', 12, {
|
|
|
|
datacenter: 'dc1',
|
|
|
|
status: 'ready',
|
2020-10-13 14:54:07 +00:00
|
|
|
nodeResources: genResources(3000, 5192),
|
2020-08-24 16:59:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const jobResources = [
|
2020-09-11 06:29:07 +00:00
|
|
|
['M: 2560, C: 150'],
|
2020-08-24 16:59:55 +00:00
|
|
|
['M: 128, C: 400'],
|
|
|
|
['M: 512, C: 100'],
|
|
|
|
['M: 256, C: 150'],
|
|
|
|
['M: 200, C: 50'],
|
|
|
|
['M: 64, C: 100'],
|
|
|
|
['M: 128, C: 150'],
|
|
|
|
['M: 1024, C: 500'],
|
|
|
|
['M: 100, C: 300', 'M: 200, C: 150'],
|
|
|
|
['M: 512, C: 250', 'M: 600, C: 200'],
|
|
|
|
];
|
|
|
|
|
|
|
|
jobResources.forEach(spec => {
|
|
|
|
server.create('job', {
|
|
|
|
status: 'running',
|
|
|
|
datacenters: ['dc1'],
|
|
|
|
type: 'service',
|
|
|
|
createAllocations: false,
|
|
|
|
resourceSpec: spec,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-09-04 19:53:28 +00:00
|
|
|
server.createList('allocation', 25, {
|
2020-08-24 16:59:55 +00:00
|
|
|
forceRunningClientStatus: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-09-11 23:58:38 +00:00
|
|
|
export function topoMedium(server) {
|
2021-12-09 00:13:22 +00:00
|
|
|
server.createList('agent', 3, 'withConsulLink', 'withVaultLink');
|
2020-10-13 14:54:07 +00:00
|
|
|
server.createList('node', 10, {
|
2020-09-11 23:58:38 +00:00
|
|
|
datacenter: 'us-west-1',
|
|
|
|
status: 'ready',
|
2020-10-13 14:54:07 +00:00
|
|
|
nodeResources: genResources(3000, 5192),
|
2020-09-11 23:58:38 +00:00
|
|
|
});
|
2020-10-13 14:54:07 +00:00
|
|
|
server.createList('node', 12, {
|
2020-09-11 23:58:38 +00:00
|
|
|
datacenter: 'us-east-1',
|
|
|
|
status: 'ready',
|
2020-10-13 14:54:07 +00:00
|
|
|
nodeResources: genResources(3000, 5192),
|
2020-09-11 23:58:38 +00:00
|
|
|
});
|
2020-10-13 14:54:07 +00:00
|
|
|
server.createList('node', 11, {
|
2020-09-11 23:58:38 +00:00
|
|
|
datacenter: 'eu-west-1',
|
|
|
|
status: 'ready',
|
2020-10-13 14:54:07 +00:00
|
|
|
nodeResources: genResources(3000, 5192),
|
2020-09-11 23:58:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
server.createList('node', 8, {
|
|
|
|
datacenter: 'us-west-1',
|
|
|
|
status: 'ready',
|
2020-10-13 14:54:07 +00:00
|
|
|
nodeResources: genResources(8000, 12192),
|
2020-09-11 23:58:38 +00:00
|
|
|
});
|
2020-10-13 14:54:07 +00:00
|
|
|
server.createList('node', 9, {
|
2020-09-11 23:58:38 +00:00
|
|
|
datacenter: 'us-east-1',
|
|
|
|
status: 'ready',
|
2020-10-13 14:54:07 +00:00
|
|
|
nodeResources: genResources(8000, 12192),
|
2020-09-11 23:58:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const jobResources = [
|
|
|
|
['M: 2560, C: 150'],
|
|
|
|
['M: 128, C: 400'],
|
|
|
|
['M: 512, C: 100'],
|
|
|
|
['M: 256, C: 150'],
|
|
|
|
['M: 200, C: 50'],
|
|
|
|
['M: 64, C: 100'],
|
|
|
|
['M: 128, C: 150'],
|
|
|
|
['M: 1024, C: 500'],
|
|
|
|
|
|
|
|
['M: 1200, C: 50'],
|
|
|
|
['M: 1400, C: 200'],
|
|
|
|
['M: 50, C: 150'],
|
|
|
|
['M: 5000, C: 1800'],
|
|
|
|
|
|
|
|
['M: 100, C: 300', 'M: 200, C: 150'],
|
|
|
|
['M: 512, C: 250', 'M: 600, C: 200'],
|
|
|
|
];
|
|
|
|
|
|
|
|
jobResources.forEach(spec => {
|
|
|
|
server.create('job', {
|
|
|
|
status: 'running',
|
|
|
|
datacenters: ['dc1'],
|
|
|
|
type: 'service',
|
|
|
|
createAllocations: false,
|
2020-10-29 12:46:42 +00:00
|
|
|
createRecommendations: true,
|
2020-09-11 23:58:38 +00:00
|
|
|
resourceSpec: spec,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
server.createList('allocation', 100, {
|
|
|
|
forceRunningClientStatus: true,
|
|
|
|
});
|
|
|
|
}
|