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 ? [
|
||||
"cmd/kubeadm"
|
||||
"cmd/kubectl"
|
||||
"cmd/kubelet"
|
||||
"cmd/kube-apiserver"
|
||||
"cmd/kube-controller-manager"
|
||||
|
@ -11,8 +18,6 @@
|
|||
]
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "kubernetes";
|
||||
version = "1.19.4";
|
||||
|
@ -24,9 +29,9 @@ stdenv.mkDerivation rec {
|
|||
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 = ''
|
||||
# go env breaks the sandbox
|
||||
|
@ -41,7 +46,10 @@ stdenv.mkDerivation rec {
|
|||
patchShebangs ./hack
|
||||
'';
|
||||
|
||||
WHAT=concatStringsSep " " components;
|
||||
WHAT = lib.concatStringsSep " " ([
|
||||
"cmd/kubeadm"
|
||||
"cmd/kubectl"
|
||||
] ++ components);
|
||||
|
||||
postBuild = ''
|
||||
./hack/update-generated-docs.sh
|
||||
|
@ -49,11 +57,12 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
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/"
|
||||
cp build/pause/pause "$pause/bin/pause"
|
||||
cp -R docs/man/man1 "$man/share/man"
|
||||
install -D build/pause/pause -t $pause/bin
|
||||
installManPage docs/man/man1/*.[1-9]
|
||||
|
||||
cp cluster/addons/addon-manager/kube-addons.sh $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
|
||||
|
||||
$out/bin/kubectl completion bash > $out/share/bash-completion/completions/kubectl
|
||||
$out/bin/kubectl completion zsh > $out/share/zsh/site-functions/_kubectl
|
||||
for tool in kubeadm kubectl; do
|
||||
installShellCompletion --cmd $tool \
|
||||
--bash <($out/bin/$tool completion bash) \
|
||||
--zsh <($out/bin/$tool completion zsh)
|
||||
done
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
find $out/bin $pause/bin -type f -exec remove-references-to -t ${go} '{}' +
|
||||
'';
|
||||
|
||||
meta = {
|
||||
meta = with lib; {
|
||||
description = "Production-Grade Container Scheduling and Management";
|
||||
license = licenses.asl20;
|
||||
homepage = "https://kubernetes.io";
|
||||
maintainers = with maintainers; [johanot offline saschagrunert];
|
||||
maintainers = with maintainers; [ johanot offline saschagrunert ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue