mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
111 lines
3.2 KiB
Nix
111 lines
3.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
options,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
top = config.services.kubernetes;
|
|
otop = options.services.kubernetes;
|
|
cfg = top.scheduler;
|
|
in
|
|
{
|
|
###### interface
|
|
options.services.kubernetes.scheduler = with lib.types; {
|
|
|
|
address = lib.mkOption {
|
|
description = "Kubernetes scheduler listening address.";
|
|
default = "127.0.0.1";
|
|
type = str;
|
|
};
|
|
|
|
enable = lib.mkEnableOption "Kubernetes scheduler";
|
|
|
|
extraOpts = lib.mkOption {
|
|
description = "Kubernetes scheduler extra command line options.";
|
|
default = "";
|
|
type = separatedString " ";
|
|
};
|
|
|
|
featureGates = lib.mkOption {
|
|
description = "Attribute set of feature gates.";
|
|
default = top.featureGates;
|
|
defaultText = lib.literalExpression "config.${otop.featureGates}";
|
|
type = attrsOf bool;
|
|
};
|
|
|
|
kubeconfig = top.lib.mkKubeConfigOptions "Kubernetes scheduler";
|
|
|
|
leaderElect = lib.mkOption {
|
|
description = "Whether to start leader election before executing main loop.";
|
|
type = bool;
|
|
default = true;
|
|
};
|
|
|
|
port = lib.mkOption {
|
|
description = "Kubernetes scheduler listening port.";
|
|
default = 10251;
|
|
type = port;
|
|
};
|
|
|
|
verbosity = lib.mkOption {
|
|
description = ''
|
|
Optional glog verbosity level for logging statements. See
|
|
<https://github.com/kubernetes/community/blob/master/contributors/devel/logging.md>
|
|
'';
|
|
default = null;
|
|
type = nullOr int;
|
|
};
|
|
|
|
};
|
|
|
|
###### implementation
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.services.kube-scheduler = {
|
|
description = "Kubernetes Scheduler Service";
|
|
wantedBy = [ "kubernetes.target" ];
|
|
after = [ "kube-apiserver.service" ];
|
|
serviceConfig = {
|
|
Slice = "kubernetes.slice";
|
|
ExecStart = ''
|
|
${top.package}/bin/kube-scheduler \
|
|
--bind-address=${cfg.address} \
|
|
${
|
|
lib.optionalString (cfg.featureGates != { })
|
|
"--feature-gates=${
|
|
lib.concatStringsSep "," (
|
|
builtins.attrValues (lib.mapAttrs (n: v: "${n}=${lib.trivial.boolToString v}") cfg.featureGates)
|
|
)
|
|
}"
|
|
} \
|
|
--kubeconfig=${top.lib.mkKubeConfig "kube-scheduler" cfg.kubeconfig} \
|
|
--leader-elect=${lib.boolToString cfg.leaderElect} \
|
|
--secure-port=${toString cfg.port} \
|
|
${lib.optionalString (cfg.verbosity != null) "--v=${toString cfg.verbosity}"} \
|
|
${cfg.extraOpts}
|
|
'';
|
|
WorkingDirectory = top.dataDir;
|
|
User = "kubernetes";
|
|
Group = "kubernetes";
|
|
Restart = "on-failure";
|
|
RestartSec = 5;
|
|
};
|
|
unitConfig = {
|
|
StartLimitIntervalSec = 0;
|
|
};
|
|
};
|
|
|
|
services.kubernetes.pki.certs = {
|
|
schedulerClient = top.lib.mkCert {
|
|
name = "kube-scheduler-client";
|
|
CN = "system:kube-scheduler";
|
|
action = "systemctl restart kube-scheduler.service";
|
|
};
|
|
};
|
|
|
|
services.kubernetes.scheduler.kubeconfig.server = lib.mkDefault top.apiserverAddress;
|
|
};
|
|
|
|
meta.buildDocsInSandbox = false;
|
|
}
|