about summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/rke2/default.nix
diff options
context:
space:
mode:
authorZheng Junyi <zhengjunyi@live.com>2024-05-30 18:24:31 +0800
committerGitHub <noreply@github.com>2024-05-30 12:24:31 +0200
commitd8a5a620da8e1cae5348ede15cd244705e02598c (patch)
treeccded985386c5aa477a3d618abacf9f7ac8168ae /pkgs/applications/networking/cluster/rke2/default.nix
parent507146ab23d6d2ac224669a930ebe8eebdd60d10 (diff)
rke2: update and release packages by official release channels (#315599)
Get the legal go version from the k8s project.

Use the `buildGoModule` compilation package instead of patching the build script.

Add documents to explain Release Channels and support strategies.

Increase the metadata `eol` (End of Life) to mark the life cycle of the package.
Diffstat (limited to 'pkgs/applications/networking/cluster/rke2/default.nix')
-rw-r--r--pkgs/applications/networking/cluster/rke2/default.nix96
1 files changed, 18 insertions, 78 deletions
diff --git a/pkgs/applications/networking/cluster/rke2/default.nix b/pkgs/applications/networking/cluster/rke2/default.nix
index 2ac749148f0f0..fc65ac8694731 100644
--- a/pkgs/applications/networking/cluster/rke2/default.nix
+++ b/pkgs/applications/networking/cluster/rke2/default.nix
@@ -1,79 +1,19 @@
-{ 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";
-  version = "1.29.0+rke2r1";
-
-  src = fetchFromGitHub {
-    owner = "rancher";
-    repo = pname;
-    rev = "v${version}";
-    hash = "sha256-E59GUcbnbvsGZYn87RGNrGTVUsydKsjL+C5h15q74p0=";
-  };
-
-  vendorHash = "sha256-Og0CqxNnhRN6PdggneGK05uprZ2D7lux/snXcArIm8Q=";
-
-  postPatch = ''
-    # Patch the build scripts so they work in the Nix build environment.
-    patchShebangs ./scripts
-
-    # Disable the static build as it breaks.
-    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 { };
-
-  passthru.tests = {
-    version = testers.testVersion {
-      package = rke2;
-      version = "v${version}";
-    };
-  } // lib.optionalAttrs stdenv.isLinux {
-    inherit (nixosTests) rke2;
-  };
-
-  meta = with lib; {
-    homepage = "https://github.com/rancher/rke2";
-    description = "RKE2, also known as RKE Government, is Rancher's next-generation Kubernetes distribution.";
-    changelog = "https://github.com/rancher/rke2/releases/tag/v${version}";
-    license = licenses.asl20;
-    maintainers = with maintainers; [ zimbatm zygot ];
-    mainProgram = "rke2";
-    platforms = platforms.linux;
-  };
+{ lib, callPackage, ... }@args:
+
+let
+  common = opts: callPackage (import ./builder.nix lib opts);
+  extraArgs = builtins.removeAttrs args [ "callPackage" ];
+in
+{
+  rke2_stable = common ((import ./stable/versions.nix) // {
+    updateScript = [ ./update-script.sh "stable" ];
+  }) extraArgs;
+
+  rke2_latest = common ((import ./latest/versions.nix) // {
+    updateScript = [ ./update-script.sh "latest" ];
+  }) extraArgs;
+
+  rke2_testing = common ((import ./testing/versions.nix) // {
+    updateScript = [ ./update-script.sh "testing" ];
+  }) extraArgs;
 }