mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 09:55:44 +03:00
Mirage updates for task group scaling and scaling post endpoint
This commit is contained in:
@@ -172,6 +172,10 @@ export default function() {
|
||||
return okEmpty();
|
||||
});
|
||||
|
||||
this.post('/job/:id/scale', function({ jobs }, { params }) {
|
||||
return this.serialize(jobs.find(params.id));
|
||||
});
|
||||
|
||||
this.delete('/job/:id', function(schema, { params }) {
|
||||
const job = schema.jobs.find(params.id);
|
||||
job.update({ status: 'dead' });
|
||||
|
||||
@@ -18,6 +18,8 @@ export default Factory.extend({
|
||||
volumes: () => ({}),
|
||||
}),
|
||||
|
||||
withScaling: faker.random.boolean,
|
||||
|
||||
volumes: makeHostVolumes(),
|
||||
|
||||
// Directive used to control whether or not allocations are automatically
|
||||
@@ -38,6 +40,31 @@ export default Factory.extend({
|
||||
let taskIds = [];
|
||||
let volumes = Object.keys(group.volumes);
|
||||
|
||||
if (group.withScaling) {
|
||||
group.update({
|
||||
scaling: {
|
||||
Min: 1,
|
||||
Max: 5,
|
||||
Policy: faker.random.boolean() && {
|
||||
EvaluationInterval: '10s',
|
||||
Cooldown: '2m',
|
||||
Check: {
|
||||
avg_conn: {
|
||||
Source: 'prometheus',
|
||||
Query:
|
||||
'scalar(avg((haproxy_server_current_sessions{backend="http_back"}) and (haproxy_server_up{backend="http_back"} == 1)))',
|
||||
Strategy: {
|
||||
'target-value': {
|
||||
target: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (!group.shallow) {
|
||||
const tasks = provide(group.count, () => {
|
||||
const mounts = faker.helpers
|
||||
|
||||
Reference in New Issue
Block a user