nixos/kubernetes: use kubectl from kubernetes

- also clarify kubectl wrapper naming
This commit is contained in:
zowoq 2022-02-16 10:05:14 +10:00
parent 43cc6e3246
commit ec2028eb3c
3 changed files with 5 additions and 5 deletions

View file

@ -266,7 +266,7 @@ in
in
''
export KUBECONFIG=${clusterAdminKubeconfig}
${kubectl}/bin/kubectl apply -f ${concatStringsSep " \\\n -f " files}
${kubernetes}/bin/kubectl apply -f ${concatStringsSep " \\\n -f " files}
'';
})]);

View file

@ -18,7 +18,7 @@ let
${master.ip} api.${domain}
${concatMapStringsSep "\n" (machineName: "${machines.${machineName}.ip} ${machineName}.${domain}") (attrNames machines)}
'';
kubectl = with pkgs; runCommand "wrap-kubectl" { buildInputs = [ makeWrapper ]; } ''
wrapKubectl = with pkgs; runCommand "wrap-kubectl" { buildInputs = [ makeWrapper ]; } ''
mkdir -p $out/bin
makeWrapper ${pkgs.kubernetes}/bin/kubectl $out/bin/kubectl --set KUBECONFIG "/etc/kubernetes/cluster-admin.kubeconfig"
'';
@ -48,7 +48,7 @@ let
};
};
programs.bash.enableCompletion = true;
environment.systemPackages = [ kubectl ];
environment.systemPackages = [ wrapKubectl ];
services.flannel.iface = "eth1";
services.kubernetes = {
proxy.hostname = "${masterName}.${domain}";

View file

@ -76,7 +76,7 @@ let
}];
});
kubectl = pkgs.runCommand "copy-kubectl" { buildInputs = [ pkgs.kubernetes ]; } ''
copyKubectl = pkgs.runCommand "copy-kubectl" { } ''
mkdir -p $out/bin
cp ${pkgs.kubernetes}/bin/kubectl $out/bin/kubectl
'';
@ -84,7 +84,7 @@ let
kubectlImage = pkgs.dockerTools.buildImage {
name = "kubectl";
tag = "latest";
contents = [ kubectl pkgs.busybox kubectlPod2 ];
contents = [ copyKubectl pkgs.busybox kubectlPod2 ];
config.Entrypoint = ["/bin/sh"];
};