From 09b7d9b3cb1c12978857a05bf59ed1185b153274 Mon Sep 17 00:00:00 2001 From: Bryton Hall Date: Sun, 10 Dec 2023 10:19:59 -0500 Subject: [PATCH 1/2] default kubeconfig to $HOME/.kube/config --- CHANGELOG.md | 1 + modules/k8s.nix | 2 +- pkgs/kubenix.nix | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9279f54..c0c3061 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- default `kubernetes.kubeconfig` to `$HOME/.kube/config` - removed local `kubectl` and `kubernetes` packages in lieu of those from nixpkgs ## [0.2.0] - 2023-07-07 diff --git a/modules/k8s.nix b/modules/k8s.nix index 601ed2e..296fb0a 100644 --- a/modules/k8s.nix +++ b/modules/k8s.nix @@ -298,7 +298,7 @@ in kubeconfig = mkOption { description = "path to kubeconfig file (default: use $KUBECONFIG)"; type = types.nullOr types.str; - default = null; + default = "$HOME/.kube/config"; example = "/run/secrets/kubeconfig"; }; diff --git a/pkgs/kubenix.nix b/pkgs/kubenix.nix index 8cf93d5..fe5e670 100644 --- a/pkgs/kubenix.nix +++ b/pkgs/kubenix.nix @@ -14,7 +14,7 @@ let in runCommand "kubenix" { - kubeconfig = kubernetes.kubeconfig or ""; + inherit (kubernetes) kubeconfig; result = kubernetes.result or ""; # kubectl does some parsing which removes the -I flag so From 6809a5e7e1c1d1f094f3c79ce0e9a22ee2a88e45 Mon Sep 17 00:00:00 2001 From: David Costa Date: Sun, 21 Jan 2024 02:37:40 +0100 Subject: [PATCH 2/2] Do not override user KUBECONFIG (#50) --- pkgs/kubenix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/kubenix.nix b/pkgs/kubenix.nix index fe5e670..b6b770d 100644 --- a/pkgs/kubenix.nix +++ b/pkgs/kubenix.nix @@ -34,7 +34,7 @@ runCommand "kubenix" cat < $out/bin/kubenix set -uo pipefail - export KUBECONFIG=$kubeconfig + export KUBECONFIG=\''${KUBECONFIG:-$kubeconfig} export KUBECTL_EXTERNAL_DIFF=$diff function _help() {