2022-06-21 08:38:36 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
2020-12-01 21:06:04 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, which
|
|
|
|
, makeWrapper
|
|
|
|
, rsync
|
|
|
|
, installShellFiles
|
2022-06-21 08:38:36 +00:00
|
|
|
, runtimeShell
|
2022-02-16 00:05:14 +00:00
|
|
|
, kubectl
|
2021-07-27 15:11:32 +00:00
|
|
|
, nixosTests
|
2020-12-01 21:06:04 +00:00
|
|
|
|
2016-10-10 16:48:00 +00:00
|
|
|
, components ? [
|
|
|
|
"cmd/kubelet"
|
|
|
|
"cmd/kube-apiserver"
|
|
|
|
"cmd/kube-controller-manager"
|
|
|
|
"cmd/kube-proxy"
|
2018-03-30 23:16:32 +00:00
|
|
|
"cmd/kube-scheduler"
|
2017-09-08 23:59:33 +00:00
|
|
|
"test/e2e/e2e.test"
|
2016-10-10 16:48:00 +00:00
|
|
|
]
|
|
|
|
}:
|
|
|
|
|
2022-06-21 08:38:36 +00:00
|
|
|
buildGoModule rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "kubernetes";
|
2022-07-13 22:14:20 +00:00
|
|
|
version = "1.23.9";
|
2014-11-15 16:18:14 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2016-06-06 10:58:51 +00:00
|
|
|
owner = "kubernetes";
|
2014-11-15 16:18:14 +00:00
|
|
|
repo = "kubernetes";
|
2015-03-18 13:26:40 +00:00
|
|
|
rev = "v${version}";
|
2022-07-13 22:14:20 +00:00
|
|
|
sha256 = "sha256-uuadINLKZ/hxewE9Qx5wBoGMWrpmTJPDgZh0djadAhc=";
|
2014-11-15 16:18:14 +00:00
|
|
|
};
|
|
|
|
|
2022-06-21 08:38:36 +00:00
|
|
|
vendorSha256 = null;
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper which rsync installShellFiles ];
|
2014-11-15 16:18:14 +00:00
|
|
|
|
2020-12-01 21:06:04 +00:00
|
|
|
outputs = [ "out" "man" "pause" ];
|
2015-06-08 11:10:32 +00:00
|
|
|
|
2021-01-13 19:10:04 +00:00
|
|
|
patches = [ ./fixup-addonmanager-lib-path.patch ];
|
|
|
|
|
2020-12-01 21:06:04 +00:00
|
|
|
WHAT = lib.concatStringsSep " " ([
|
|
|
|
"cmd/kubeadm"
|
|
|
|
] ++ components);
|
2016-10-10 16:48:00 +00:00
|
|
|
|
2022-06-21 08:38:36 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
substituteInPlace "hack/update-generated-docs.sh" --replace "make" "make SHELL=${runtimeShell}"
|
|
|
|
patchShebangs ./hack ./cluster/addons/addon-manager
|
|
|
|
make "SHELL=${runtimeShell}" "WHAT=$WHAT"
|
2019-04-07 15:01:41 +00:00
|
|
|
./hack/update-generated-docs.sh
|
2022-06-21 08:38:36 +00:00
|
|
|
runHook postBuild
|
2016-12-11 14:04:00 +00:00
|
|
|
'';
|
2016-10-10 16:48:00 +00:00
|
|
|
|
2014-11-15 16:18:14 +00:00
|
|
|
installPhase = ''
|
2021-09-16 12:40:26 +00:00
|
|
|
runHook preInstall
|
2020-12-01 21:06:04 +00:00
|
|
|
for p in $WHAT; do
|
|
|
|
install -D _output/local/go/bin/''${p##*/} -t $out/bin
|
|
|
|
done
|
2016-10-10 16:48:00 +00:00
|
|
|
|
2022-02-16 00:05:14 +00:00
|
|
|
cc build/pause/linux/pause.c -o pause
|
|
|
|
install -D pause -t $pause/bin
|
|
|
|
|
|
|
|
rm docs/man/man1/kubectl*
|
2020-12-01 21:06:04 +00:00
|
|
|
installManPage docs/man/man1/*.[1-9]
|
2016-12-11 13:56:25 +00:00
|
|
|
|
2022-02-16 00:05:14 +00:00
|
|
|
ln -s ${kubectl}/bin/kubectl $out/bin/kubectl
|
|
|
|
|
2021-07-27 15:11:32 +00:00
|
|
|
# Unfortunately, kube-addons-main.sh only looks for the lib file in either the
|
|
|
|
# current working dir or in /opt. We have to patch this for now.
|
2021-01-13 19:10:04 +00:00
|
|
|
substitute cluster/addons/addon-manager/kube-addons-main.sh $out/bin/kube-addons \
|
|
|
|
--subst-var out
|
|
|
|
|
|
|
|
chmod +x $out/bin/kube-addons
|
2017-09-01 10:08:11 +00:00
|
|
|
wrapProgram $out/bin/kube-addons --set "KUBECTL_BIN" "$out/bin/kubectl"
|
|
|
|
|
2021-01-13 19:10:04 +00:00
|
|
|
cp cluster/addons/addon-manager/kube-addons.sh $out/bin/kube-addons-lib.sh
|
|
|
|
|
2022-02-16 00:05:14 +00:00
|
|
|
installShellCompletion --cmd kubeadm \
|
|
|
|
--bash <($out/bin/kubeadm completion bash) \
|
|
|
|
--zsh <($out/bin/kubeadm completion zsh)
|
2021-09-16 12:40:26 +00:00
|
|
|
runHook postInstall
|
2014-11-15 16:18:14 +00:00
|
|
|
'';
|
|
|
|
|
2020-12-01 21:06:04 +00:00
|
|
|
meta = with lib; {
|
2016-06-06 10:58:51 +00:00
|
|
|
description = "Production-Grade Container Scheduling and Management";
|
2014-11-15 16:18:14 +00:00
|
|
|
license = licenses.asl20;
|
2020-04-01 13:59:46 +00:00
|
|
|
homepage = "https://kubernetes.io";
|
2022-01-08 06:56:06 +00:00
|
|
|
maintainers = with maintainers; [ ] ++ teams.kubernetes.members;
|
2022-02-16 00:05:14 +00:00
|
|
|
platforms = platforms.linux;
|
2014-11-15 16:18:14 +00:00
|
|
|
};
|
2021-07-27 15:11:32 +00:00
|
|
|
|
2021-07-30 15:16:23 +00:00
|
|
|
passthru.tests = nixosTests.kubernetes;
|
2014-11-15 16:18:14 +00:00
|
|
|
}
|