From 465c60b408c69e64fd151d9bdb95444effc5b4f2 Mon Sep 17 00:00:00 2001 From: Blake Date: Mon, 26 Feb 2018 10:42:58 -0800 Subject: [PATCH] Add global kubecontext CLI flag Signed-off-by: Blake --- docs/cli-reference/ark.md | 1 + docs/cli-reference/ark_backup.md | 1 + docs/cli-reference/ark_backup_create.md | 1 + docs/cli-reference/ark_backup_delete.md | 1 + docs/cli-reference/ark_backup_describe.md | 1 + docs/cli-reference/ark_backup_download.md | 1 + docs/cli-reference/ark_backup_get.md | 1 + docs/cli-reference/ark_backup_logs.md | 1 + docs/cli-reference/ark_client.md | 1 + docs/cli-reference/ark_client_config.md | 1 + docs/cli-reference/ark_client_config_get.md | 1 + docs/cli-reference/ark_client_config_set.md | 1 + docs/cli-reference/ark_create.md | 1 + docs/cli-reference/ark_create_backup.md | 1 + docs/cli-reference/ark_create_restore.md | 1 + docs/cli-reference/ark_create_schedule.md | 1 + docs/cli-reference/ark_delete.md | 1 + docs/cli-reference/ark_delete_backup.md | 1 + docs/cli-reference/ark_delete_restore.md | 1 + docs/cli-reference/ark_delete_schedule.md | 1 + docs/cli-reference/ark_describe.md | 1 + docs/cli-reference/ark_describe_backups.md | 1 + docs/cli-reference/ark_describe_restores.md | 1 + docs/cli-reference/ark_describe_schedules.md | 1 + docs/cli-reference/ark_get.md | 1 + docs/cli-reference/ark_get_backups.md | 1 + docs/cli-reference/ark_get_restores.md | 1 + docs/cli-reference/ark_get_schedules.md | 1 + docs/cli-reference/ark_plugin.md | 1 + docs/cli-reference/ark_plugin_add.md | 1 + docs/cli-reference/ark_plugin_remove.md | 1 + docs/cli-reference/ark_restore.md | 1 + docs/cli-reference/ark_restore_create.md | 1 + docs/cli-reference/ark_restore_delete.md | 1 + docs/cli-reference/ark_restore_describe.md | 1 + docs/cli-reference/ark_restore_get.md | 1 + docs/cli-reference/ark_restore_logs.md | 1 + docs/cli-reference/ark_schedule.md | 1 + docs/cli-reference/ark_schedule_create.md | 1 + docs/cli-reference/ark_schedule_delete.md | 1 + docs/cli-reference/ark_schedule_describe.md | 1 + docs/cli-reference/ark_schedule_get.md | 1 + docs/cli-reference/ark_server.md | 1 + docs/cli-reference/ark_version.md | 1 + pkg/client/client.go | 10 ++++++---- pkg/client/factory.go | 14 ++++++++------ pkg/cmd/server/server.go | 2 +- 47 files changed, 59 insertions(+), 11 deletions(-) diff --git a/docs/cli-reference/ark.md b/docs/cli-reference/ark.md index daaf87f74..631f17824 100644 --- a/docs/cli-reference/ark.md +++ b/docs/cli-reference/ark.md @@ -19,6 +19,7 @@ operations can also be performed as 'ark backup get' and 'ark schedule create'. --alsologtostderr log to standard error as well as files -h, --help help for ark --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_backup.md b/docs/cli-reference/ark_backup.md index 1e7fb67b2..78c37bbf0 100644 --- a/docs/cli-reference/ark_backup.md +++ b/docs/cli-reference/ark_backup.md @@ -18,6 +18,7 @@ Work with backups ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_backup_create.md b/docs/cli-reference/ark_backup_create.md index 8f098c3c2..153e46128 100644 --- a/docs/cli-reference/ark_backup_create.md +++ b/docs/cli-reference/ark_backup_create.md @@ -34,6 +34,7 @@ ark backup create NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_backup_delete.md b/docs/cli-reference/ark_backup_delete.md index 33d8b984e..01ccdb473 100644 --- a/docs/cli-reference/ark_backup_delete.md +++ b/docs/cli-reference/ark_backup_delete.md @@ -22,6 +22,7 @@ ark backup delete NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_backup_describe.md b/docs/cli-reference/ark_backup_describe.md index 53d17e5b1..41691b500 100644 --- a/docs/cli-reference/ark_backup_describe.md +++ b/docs/cli-reference/ark_backup_describe.md @@ -23,6 +23,7 @@ ark backup describe [NAME1] [NAME2] [NAME...] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_backup_download.md b/docs/cli-reference/ark_backup_download.md index 68f98ff6b..e1b0c5800 100644 --- a/docs/cli-reference/ark_backup_download.md +++ b/docs/cli-reference/ark_backup_download.md @@ -25,6 +25,7 @@ ark backup download NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_backup_get.md b/docs/cli-reference/ark_backup_get.md index 3e289bd84..130e86c0a 100644 --- a/docs/cli-reference/ark_backup_get.md +++ b/docs/cli-reference/ark_backup_get.md @@ -26,6 +26,7 @@ ark backup get [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_backup_logs.md b/docs/cli-reference/ark_backup_logs.md index 0ee6c9d47..0850c7093 100644 --- a/docs/cli-reference/ark_backup_logs.md +++ b/docs/cli-reference/ark_backup_logs.md @@ -23,6 +23,7 @@ ark backup logs BACKUP [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_client.md b/docs/cli-reference/ark_client.md index 03c9d39c8..b2ea636b0 100644 --- a/docs/cli-reference/ark_client.md +++ b/docs/cli-reference/ark_client.md @@ -18,6 +18,7 @@ Ark client related commands ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_client_config.md b/docs/cli-reference/ark_client_config.md index b4ed2fa32..6d68053a0 100644 --- a/docs/cli-reference/ark_client_config.md +++ b/docs/cli-reference/ark_client_config.md @@ -18,6 +18,7 @@ Get and set client configuration file values ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_client_config_get.md b/docs/cli-reference/ark_client_config_get.md index 403966449..2e3d4d481 100644 --- a/docs/cli-reference/ark_client_config_get.md +++ b/docs/cli-reference/ark_client_config_get.md @@ -22,6 +22,7 @@ ark client config get [KEY 1] [KEY 2] [...] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_client_config_set.md b/docs/cli-reference/ark_client_config_set.md index af2c49728..7fddd86ca 100644 --- a/docs/cli-reference/ark_client_config_set.md +++ b/docs/cli-reference/ark_client_config_set.md @@ -22,6 +22,7 @@ ark client config set KEY=VALUE [KEY=VALUE]... [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_create.md b/docs/cli-reference/ark_create.md index afecb59a5..fc7934f14 100644 --- a/docs/cli-reference/ark_create.md +++ b/docs/cli-reference/ark_create.md @@ -18,6 +18,7 @@ Create ark resources ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_create_backup.md b/docs/cli-reference/ark_create_backup.md index 7a75e7319..3e94680e7 100644 --- a/docs/cli-reference/ark_create_backup.md +++ b/docs/cli-reference/ark_create_backup.md @@ -34,6 +34,7 @@ ark create backup NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_create_restore.md b/docs/cli-reference/ark_create_restore.md index 4b0242e51..38614a58d 100644 --- a/docs/cli-reference/ark_create_restore.md +++ b/docs/cli-reference/ark_create_restore.md @@ -34,6 +34,7 @@ ark create restore BACKUP [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_create_schedule.md b/docs/cli-reference/ark_create_schedule.md index 446543d88..470d4032e 100644 --- a/docs/cli-reference/ark_create_schedule.md +++ b/docs/cli-reference/ark_create_schedule.md @@ -35,6 +35,7 @@ ark create schedule NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_delete.md b/docs/cli-reference/ark_delete.md index 3aece2995..7016169ce 100644 --- a/docs/cli-reference/ark_delete.md +++ b/docs/cli-reference/ark_delete.md @@ -18,6 +18,7 @@ Delete ark resources ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_delete_backup.md b/docs/cli-reference/ark_delete_backup.md index 2ceb94dfa..4bd97cf6d 100644 --- a/docs/cli-reference/ark_delete_backup.md +++ b/docs/cli-reference/ark_delete_backup.md @@ -22,6 +22,7 @@ ark delete backup NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_delete_restore.md b/docs/cli-reference/ark_delete_restore.md index be7275bd2..44d77ab9c 100644 --- a/docs/cli-reference/ark_delete_restore.md +++ b/docs/cli-reference/ark_delete_restore.md @@ -22,6 +22,7 @@ ark delete restore NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_delete_schedule.md b/docs/cli-reference/ark_delete_schedule.md index 28677b11d..6131b0a37 100644 --- a/docs/cli-reference/ark_delete_schedule.md +++ b/docs/cli-reference/ark_delete_schedule.md @@ -22,6 +22,7 @@ ark delete schedule NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_describe.md b/docs/cli-reference/ark_describe.md index 046beac3a..a58c0eea7 100644 --- a/docs/cli-reference/ark_describe.md +++ b/docs/cli-reference/ark_describe.md @@ -18,6 +18,7 @@ Describe ark resources ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_describe_backups.md b/docs/cli-reference/ark_describe_backups.md index 31f10eacb..731355a90 100644 --- a/docs/cli-reference/ark_describe_backups.md +++ b/docs/cli-reference/ark_describe_backups.md @@ -23,6 +23,7 @@ ark describe backups [NAME1] [NAME2] [NAME...] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_describe_restores.md b/docs/cli-reference/ark_describe_restores.md index 22d2debf9..e0d401ca3 100644 --- a/docs/cli-reference/ark_describe_restores.md +++ b/docs/cli-reference/ark_describe_restores.md @@ -23,6 +23,7 @@ ark describe restores [NAME1] [NAME2] [NAME...] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_describe_schedules.md b/docs/cli-reference/ark_describe_schedules.md index ee7e8de5b..4b5dad30d 100644 --- a/docs/cli-reference/ark_describe_schedules.md +++ b/docs/cli-reference/ark_describe_schedules.md @@ -23,6 +23,7 @@ ark describe schedules [NAME1] [NAME2] [NAME...] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_get.md b/docs/cli-reference/ark_get.md index 585af6a09..4a91e8a66 100644 --- a/docs/cli-reference/ark_get.md +++ b/docs/cli-reference/ark_get.md @@ -18,6 +18,7 @@ Get ark resources ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_get_backups.md b/docs/cli-reference/ark_get_backups.md index 7fa64e48f..f010ae5eb 100644 --- a/docs/cli-reference/ark_get_backups.md +++ b/docs/cli-reference/ark_get_backups.md @@ -26,6 +26,7 @@ ark get backups [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_get_restores.md b/docs/cli-reference/ark_get_restores.md index 44eb931e2..382c27d4f 100644 --- a/docs/cli-reference/ark_get_restores.md +++ b/docs/cli-reference/ark_get_restores.md @@ -26,6 +26,7 @@ ark get restores [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_get_schedules.md b/docs/cli-reference/ark_get_schedules.md index a5d1e3649..2b8d1ce9a 100644 --- a/docs/cli-reference/ark_get_schedules.md +++ b/docs/cli-reference/ark_get_schedules.md @@ -26,6 +26,7 @@ ark get schedules [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_plugin.md b/docs/cli-reference/ark_plugin.md index 8e0f4347c..2dc71a5a9 100644 --- a/docs/cli-reference/ark_plugin.md +++ b/docs/cli-reference/ark_plugin.md @@ -18,6 +18,7 @@ Work with plugins ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_plugin_add.md b/docs/cli-reference/ark_plugin_add.md index 1f5d20a13..297cc6340 100644 --- a/docs/cli-reference/ark_plugin_add.md +++ b/docs/cli-reference/ark_plugin_add.md @@ -23,6 +23,7 @@ ark plugin add IMAGE [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_plugin_remove.md b/docs/cli-reference/ark_plugin_remove.md index fb46883ed..98a8d5b87 100644 --- a/docs/cli-reference/ark_plugin_remove.md +++ b/docs/cli-reference/ark_plugin_remove.md @@ -22,6 +22,7 @@ ark plugin remove [NAME | IMAGE] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_restore.md b/docs/cli-reference/ark_restore.md index 624b7cb59..b55f523ea 100644 --- a/docs/cli-reference/ark_restore.md +++ b/docs/cli-reference/ark_restore.md @@ -18,6 +18,7 @@ Work with restores ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_restore_create.md b/docs/cli-reference/ark_restore_create.md index c906c5b6e..c91056bfa 100644 --- a/docs/cli-reference/ark_restore_create.md +++ b/docs/cli-reference/ark_restore_create.md @@ -34,6 +34,7 @@ ark restore create BACKUP [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_restore_delete.md b/docs/cli-reference/ark_restore_delete.md index bb5f614ec..6835b07f7 100644 --- a/docs/cli-reference/ark_restore_delete.md +++ b/docs/cli-reference/ark_restore_delete.md @@ -22,6 +22,7 @@ ark restore delete NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_restore_describe.md b/docs/cli-reference/ark_restore_describe.md index 749173ee1..2c5732380 100644 --- a/docs/cli-reference/ark_restore_describe.md +++ b/docs/cli-reference/ark_restore_describe.md @@ -23,6 +23,7 @@ ark restore describe [NAME1] [NAME2] [NAME...] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_restore_get.md b/docs/cli-reference/ark_restore_get.md index 4f05fe34a..0ccd5631d 100644 --- a/docs/cli-reference/ark_restore_get.md +++ b/docs/cli-reference/ark_restore_get.md @@ -26,6 +26,7 @@ ark restore get [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_restore_logs.md b/docs/cli-reference/ark_restore_logs.md index 7c0d8da17..86abd6ea9 100644 --- a/docs/cli-reference/ark_restore_logs.md +++ b/docs/cli-reference/ark_restore_logs.md @@ -23,6 +23,7 @@ ark restore logs RESTORE [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_schedule.md b/docs/cli-reference/ark_schedule.md index 6c7b76ad7..586612b1d 100644 --- a/docs/cli-reference/ark_schedule.md +++ b/docs/cli-reference/ark_schedule.md @@ -18,6 +18,7 @@ Work with schedules ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_schedule_create.md b/docs/cli-reference/ark_schedule_create.md index ccf1727e1..9bfc09840 100644 --- a/docs/cli-reference/ark_schedule_create.md +++ b/docs/cli-reference/ark_schedule_create.md @@ -35,6 +35,7 @@ ark schedule create NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_schedule_delete.md b/docs/cli-reference/ark_schedule_delete.md index 230cf321a..40cd310e6 100644 --- a/docs/cli-reference/ark_schedule_delete.md +++ b/docs/cli-reference/ark_schedule_delete.md @@ -22,6 +22,7 @@ ark schedule delete NAME [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_schedule_describe.md b/docs/cli-reference/ark_schedule_describe.md index 92fc105b0..986951758 100644 --- a/docs/cli-reference/ark_schedule_describe.md +++ b/docs/cli-reference/ark_schedule_describe.md @@ -23,6 +23,7 @@ ark schedule describe [NAME1] [NAME2] [NAME...] [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_schedule_get.md b/docs/cli-reference/ark_schedule_get.md index 07c9730e3..488d047a8 100644 --- a/docs/cli-reference/ark_schedule_get.md +++ b/docs/cli-reference/ark_schedule_get.md @@ -26,6 +26,7 @@ ark schedule get [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_server.md b/docs/cli-reference/ark_server.md index d09140491..baeedb519 100644 --- a/docs/cli-reference/ark_server.md +++ b/docs/cli-reference/ark_server.md @@ -23,6 +23,7 @@ ark server [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/docs/cli-reference/ark_version.md b/docs/cli-reference/ark_version.md index 2a5848f4c..7aa4b75c8 100644 --- a/docs/cli-reference/ark_version.md +++ b/docs/cli-reference/ark_version.md @@ -22,6 +22,7 @@ ark version [flags] ``` --alsologtostderr log to standard error as well as files --kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration + --kubecontext string The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context) --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) --log_dir string If non-empty, write log files in this directory --logtostderr log to standard error instead of files diff --git a/pkg/client/client.go b/pkg/client/client.go index a43b0ac77..a4e406745 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -30,10 +30,12 @@ import ( // Config returns a *rest.Config, using either the kubeconfig (if specified) or an in-cluster // configuration. -func Config(kubeconfig, baseName string) (*rest.Config, error) { - loader := clientcmd.NewDefaultClientConfigLoadingRules() - loader.ExplicitPath = kubeconfig - clientConfig, err := clientcmd.BuildConfigFromKubeconfigGetter("", loader.Load) +func Config(kubeconfig, kubecontext, baseName string) (*rest.Config, error) { + loadingRules := clientcmd.NewDefaultClientConfigLoadingRules() + loadingRules.ExplicitPath = kubeconfig + configOverrides := &clientcmd.ConfigOverrides{CurrentContext: kubecontext} + kubeConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides) + clientConfig, err := kubeConfig.ClientConfig() if err != nil { return nil, errors.WithStack(err) } diff --git a/pkg/client/factory.go b/pkg/client/factory.go index 236e53e03..6dda5186c 100644 --- a/pkg/client/factory.go +++ b/pkg/client/factory.go @@ -43,10 +43,11 @@ type Factory interface { } type factory struct { - flags *pflag.FlagSet - kubeconfig string - baseName string - namespace string + flags *pflag.FlagSet + kubeconfig string + kubecontext string + baseName string + namespace string } // NewFactory returns a Factory. @@ -68,6 +69,7 @@ func NewFactory(baseName string) Factory { f.flags.StringVar(&f.kubeconfig, "kubeconfig", "", "Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration") f.flags.StringVarP(&f.namespace, "namespace", "n", f.namespace, "The namespace in which Ark should operate") + f.flags.StringVar(&f.kubecontext, "kubecontext", "", "The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context)") return f } @@ -77,7 +79,7 @@ func (f *factory) BindFlags(flags *pflag.FlagSet) { } func (f *factory) Client() (clientset.Interface, error) { - clientConfig, err := Config(f.kubeconfig, f.baseName) + clientConfig, err := Config(f.kubeconfig, f.kubecontext, f.baseName) if err != nil { return nil, err } @@ -90,7 +92,7 @@ func (f *factory) Client() (clientset.Interface, error) { } func (f *factory) KubeClient() (kubernetes.Interface, error) { - clientConfig, err := Config(f.kubeconfig, f.baseName) + clientConfig, err := Config(f.kubeconfig, f.kubecontext, f.baseName) if err != nil { return nil, err } diff --git a/pkg/cmd/server/server.go b/pkg/cmd/server/server.go index 534c8d9da..abb9cc4c5 100644 --- a/pkg/cmd/server/server.go +++ b/pkg/cmd/server/server.go @@ -176,7 +176,7 @@ type server struct { } func newServer(namespace, baseName string, logger *logrus.Logger) (*server, error) { - clientConfig, err := client.Config("", baseName) + clientConfig, err := client.Config("", "", baseName) if err != nil { return nil, err }