Skip to content

Commit

Permalink
wb | remove validateNodeSpecs
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaste authored and mgmeier committed May 8, 2024
1 parent 489c43c commit bfdf084
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 55 deletions.
23 changes: 1 addition & 22 deletions nix/workbench/backend/nomad/cloud.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,6 @@ let
]
;

validateNodeSpecs = { nodeSpecsValue }:
let
# There's a region mismatch between the workbench (specifically Haskell
# code in cardano-topology) and Cardano World's Nomad cluster that both
# use "us-east-2" while our dedicated Nomad cluster is using "us-east-1",
# what SRE deployed.
# - Cardano World cluster: "eu-central-1", "us-east-2"
# - Workbench (Nix level): "eu-central-1", "us-east-2", and "ap-southeast-2"
# - Dedicated P&T cluster: "eu-central-1", "us-east-1", and "ap-southeast-2"
datacenters = [ "eu-central-1" "us-east-1" "us-east-2" "ap-southeast-2" ];
regions = lib.attrsets.mapAttrsToList
(name: value: value.region)
nodeSpecsValue
;
in if builtins.all (r: builtins.elem r datacenters) regions
then true
else builtins.throw (
"The only compatible regions for Nomad cloud are \"${toString datacenters}\" but found \"${toString regions}\""
)
;

# Nomad-generic "container-specs.json"
# Build a Nomad Job specification for this Nomad "sub-backend".
materialise-profile =
Expand Down Expand Up @@ -75,7 +54,7 @@ in
inherit name;

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

Expand Down
10 changes: 1 addition & 9 deletions nix/workbench/backend/nomad/exec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ let
]
;

validateNodeSpecs = { nodeSpecsValue }:
builtins.all (r: r == "loopback")
(lib.attrsets.mapAttrsToList
(name: value: value.region)
nodeSpecsValue
)
;

# Nomad-generic "container-specs.json"
# Build a Nomad Job specification for this Nomad "sub-backend".
materialise-profile =
Expand Down Expand Up @@ -68,7 +60,7 @@ in
inherit name;

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

Expand Down
10 changes: 1 addition & 9 deletions nix/workbench/backend/nomad/podman.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ let
]
;

validateNodeSpecs = { nodeSpecsValue }:
builtins.all (r: r == "loopback")
(lib.attrsets.mapAttrsToList
(name: value: value.region)
nodeSpecsValue
)
;

# Nomad-generic "container-specs.json"
# Build a Nomad Job specification for this Nomad "sub-backend".
materialise-profile =
Expand Down Expand Up @@ -101,7 +93,7 @@ in
inherit name;

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

Expand Down
10 changes: 1 addition & 9 deletions nix/workbench/backend/supervisor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ let
tx-generator
]);

validateNodeSpecs = { nodeSpecsValue }:
builtins.all (r: r == "loopback")
(lib.attrsets.mapAttrsToList
(name: value: value.region)
nodeSpecsValue
)
;

# Backend-specific Nix bits:
materialise-profile =
{ profileData }:
Expand Down Expand Up @@ -75,7 +67,7 @@ in
name = "supervisor";

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

Expand Down
7 changes: 1 addition & 6 deletions nix/workbench/profile/profile.nix
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,7 @@ let
;
nodeSpecsJson = mkNodeSpecsJson
{ inherit profileName profileJson;};
nodeSpecs =
let nodeSpecsValue = __fromJSON (__readFile nodeSpecsJson);
in if backend.validateNodeSpecs { inherit nodeSpecsValue; }
then nodeSpecsValue
else builtins.throw "Incompatible backend for the current profile"
;
nodeSpecs = __fromJSON (__readFile nodeSpecsJson);
genesisFiles =
mkGenesisFiles
{ inherit profileName profileJson nodeSpecsJson; }
Expand Down

0 comments on commit bfdf084

Please sign in to comment.