Skip to content

Commit

Permalink
Merge pull request #5129 from input-output-hk/bench-node-specs
Browse files Browse the repository at this point in the history
Bench nomad placement
  • Loading branch information
deepfire authored May 3, 2023
2 parents 6f05a08 + 2a742ee commit 2c9190f
Show file tree
Hide file tree
Showing 16 changed files with 608 additions and 266 deletions.
9 changes: 8 additions & 1 deletion nix/workbench/backend/nixops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ let
};
};

validateNodeSpecs = { nodeSpecsValue }:
true
;

materialise-profile =
{ profileData }:
let
Expand Down Expand Up @@ -320,7 +324,10 @@ in
{
name = "nixops";

inherit extraShellPkgs materialise-profile overlay service-modules stateDir basePort;
inherit extraShellPkgs;
inherit validateNodeSpecs materialise-profile;
inherit overlay service-modules;
inherit stateDir basePort;

useCabalRun = false;
}
43 changes: 35 additions & 8 deletions nix/workbench/backend/nomad-job.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,33 @@ let

# The namespace in which to execute the job. Prior to Nomad 1.0 namespaces
# were Enterprise-only.
namespace = "default";
# This is also set with `NOMAD_NAMESPACE="perf"` when using Nomad's cli.
# "When using commands that operate on objects that are namespaced, the
# namespace can be specified either with the flag -namespace or read from
# the NOMAD_NAMESPACE environment variable."
# https://developer.hashicorp.com/nomad/tutorials/manage-clusters/namespaces
namespace = "perf";

# The region in which to execute the job.
region = "global"; # SRE: They are actually using global.

# A list of datacenters in the region which are eligible for task
# placement. This must be provided, and does not have a default.
# SRE: 3 Nomad datacenters exist actually
# SRE: Only 3 Nomad datacenters exist actually.
datacenters = [ "eu-central-1" "eu-west-1" "us-east-2" ];

# This can be provided multiple times to define additional constraints. See
# the Nomad constraint reference for more details.
# https://developer.hashicorp.com/nomad/docs/job-specification/constraint
constraint = {
attribute = "\${node.class}";
operator = "=";
# For testing best to avoid using "infra" node class as HA jobs runs
# there, for benchmarking dedicated static machines are need and this
# should be updated accordingly.
value = "qa";
};

# The reschedule stanza specifies the group's rescheduling strategy. If
# specified at the job level, the configuration will apply to all groups
# within the job. If the reschedule stanza is present on both the job and
Expand Down Expand Up @@ -230,6 +247,20 @@ let
# This makes it easier to change them using `jq` inside the workbench!
meta = null;

# The affinity block allows operators to express placement preference
# for a set of nodes. Affinities may be expressed on attributes or
# client metadata. Additionally affinities may be specified at the
# job, group, or task levels for ultimate flexibility.
affinity =
let region = nodeSpec.region;
in if region == null || region == "loopback"
then null
else
{ attribute = "\${node.datacenter}";
value = region;
}
;

# The network stanza specifies the networking requirements for the task
# group, including the network mode and port allocations.
# https://developer.hashicorp.com/nomad/docs/job-specification/network
Expand Down Expand Up @@ -642,7 +673,8 @@ let
"perf-tracer" # serviceName
"tracer" # portName (can't have "-")
0 # portNum
{}; # node-specs
# TODO: Which region?
{region=null;}; # node-specs
}
]
++
Expand Down Expand Up @@ -701,11 +733,6 @@ let
# for special circumstances.
all_at_once = false;

# This can be provided multiple times to define additional constraints. See
# the Nomad constraint reference for more details.
# https://developer.hashicorp.com/nomad/docs/job-specification/constraint
constraint = null;

# This can be provided multiple times to define preferred placement
# criteria. See the Nomad affinity reference for more details.
affinity = null;
Expand Down
4 changes: 4 additions & 0 deletions nix/workbench/backend/nomad.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
}:
let

validateNodeSpecs = { nodeSpecsValue }:
true
;

# Backend-specific Nix bits:
materialise-profile =
{ profileData }:
Expand Down
Loading

0 comments on commit 2c9190f

Please sign in to comment.