From 398992986d223d333d5f40422b978512427bca0a Mon Sep 17 00:00:00 2001 From: Mogeko Date: Sat, 11 May 2024 06:40:35 +0200 Subject: rke2: add runtime dependencies for kubelet See: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-237202494 Setup `passthru.updateScript`. Only build or run rke2 in linux. --- .../networking/cluster/rke2/default.nix | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'pkgs/applications/networking/cluster/rke2/default.nix') diff --git a/pkgs/applications/networking/cluster/rke2/default.nix b/pkgs/applications/networking/cluster/rke2/default.nix index 99b0998582f4e..a2ddd220dc939 100644 --- a/pkgs/applications/networking/cluster/rke2/default.nix +++ b/pkgs/applications/networking/cluster/rke2/default.nix @@ -1,4 +1,11 @@ -{ lib, stdenv, buildGoModule, fetchFromGitHub }: +{ lib, stdenv, buildGoModule, fetchFromGitHub, makeWrapper, nix-update-script + +# Runtime dependencies +, procps, coreutils, util-linux, ethtool, socat, iptables, bridge-utils, iproute2, kmod, lvm2 + +# Testing dependencies +, nixosTests, testers, rke2 +}: buildGoModule rec { pname = "rke2"; @@ -21,14 +28,36 @@ buildGoModule rec { sed -e 's/STATIC_FLAGS=.*/STATIC_FLAGS=/g' -i scripts/build-binary ''; + nativeBuildInputs = [ makeWrapper ]; + + # Important utilities used by the kubelet. + # See: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-237202494 + # Notice the list in that issue is stale, but as a redundancy reservation. + buildInputs = [ + procps # pidof pkill + coreutils # uname touch env nice du + util-linux # lsblk fsck mkfs nsenter mount umount + ethtool # ethtool + socat # socat + iptables # iptables iptables-restore iptables-save + bridge-utils # brctl + iproute2 # ip tc + kmod # modprobe + lvm2 # dmsetup + ]; + buildPhase = '' DRONE_TAG="v${version}" ./scripts/build-binary ''; installPhase = '' install -D ./bin/rke2 $out/bin/rke2 + wrapProgram $out/bin/rke2 \ + --prefix PATH : ${lib.makeBinPath buildInputs} ''; + passthru.updateScript = nix-update-script { }; + meta = with lib; { homepage = "https://github.com/rancher/rke2"; description = "RKE2, also known as RKE Government, is Rancher's next-generation Kubernetes distribution."; @@ -36,6 +65,6 @@ buildGoModule rec { license = licenses.asl20; maintainers = with maintainers; [ zimbatm zygot ]; mainProgram = "rke2"; - broken = stdenv.isDarwin; + platforms = platforms.linux; }; } -- cgit 1.4.1