Skip to content

Commit

Permalink
imp: add a warnOnMissingIpModule option
Browse files Browse the repository at this point in the history
  • Loading branch information
johnalotoski committed Mar 28, 2024
1 parent bb6e3c2 commit ef767b0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
23 changes: 22 additions & 1 deletion flakeModules/cluster.nix
Expand Up @@ -14,6 +14,7 @@
# flake.cardano-parts.cluster.infra.generic.organization
# flake.cardano-parts.cluster.infra.generic.repo
# flake.cardano-parts.cluster.infra.generic.tribe
# flake.cardano-parts.cluster.infra.generic.warnOnMissingIpModule
# flake.cardano-parts.cluster.infra.grafana.stackName
# flake.cardano-parts.cluster.groups.<default|name>.bookRelayMultivalueDns
# flake.cardano-parts.cluster.groups.<default|name>.groupBlockProducerSubstring
Expand Down Expand Up @@ -62,7 +63,7 @@ flake @ {
...
}: let
inherit (lib) mdDoc mkDefault mkOption types;
inherit (types) addCheck anything attrsOf enum functionTo listOf nullOr oneOf package port raw str submodule;
inherit (types) addCheck anything attrsOf bool enum functionTo listOf nullOr oneOf package port raw str submodule;

cfg = config.flake.cardano-parts;
cfgAws = cfg.cluster.infra.aws;
Expand Down Expand Up @@ -216,6 +217,26 @@ flake @ {
example = "coretech";
default = null;
};

warnOnMissingIpModule = mkOption {
type = bool;
description = mdDoc ''
The cardano-parts cluster infra generic option to warn if the
downstream provided "ip-module" nixosModule is missing.
Most clusters will utilize the ip-module and if missing
may cause builds or deployed software and services to break.
In some special cases use of ip-module may not be desired
and warnings can be disabled by setting this option false.
The ip-module is generated by the downstream repo with a
`just update-ips` recipe. See the template file for an example:
templates/cardano-parts-project/Justfile
'';
default = true;
};
};
};

Expand Down
3 changes: 3 additions & 0 deletions templates/cardano-parts-project/flake/cluster.nix
Expand Up @@ -34,6 +34,9 @@
# tribe = "coretech";
# function = "cardano-parts";
# repo = "https://github.com/input-output-hk/UPDATE_ME";

# By default warn if the ip-module is missing:
# warnOnMissingIpModule = true;
};

# If using grafana cloud stack based monitoring.
Expand Down
4 changes: 2 additions & 2 deletions templates/cardano-parts-project/flake/colmena.nix
Expand Up @@ -35,7 +35,7 @@ in
[
{
config.warnings =
optional (!(config.flake.nixosModules ? ip-module))
optional (!(config.flake.nixosModules ? ip-module) && cfgGeneric.warnOnMissingIpModule)
''The nixosModule "ip-module" which most clusters use is missing; builds or deployed software and services may break. Generate the module with `just update-ips`'';
}
]
Expand All @@ -45,7 +45,7 @@ in

# Since all machines are assigned a group, this is a good place to include default aws instance tags
aws.instance.tags = {
inherit (config.flake.cardano-parts.cluster.infra.generic) organization tribe function repo;
inherit (cfgGeneric) organization tribe function repo;
environment = config.flake.cardano-parts.cluster.groups.${name}.meta.environmentName;
group = name;
};
Expand Down

0 comments on commit ef767b0

Please sign in to comment.