Small cluster example scenario for the topo viz

This commit is contained in:
Michael Lange
2020-08-24 09:59:55 -07:00
parent 753bfbf1e7
commit 1e9e2a1c8b
5 changed files with 100 additions and 4 deletions

27
ui/app/routes/topology.js Normal file
View File

@@ -0,0 +1,27 @@
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
import classic from 'ember-classic-decorator';
import RSVP from 'rsvp';
@classic
export default class TopologyRoute extends Route.extend(WithForbiddenState) {
@service store;
@service system;
breadcrumbs = [
{
label: 'Topology',
args: ['topology'],
},
];
model() {
return RSVP.hash({
allocations: this.store.findAll('allocation'),
jobs: this.store.findAll('job'),
nodes: this.store.findAll('node'),
}).catch(notifyForbidden(this));
}
}

View File

@@ -5,5 +5,19 @@
<h3 class="empty-message-headline">Cluster topology visualization goes here</h3>
<p class="empty-message-body">:D</p>
</div>
<h3>Clients</h3>
<ol>
{{#each model.nodes as |node|}}
<li><strong>{{node.name}}</strong> {{!node.allocations.length}} {{node.resources.cpu}} MHz {{node.resources.memory}} MiB</li>
{{/each}}
</ol>
<h3>Allocations</h3>
<ol>
{{#each model.allocations as |allocation|}}
<li><strong>{{allocation.shortId}}</strong> {{allocation.node.name}} {{allocation.job.name}}/{{allocation.taskGroup.name}} {{allocation.resources.cpu}} MHz {{allocation.resources.memory}} MiB</li>
{{/each}}
</ol>
</section>
</PageLayout>

View File

@@ -24,11 +24,11 @@ module.exports = function(environment) {
},
APP: {
blockingQueries: true,
mirageScenario: 'smallCluster',
mirageWithNamespaces: true,
blockingQueries: false,
mirageScenario: 'topoSmall',
mirageWithNamespaces: false,
mirageWithTokens: true,
mirageWithRegions: true,
mirageWithRegions: false,
},
};

View File

@@ -1,4 +1,5 @@
import config from 'nomad-ui/config/environment';
import * as topoScenarios from './topo';
import { pickOne } from '../utils';
const withNamespaces = getConfigValue('mirageWithNamespaces', false);
@@ -14,6 +15,7 @@ const allScenarios = {
allNodeTypes,
everyFeature,
emptyCluster,
...topoScenarios,
};
const scenario = getConfigValue('mirageScenario', 'emptyCluster');

View File

@@ -0,0 +1,53 @@
import faker from 'nomad-ui/mirage/faker';
import { generateNetworks, generatePorts } from '../common';
export function topoSmall(server) {
server.createList('agent', 3);
server.createList('node', 12, {
datacenter: 'dc1',
status: 'ready',
resources: {
CPU: 4000,
MemoryMB: 8192,
DiskMB: 10000,
IOPS: 100000,
Networks: generateNetworks(),
Ports: generatePorts(),
},
});
const jobResources = [
['M: 256, 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: 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,
});
});
server.createList('allocation', 35, {
forceRunningClientStatus: true,
});
}
export function topoSmallProblems(server) {}
export function topoMedium(server) {}
export function topoMediumBatch(server) {}
export function topoMediumVariadic(server) {}