mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
add kubeconfig option
This commit is contained in:
parent
548188d3fa
commit
faad0c48ff
2 changed files with 11 additions and 0 deletions
|
|
@ -272,6 +272,13 @@ in {
|
|||
imports = [./base.nix];
|
||||
|
||||
options.kubernetes = {
|
||||
kubeconfig = mkOption {
|
||||
description = "path to kubeconfig file (default: use $KUBECONFIG)";
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "/run/secrets/kubeconfig";
|
||||
};
|
||||
|
||||
version = mkOption {
|
||||
description = "Kubernetes version to use";
|
||||
type = types.enum versions;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ writeShellScriptBin "kubenix" ''
|
|||
# if no args given, add empty string
|
||||
[ $# -eq 0 ] && set -- ""
|
||||
|
||||
# use kubeconfig, if given
|
||||
kubeconfig=$(nix eval '.#kubenix.config.kubernetes.kubeconfig' --raw)
|
||||
[ -n "$kubeconfig" ] && export KUBECONFIG=$kubeconfig
|
||||
|
||||
# parse arguments
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue