|
10 | 10 | pauseVersion, |
11 | 11 | ccmVersion, |
12 | 12 | dockerizedVersion, |
13 | | - ... |
14 | 13 | }: |
15 | 14 |
|
16 | 15 | # Build dependencies |
@@ -42,107 +41,108 @@ lib: |
42 | 41 | # Testing dependencies |
43 | 42 | nixosTests, |
44 | 43 | testers, |
45 | | - rke2, |
46 | 44 | }: |
| 45 | +let |
| 46 | + rke2 = buildGoModule rec { |
| 47 | + pname = "rke2"; |
| 48 | + version = rke2Version; |
| 49 | + |
| 50 | + src = fetchzip { |
| 51 | + url = "https://github.com/rancher/rke2/archive/refs/tags/v${rke2Version}.tar.gz"; |
| 52 | + hash = "${rke2TarballHash}"; |
| 53 | + }; |
47 | 54 |
|
48 | | -buildGoModule rec { |
49 | | - pname = "rke2"; |
50 | | - version = rke2Version; |
| 55 | + vendorHash = rke2VendorHash; |
| 56 | + |
| 57 | + nativeBuildInputs = [ makeWrapper ]; |
| 58 | + |
| 59 | + # Important utilities used by the kubelet. |
| 60 | + # See: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-237202494 |
| 61 | + # Notice the list in that issue is stale, but as a redundancy reservation. |
| 62 | + buildInputs = [ |
| 63 | + procps # pidof pkill |
| 64 | + coreutils # uname touch env nice du |
| 65 | + util-linux # lsblk fsck mkfs nsenter mount umount |
| 66 | + ethtool # ethtool |
| 67 | + socat # socat |
| 68 | + iptables # iptables iptables-restore iptables-save |
| 69 | + bridge-utils # brctl |
| 70 | + iproute2 # ip tc |
| 71 | + kmod # modprobe |
| 72 | + lvm2 # dmsetup |
| 73 | + ]; |
51 | 74 |
|
52 | | - src = fetchzip { |
53 | | - url = "https://github.com/rancher/rke2/archive/refs/tags/v${rke2Version}.tar.gz"; |
54 | | - hash = "${rke2TarballHash}"; |
55 | | - }; |
| 75 | + # See: https://github.com/rancher/rke2/blob/e7f87c6dd56fdd76a7dab58900aeea8946b2c008/scripts/build-binary#L27-L38 |
| 76 | + ldflags = [ |
| 77 | + "-w" |
| 78 | + "-X github.com/k3s-io/k3s/pkg/version.GitCommit=${lib.substring 0 6 rke2Commit}" |
| 79 | + "-X github.com/k3s-io/k3s/pkg/version.Program=${pname}" |
| 80 | + "-X github.com/k3s-io/k3s/pkg/version.Version=v${version}" |
| 81 | + "-X github.com/k3s-io/k3s/pkg/version.UpstreamGolang=go${go.version}" |
| 82 | + "-X github.com/rancher/rke2/pkg/images.DefaultRegistry=docker.io" |
| 83 | + "-X github.com/rancher/rke2/pkg/images.DefaultEtcdImage=rancher/hardened-etcd:${etcdVersion}" |
| 84 | + "-X github.com/rancher/rke2/pkg/images.DefaultKubernetesImage=rancher/hardened-kubernetes:${k8sImageTag}" |
| 85 | + "-X github.com/rancher/rke2/pkg/images.DefaultPauseImage=rancher/mirrored-pause:${pauseVersion}" |
| 86 | + "-X github.com/rancher/rke2/pkg/images.DefaultRuntimeImage=rancher/rke2-runtime:${dockerizedVersion}" |
| 87 | + "-X github.com/rancher/rke2/pkg/images.DefaultCloudControllerManagerImage=rancher/rke2-cloud-provider:${ccmVersion}" |
| 88 | + ]; |
56 | 89 |
|
57 | | - vendorHash = rke2VendorHash; |
58 | | - |
59 | | - nativeBuildInputs = [ makeWrapper ]; |
60 | | - |
61 | | - # Important utilities used by the kubelet. |
62 | | - # See: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-237202494 |
63 | | - # Notice the list in that issue is stale, but as a redundancy reservation. |
64 | | - buildInputs = [ |
65 | | - procps # pidof pkill |
66 | | - coreutils # uname touch env nice du |
67 | | - util-linux # lsblk fsck mkfs nsenter mount umount |
68 | | - ethtool # ethtool |
69 | | - socat # socat |
70 | | - iptables # iptables iptables-restore iptables-save |
71 | | - bridge-utils # brctl |
72 | | - iproute2 # ip tc |
73 | | - kmod # modprobe |
74 | | - lvm2 # dmsetup |
75 | | - ]; |
76 | | - |
77 | | - # See: https://github.com/rancher/rke2/blob/e7f87c6dd56fdd76a7dab58900aeea8946b2c008/scripts/build-binary#L27-L38 |
78 | | - ldflags = [ |
79 | | - "-w" |
80 | | - "-X github.com/k3s-io/k3s/pkg/version.GitCommit=${lib.substring 0 6 rke2Commit}" |
81 | | - "-X github.com/k3s-io/k3s/pkg/version.Program=${pname}" |
82 | | - "-X github.com/k3s-io/k3s/pkg/version.Version=v${version}" |
83 | | - "-X github.com/k3s-io/k3s/pkg/version.UpstreamGolang=go${go.version}" |
84 | | - "-X github.com/rancher/rke2/pkg/images.DefaultRegistry=docker.io" |
85 | | - "-X github.com/rancher/rke2/pkg/images.DefaultEtcdImage=rancher/hardened-etcd:${etcdVersion}" |
86 | | - "-X github.com/rancher/rke2/pkg/images.DefaultKubernetesImage=rancher/hardened-kubernetes:${k8sImageTag}" |
87 | | - "-X github.com/rancher/rke2/pkg/images.DefaultPauseImage=rancher/mirrored-pause:${pauseVersion}" |
88 | | - "-X github.com/rancher/rke2/pkg/images.DefaultRuntimeImage=rancher/rke2-runtime:${dockerizedVersion}" |
89 | | - "-X github.com/rancher/rke2/pkg/images.DefaultCloudControllerManagerImage=rancher/rke2-cloud-provider:${ccmVersion}" |
90 | | - ]; |
91 | | - |
92 | | - tags = [ |
93 | | - "no_cri_dockerd" |
94 | | - "no_embedded_executor" |
95 | | - "no_stage" |
96 | | - "sqlite_omit_load_extension" |
97 | | - "selinux" |
98 | | - "netgo" |
99 | | - "osusergo" |
100 | | - ]; |
101 | | - |
102 | | - subPackages = [ "." ]; |
103 | | - |
104 | | - installPhase = '' |
105 | | - install -D $GOPATH/bin/rke2 $out/bin/rke2 |
106 | | - wrapProgram $out/bin/rke2 \ |
107 | | - --prefix PATH : ${lib.makeBinPath buildInputs} |
108 | | -
|
109 | | - install -D ./bundle/bin/rke2-killall.sh $out/bin/rke2-killall.sh |
110 | | - wrapProgram $out/bin/rke2-killall.sh \ |
111 | | - --prefix PATH : ${ |
112 | | - lib.makeBinPath [ |
113 | | - systemd |
114 | | - gnugrep |
115 | | - gnused |
116 | | - ] |
117 | | - } \ |
118 | | - --prefix PATH : ${lib.makeBinPath buildInputs} |
119 | | - ''; |
120 | | - |
121 | | - doCheck = false; |
122 | | - |
123 | | - passthru.updateScript = updateScript; |
124 | | - |
125 | | - passthru.tests = |
126 | | - { |
127 | | - version = testers.testVersion { |
128 | | - package = rke2; |
129 | | - version = "v${version}"; |
| 90 | + tags = [ |
| 91 | + "no_cri_dockerd" |
| 92 | + "no_embedded_executor" |
| 93 | + "no_stage" |
| 94 | + "sqlite_omit_load_extension" |
| 95 | + "selinux" |
| 96 | + "netgo" |
| 97 | + "osusergo" |
| 98 | + ]; |
| 99 | + |
| 100 | + subPackages = [ "." ]; |
| 101 | + |
| 102 | + installPhase = '' |
| 103 | + install -D $GOPATH/bin/rke2 $out/bin/rke2 |
| 104 | + wrapProgram $out/bin/rke2 \ |
| 105 | + --prefix PATH : ${lib.makeBinPath buildInputs} |
| 106 | +
|
| 107 | + install -D ./bundle/bin/rke2-killall.sh $out/bin/rke2-killall.sh |
| 108 | + wrapProgram $out/bin/rke2-killall.sh \ |
| 109 | + --prefix PATH : ${ |
| 110 | + lib.makeBinPath [ |
| 111 | + systemd |
| 112 | + gnugrep |
| 113 | + gnused |
| 114 | + ] |
| 115 | + } \ |
| 116 | + --prefix PATH : ${lib.makeBinPath buildInputs} |
| 117 | + ''; |
| 118 | + |
| 119 | + doCheck = false; |
| 120 | + |
| 121 | + passthru.updateScript = updateScript; |
| 122 | + |
| 123 | + passthru.tests = |
| 124 | + { |
| 125 | + version = testers.testVersion { |
| 126 | + package = rke2; |
| 127 | + version = "v${version}"; |
| 128 | + }; |
| 129 | + } |
| 130 | + // lib.optionalAttrs stdenv.hostPlatform.isLinux { |
| 131 | + inherit (nixosTests) rke2; |
130 | 132 | }; |
131 | | - } |
132 | | - // lib.optionalAttrs stdenv.hostPlatform.isLinux { |
133 | | - inherit (nixosTests) rke2; |
134 | | - }; |
135 | 133 |
|
136 | | - meta = with lib; { |
137 | | - homepage = "https://github.com/rancher/rke2"; |
138 | | - description = "RKE2, also known as RKE Government, is Rancher's next-generation Kubernetes distribution"; |
139 | | - changelog = "https://github.com/rancher/rke2/releases/tag/v${version}"; |
140 | | - license = licenses.asl20; |
141 | | - maintainers = with maintainers; [ |
142 | | - zimbatm |
143 | | - zygot |
144 | | - ]; |
145 | | - mainProgram = "rke2"; |
146 | | - platforms = platforms.linux; |
| 134 | + meta = with lib; { |
| 135 | + homepage = "https://github.com/rancher/rke2"; |
| 136 | + description = "RKE2, also known as RKE Government, is Rancher's next-generation Kubernetes distribution"; |
| 137 | + changelog = "https://github.com/rancher/rke2/releases/tag/v${version}"; |
| 138 | + license = licenses.asl20; |
| 139 | + maintainers = with maintainers; [ |
| 140 | + zimbatm |
| 141 | + zygot |
| 142 | + ]; |
| 143 | + mainProgram = "rke2"; |
| 144 | + platforms = platforms.linux; |
| 145 | + }; |
147 | 146 | }; |
148 | | -} |
| 147 | +in |
| 148 | +rke2 |
0 commit comments