kubernetes: misc fixes
- don't install unnecessary binaries - remove go-bindata, already vendored by upstream - use installShellFiles, add kubeadm completion - require kubeadm/kubectl so installPhase can't be broken
This commit is contained in:
parent
a35e7daa2b
commit
563ff4adf9
|
@ -1,7 +1,14 @@
|
||||||
{ stdenv, lib, fetchFromGitHub, removeReferencesTo, which, go, go-bindata, makeWrapper, rsync
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, fetchFromGitHub
|
||||||
|
, removeReferencesTo
|
||||||
|
, which
|
||||||
|
, go
|
||||||
|
, makeWrapper
|
||||||
|
, rsync
|
||||||
|
, installShellFiles
|
||||||
|
|
||||||
, components ? [
|
, components ? [
|
||||||
"cmd/kubeadm"
|
|
||||||
"cmd/kubectl"
|
|
||||||
"cmd/kubelet"
|
"cmd/kubelet"
|
||||||
"cmd/kube-apiserver"
|
"cmd/kube-apiserver"
|
||||||
"cmd/kube-controller-manager"
|
"cmd/kube-controller-manager"
|
||||||
|
@ -11,8 +18,6 @@
|
||||||
]
|
]
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "kubernetes";
|
pname = "kubernetes";
|
||||||
version = "1.19.4";
|
version = "1.19.4";
|
||||||
|
@ -24,9 +29,9 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "05gisihrklkzsdsrrmvmqlfwfdx73jbwd5668n5wa5hp432qyvwi";
|
sha256 = "05gisihrklkzsdsrrmvmqlfwfdx73jbwd5668n5wa5hp432qyvwi";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ removeReferencesTo makeWrapper which go rsync go-bindata ];
|
nativeBuildInputs = [ removeReferencesTo makeWrapper which go rsync installShellFiles ];
|
||||||
|
|
||||||
outputs = ["out" "man" "pause"];
|
outputs = [ "out" "man" "pause" ];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
# go env breaks the sandbox
|
# go env breaks the sandbox
|
||||||
|
@ -41,7 +46,10 @@ stdenv.mkDerivation rec {
|
||||||
patchShebangs ./hack
|
patchShebangs ./hack
|
||||||
'';
|
'';
|
||||||
|
|
||||||
WHAT=concatStringsSep " " components;
|
WHAT = lib.concatStringsSep " " ([
|
||||||
|
"cmd/kubeadm"
|
||||||
|
"cmd/kubectl"
|
||||||
|
] ++ components);
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
./hack/update-generated-docs.sh
|
./hack/update-generated-docs.sh
|
||||||
|
@ -49,11 +57,12 @@ stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p "$out/bin" "$out/share/bash-completion/completions" "$out/share/zsh/site-functions" "$man/share/man" "$pause/bin"
|
for p in $WHAT; do
|
||||||
|
install -D _output/local/go/bin/''${p##*/} -t $out/bin
|
||||||
|
done
|
||||||
|
|
||||||
cp _output/local/go/bin/* "$out/bin/"
|
install -D build/pause/pause -t $pause/bin
|
||||||
cp build/pause/pause "$pause/bin/pause"
|
installManPage docs/man/man1/*.[1-9]
|
||||||
cp -R docs/man/man1 "$man/share/man"
|
|
||||||
|
|
||||||
cp cluster/addons/addon-manager/kube-addons.sh $out/bin/kube-addons
|
cp cluster/addons/addon-manager/kube-addons.sh $out/bin/kube-addons
|
||||||
patchShebangs $out/bin/kube-addons
|
patchShebangs $out/bin/kube-addons
|
||||||
|
@ -61,19 +70,22 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
cp ${./mk-docker-opts.sh} $out/bin/mk-docker-opts.sh
|
cp ${./mk-docker-opts.sh} $out/bin/mk-docker-opts.sh
|
||||||
|
|
||||||
$out/bin/kubectl completion bash > $out/share/bash-completion/completions/kubectl
|
for tool in kubeadm kubectl; do
|
||||||
$out/bin/kubectl completion zsh > $out/share/zsh/site-functions/_kubectl
|
installShellCompletion --cmd $tool \
|
||||||
|
--bash <($out/bin/$tool completion bash) \
|
||||||
|
--zsh <($out/bin/$tool completion zsh)
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
find $out/bin $pause/bin -type f -exec remove-references-to -t ${go} '{}' +
|
find $out/bin $pause/bin -type f -exec remove-references-to -t ${go} '{}' +
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = with lib; {
|
||||||
description = "Production-Grade Container Scheduling and Management";
|
description = "Production-Grade Container Scheduling and Management";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
homepage = "https://kubernetes.io";
|
homepage = "https://kubernetes.io";
|
||||||
maintainers = with maintainers; [johanot offline saschagrunert];
|
maintainers = with maintainers; [ johanot offline saschagrunert ];
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue