Skip to content

Commit

Permalink
fc-ceph.conf: refactor to enable it on non-ceph client hosts for fc-luks
Browse files Browse the repository at this point in the history
  • Loading branch information
osnyx committed Aug 22, 2024
1 parent 241ad12 commit eee1ace
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
16 changes: 9 additions & 7 deletions nixos/platform/full-disk-encryption.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ let
exit 0
'';
cephPkgs = fclib.ceph.mkPkgs "nautilus"; # FIXME: just a workaround
check_luks_cmd = "${cephPkgs.fc-ceph}/bin/fc-luks check";
check_luks_cmd = "${config.flyingcircus.services.ceph.fc-ceph.package}/bin/fc-luks check";
in
{

Expand All @@ -49,14 +48,17 @@ in
};

config = lib.mkIf (config.flyingcircus.infrastructureModule == "flyingcircus-physical" ||
# TODO: When merging nixos-hardware with our regular VM branch, we need to refine this
# to avoid that all regular VM tests (e.g. PHP) get fc-luks cruft added.
config.flyingcircus.infrastructureModule == "testing"
)
{
environment.systemPackages = with pkgs; [
cryptsetup
# FIXME: isolate fc-luks tooling into separate package
cephPkgs.fc-ceph
];
environment.systemPackages = with pkgs; [
cryptsetup
];

# FIXME: isolate fc-luks tooling into separate package
flyingcircus.services.ceph.fc-ceph.enable = true;

flyingcircus.services.sensu-client.checks = {
keystickMounted = {
Expand Down
34 changes: 24 additions & 10 deletions nixos/services/ceph/client.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,15 @@ in
};

fc-ceph = {
enable = lib.mkEnableOption "enable fc-ceph command and supporting infrastracture (also contains fc-luks)";
settings = lib.mkOption {
type = with lib.types; attrsOf (attrsOf (oneOf [ bool int str package ]));
default = { };
description = "Configuration for the fc-ceph utility, will be turned into the contents of /etc/ceph/fc-ceph.conf";
};
package = lib.mkOption {
type = lib.types.package;
default = cephPkgs.fc-ceph;
};
};

client = {
Expand Down Expand Up @@ -152,7 +156,8 @@ in
};
};

config = lib.mkIf cfg.client.enable {
config = lib.mkMerge [
(lib.mkIf cfg.client.enable {

assertions = [
{
Expand All @@ -161,14 +166,7 @@ in
}
];

# config file to be read by fc-ceph
environment.etc."ceph/fc-ceph.conf".text = lib.generators.toINI { } cfg.fc-ceph.settings;

# build a default binary path for fc-ceph
flyingcircus.services.ceph.fc-ceph.settings.default = {
release = cfg.client.cephRelease;
path = cephPkgs.fc-ceph-path;
};
environment.systemPackages = [ cfg.client.package ];

boot.kernelModules = [ "rbd" ];
Expand Down Expand Up @@ -220,6 +218,22 @@ in
}
'';

};
})
# fc-ceph can be enabled separately from the whole ceph (client)
# infrastructure, as it contains `fc-luks` for now which might be required on
# non-ceph hosts.
(lib.mkIf cfg.fc-ceph.enable {

# config file to be read by fc-ceph
environment.etc."ceph/fc-ceph.conf".text = lib.generators.toINI { } cfg.fc-ceph.settings;

# build a default binary path for fc-ceph
flyingcircus.services.ceph.fc-ceph.settings.default = {
release = cfg.client.cephRelease;
path = cephPkgs.fc-ceph-path;
};
environment.systemPackages = [ cfg.fc-ceph.package ];

})];

}
5 changes: 4 additions & 1 deletion nixos/services/ceph/server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ in
}
];

flyingcircus.services.ceph.fc-ceph = {
enable = true;
package = cephPkgs.fc-ceph;
};
environment.systemPackages = with pkgs; [
cephPkgs.fc-ceph
fc.blockdev

# tools like radosgw-admin and crushtool are only included in the full ceph package, but are necessary admin tools
Expand Down

0 comments on commit eee1ace

Please sign in to comment.