From 78d7dca985ea1c4e1b0122043590eec4f437377e Mon Sep 17 00:00:00 2001 From: Sylvain Rabot Date: Mon, 2 Nov 2020 20:50:14 +0100 Subject: [PATCH] Add a --context option Signed-off-by: Sylvain Rabot --- cmd/flux/bootstrap_github.go | 2 +- cmd/flux/bootstrap_gitlab.go | 2 +- cmd/flux/create_alert.go | 2 +- cmd/flux/create_alertprovider.go | 2 +- cmd/flux/create_helmrelease.go | 2 +- cmd/flux/create_kustomization.go | 2 +- cmd/flux/create_receiver.go | 2 +- cmd/flux/create_source_bucket.go | 2 +- cmd/flux/create_source_git.go | 2 +- cmd/flux/create_source_helm.go | 2 +- cmd/flux/create_tenant.go | 2 +- cmd/flux/delete_alert.go | 2 +- cmd/flux/delete_alertprovider.go | 2 +- cmd/flux/delete_helmrelease.go | 2 +- cmd/flux/delete_kustomization.go | 2 +- cmd/flux/delete_receiver.go | 2 +- cmd/flux/delete_source_bucket.go | 2 +- cmd/flux/delete_source_git.go | 2 +- cmd/flux/delete_source_helm.go | 2 +- cmd/flux/export_alert.go | 2 +- cmd/flux/export_alertprovider.go | 2 +- cmd/flux/export_helmrelease.go | 2 +- cmd/flux/export_kustomization.go | 2 +- cmd/flux/export_receiver.go | 2 +- cmd/flux/export_source_bucket.go | 2 +- cmd/flux/export_source_git.go | 2 +- cmd/flux/export_source_helm.go | 2 +- cmd/flux/get_alert.go | 2 +- cmd/flux/get_alertprovider.go | 2 +- cmd/flux/get_helmrelease.go | 2 +- cmd/flux/get_kustomization.go | 2 +- cmd/flux/get_receiver.go | 2 +- cmd/flux/get_source_bucket.go | 2 +- cmd/flux/get_source_git.go | 2 +- cmd/flux/get_source_helm.go | 2 +- cmd/flux/main.go | 2 ++ cmd/flux/reconcile_alert.go | 2 +- cmd/flux/reconcile_alertprovider.go | 2 +- cmd/flux/reconcile_helmrelease.go | 2 +- cmd/flux/reconcile_kustomization.go | 2 +- cmd/flux/reconcile_receiver.go | 2 +- cmd/flux/reconcile_source_bucket.go | 2 +- cmd/flux/reconcile_source_git.go | 2 +- cmd/flux/reconcile_source_helm.go | 2 +- cmd/flux/resume_alert.go | 2 +- cmd/flux/resume_helmrelease.go | 2 +- cmd/flux/resume_kustomization.go | 2 +- cmd/flux/resume_receiver.go | 2 +- cmd/flux/suspend_alert.go | 2 +- cmd/flux/suspend_helmrelease.go | 2 +- cmd/flux/suspend_kustomization.go | 2 +- cmd/flux/suspend_receiver.go | 2 +- cmd/flux/uninstall.go | 2 +- docs/cmd/flux.md | 1 + docs/cmd/flux_bootstrap.md | 1 + docs/cmd/flux_bootstrap_github.md | 1 + docs/cmd/flux_bootstrap_gitlab.md | 1 + docs/cmd/flux_check.md | 1 + docs/cmd/flux_completion.md | 1 + docs/cmd/flux_completion_bash.md | 1 + docs/cmd/flux_completion_fish.md | 1 + docs/cmd/flux_completion_powershell.md | 1 + docs/cmd/flux_completion_zsh.md | 1 + docs/cmd/flux_create.md | 1 + docs/cmd/flux_create_alert-provider.md | 1 + docs/cmd/flux_create_alert.md | 1 + docs/cmd/flux_create_helmrelease.md | 1 + docs/cmd/flux_create_kustomization.md | 1 + docs/cmd/flux_create_receiver.md | 1 + docs/cmd/flux_create_source.md | 1 + docs/cmd/flux_create_source_bucket.md | 1 + docs/cmd/flux_create_source_git.md | 1 + docs/cmd/flux_create_source_helm.md | 1 + docs/cmd/flux_delete.md | 1 + docs/cmd/flux_delete_alert-provider.md | 1 + docs/cmd/flux_delete_alert.md | 1 + docs/cmd/flux_delete_helmrelease.md | 1 + docs/cmd/flux_delete_kustomization.md | 1 + docs/cmd/flux_delete_receiver.md | 1 + docs/cmd/flux_delete_source.md | 1 + docs/cmd/flux_delete_source_bucket.md | 1 + docs/cmd/flux_delete_source_git.md | 1 + docs/cmd/flux_delete_source_helm.md | 1 + docs/cmd/flux_export.md | 1 + docs/cmd/flux_export_alert-provider.md | 1 + docs/cmd/flux_export_alert.md | 1 + docs/cmd/flux_export_helmrelease.md | 1 + docs/cmd/flux_export_kustomization.md | 1 + docs/cmd/flux_export_receiver.md | 1 + docs/cmd/flux_export_source.md | 1 + docs/cmd/flux_export_source_bucket.md | 1 + docs/cmd/flux_export_source_git.md | 1 + docs/cmd/flux_export_source_helm.md | 1 + docs/cmd/flux_get.md | 1 + docs/cmd/flux_get_alert-providers.md | 1 + docs/cmd/flux_get_alerts.md | 1 + docs/cmd/flux_get_helmreleases.md | 1 + docs/cmd/flux_get_kustomizations.md | 1 + docs/cmd/flux_get_receivers.md | 1 + docs/cmd/flux_get_sources.md | 1 + docs/cmd/flux_get_sources_bucket.md | 1 + docs/cmd/flux_get_sources_git.md | 1 + docs/cmd/flux_get_sources_helm.md | 1 + docs/cmd/flux_install.md | 1 + docs/cmd/flux_reconcile.md | 1 + docs/cmd/flux_reconcile_alert-provider.md | 1 + docs/cmd/flux_reconcile_alert.md | 1 + docs/cmd/flux_reconcile_helmrelease.md | 1 + docs/cmd/flux_reconcile_kustomization.md | 1 + docs/cmd/flux_reconcile_receiver.md | 1 + docs/cmd/flux_reconcile_source.md | 1 + docs/cmd/flux_reconcile_source_bucket.md | 1 + docs/cmd/flux_reconcile_source_git.md | 1 + docs/cmd/flux_reconcile_source_helm.md | 1 + docs/cmd/flux_resume.md | 1 + docs/cmd/flux_resume_alert.md | 1 + docs/cmd/flux_resume_helmrelease.md | 1 + docs/cmd/flux_resume_kustomization.md | 1 + docs/cmd/flux_resume_receiver.md | 1 + docs/cmd/flux_suspend.md | 1 + docs/cmd/flux_suspend_alert.md | 1 + docs/cmd/flux_suspend_helmrelease.md | 1 + docs/cmd/flux_suspend_kustomization.md | 1 + docs/cmd/flux_suspend_receiver.md | 1 + docs/cmd/flux_uninstall.md | 1 + internal/utils/utils.go | 12 ++++++++++-- 126 files changed, 136 insertions(+), 54 deletions(-) diff --git a/cmd/flux/bootstrap_github.go b/cmd/flux/bootstrap_github.go index 08bfeedc19..5565a98ac8 100644 --- a/cmd/flux/bootstrap_github.go +++ b/cmd/flux/bootstrap_github.go @@ -184,7 +184,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error { logger.Successf("components are up to date") } - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/bootstrap_gitlab.go b/cmd/flux/bootstrap_gitlab.go index 5c1364ff92..5d504def91 100644 --- a/cmd/flux/bootstrap_gitlab.go +++ b/cmd/flux/bootstrap_gitlab.go @@ -113,7 +113,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error { IsPersonal: glPersonal, } - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_alert.go b/cmd/flux/create_alert.go index 1a570c0022..0edfd1c31c 100644 --- a/cmd/flux/create_alert.go +++ b/cmd/flux/create_alert.go @@ -120,7 +120,7 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_alertprovider.go b/cmd/flux/create_alertprovider.go index b1efbb2f32..71315f4e2a 100644 --- a/cmd/flux/create_alertprovider.go +++ b/cmd/flux/create_alertprovider.go @@ -116,7 +116,7 @@ func createAlertProviderCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_helmrelease.go b/cmd/flux/create_helmrelease.go index 99a198eace..f4c94ae0ac 100644 --- a/cmd/flux/create_helmrelease.go +++ b/cmd/flux/create_helmrelease.go @@ -177,7 +177,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_kustomization.go b/cmd/flux/create_kustomization.go index cf579aac99..03dd4c2d11 100644 --- a/cmd/flux/create_kustomization.go +++ b/cmd/flux/create_kustomization.go @@ -209,7 +209,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_receiver.go b/cmd/flux/create_receiver.go index 233f36cb4a..8576c4d46c 100644 --- a/cmd/flux/create_receiver.go +++ b/cmd/flux/create_receiver.go @@ -128,7 +128,7 @@ func createReceiverCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_source_bucket.go b/cmd/flux/create_source_bucket.go index 9bc9144c69..da50b56249 100644 --- a/cmd/flux/create_source_bucket.go +++ b/cmd/flux/create_source_bucket.go @@ -140,7 +140,7 @@ func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go index 7714c5c7cb..04ea0f3280 100644 --- a/cmd/flux/create_source_git.go +++ b/cmd/flux/create_source_git.go @@ -176,7 +176,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_source_helm.go b/cmd/flux/create_source_helm.go index 4a21c4e665..d6c94617f9 100644 --- a/cmd/flux/create_source_helm.go +++ b/cmd/flux/create_source_helm.go @@ -136,7 +136,7 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/create_tenant.go b/cmd/flux/create_tenant.go index b8a539bf16..e6a1a30a6c 100644 --- a/cmd/flux/create_tenant.go +++ b/cmd/flux/create_tenant.go @@ -145,7 +145,7 @@ func createTenantCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_alert.go b/cmd/flux/delete_alert.go index ce48ef894a..bb8cb0bcf6 100644 --- a/cmd/flux/delete_alert.go +++ b/cmd/flux/delete_alert.go @@ -51,7 +51,7 @@ func deleteAlertCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_alertprovider.go b/cmd/flux/delete_alertprovider.go index 7487e0892b..c3ebc90850 100644 --- a/cmd/flux/delete_alertprovider.go +++ b/cmd/flux/delete_alertprovider.go @@ -51,7 +51,7 @@ func deleteAlertProviderCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_helmrelease.go b/cmd/flux/delete_helmrelease.go index d14227a9e0..47249bda07 100644 --- a/cmd/flux/delete_helmrelease.go +++ b/cmd/flux/delete_helmrelease.go @@ -52,7 +52,7 @@ func deleteHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_kustomization.go b/cmd/flux/delete_kustomization.go index aa89929602..0d1fef3db2 100644 --- a/cmd/flux/delete_kustomization.go +++ b/cmd/flux/delete_kustomization.go @@ -51,7 +51,7 @@ func deleteKsCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_receiver.go b/cmd/flux/delete_receiver.go index 618fa30754..b92fe83f5d 100644 --- a/cmd/flux/delete_receiver.go +++ b/cmd/flux/delete_receiver.go @@ -51,7 +51,7 @@ func deleteReceiverCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_source_bucket.go b/cmd/flux/delete_source_bucket.go index 812defd708..ccdcf3f1c1 100644 --- a/cmd/flux/delete_source_bucket.go +++ b/cmd/flux/delete_source_bucket.go @@ -50,7 +50,7 @@ func deleteSourceBucketCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_source_git.go b/cmd/flux/delete_source_git.go index 7b350ff484..7173c3a1d1 100644 --- a/cmd/flux/delete_source_git.go +++ b/cmd/flux/delete_source_git.go @@ -50,7 +50,7 @@ func deleteSourceGitCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/delete_source_helm.go b/cmd/flux/delete_source_helm.go index 0cc83e876d..5eb10d5145 100644 --- a/cmd/flux/delete_source_helm.go +++ b/cmd/flux/delete_source_helm.go @@ -50,7 +50,7 @@ func deleteSourceHelmCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_alert.go b/cmd/flux/export_alert.go index 43bf7373f0..8fa7ba4214 100644 --- a/cmd/flux/export_alert.go +++ b/cmd/flux/export_alert.go @@ -55,7 +55,7 @@ func exportAlertCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_alertprovider.go b/cmd/flux/export_alertprovider.go index 0bc3747f94..2d805e4000 100644 --- a/cmd/flux/export_alertprovider.go +++ b/cmd/flux/export_alertprovider.go @@ -55,7 +55,7 @@ func exportAlertProviderCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_helmrelease.go b/cmd/flux/export_helmrelease.go index e533ae23fc..dff04b61e4 100644 --- a/cmd/flux/export_helmrelease.go +++ b/cmd/flux/export_helmrelease.go @@ -56,7 +56,7 @@ func exportHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_kustomization.go b/cmd/flux/export_kustomization.go index 4a28e91e34..86c33aca2a 100644 --- a/cmd/flux/export_kustomization.go +++ b/cmd/flux/export_kustomization.go @@ -56,7 +56,7 @@ func exportKsCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_receiver.go b/cmd/flux/export_receiver.go index 654c82ec47..ebecabef69 100644 --- a/cmd/flux/export_receiver.go +++ b/cmd/flux/export_receiver.go @@ -55,7 +55,7 @@ func exportReceiverCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_source_bucket.go b/cmd/flux/export_source_bucket.go index c7acd500dc..32e2032256 100644 --- a/cmd/flux/export_source_bucket.go +++ b/cmd/flux/export_source_bucket.go @@ -56,7 +56,7 @@ func exportSourceBucketCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_source_git.go b/cmd/flux/export_source_git.go index 038a877277..6a422d7852 100644 --- a/cmd/flux/export_source_git.go +++ b/cmd/flux/export_source_git.go @@ -56,7 +56,7 @@ func exportSourceGitCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/export_source_helm.go b/cmd/flux/export_source_helm.go index 879af6c543..756bf7fa83 100644 --- a/cmd/flux/export_source_helm.go +++ b/cmd/flux/export_source_helm.go @@ -56,7 +56,7 @@ func exportSourceHelmCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_alert.go b/cmd/flux/get_alert.go index 9bf17c53f4..c66c6e74ab 100644 --- a/cmd/flux/get_alert.go +++ b/cmd/flux/get_alert.go @@ -49,7 +49,7 @@ func getAlertCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_alertprovider.go b/cmd/flux/get_alertprovider.go index 1342057a0a..cb1bda4a15 100644 --- a/cmd/flux/get_alertprovider.go +++ b/cmd/flux/get_alertprovider.go @@ -47,7 +47,7 @@ func getAlertProviderCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_helmrelease.go b/cmd/flux/get_helmrelease.go index 6d97024435..ce093f9325 100644 --- a/cmd/flux/get_helmrelease.go +++ b/cmd/flux/get_helmrelease.go @@ -51,7 +51,7 @@ func getHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_kustomization.go b/cmd/flux/get_kustomization.go index d56ea34cde..475767c52f 100644 --- a/cmd/flux/get_kustomization.go +++ b/cmd/flux/get_kustomization.go @@ -50,7 +50,7 @@ func getKsCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_receiver.go b/cmd/flux/get_receiver.go index 6ae69c602e..4bcfb11a68 100644 --- a/cmd/flux/get_receiver.go +++ b/cmd/flux/get_receiver.go @@ -49,7 +49,7 @@ func getReceiverCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_source_bucket.go b/cmd/flux/get_source_bucket.go index e8026b83c3..c798393622 100644 --- a/cmd/flux/get_source_bucket.go +++ b/cmd/flux/get_source_bucket.go @@ -47,7 +47,7 @@ func getSourceBucketCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_source_git.go b/cmd/flux/get_source_git.go index 04f0526c99..f187802768 100644 --- a/cmd/flux/get_source_git.go +++ b/cmd/flux/get_source_git.go @@ -47,7 +47,7 @@ func getSourceGitCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/get_source_helm.go b/cmd/flux/get_source_helm.go index 639fd0e65c..daec292d6b 100644 --- a/cmd/flux/get_source_helm.go +++ b/cmd/flux/get_source_helm.go @@ -47,7 +47,7 @@ func getSourceHelmCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/main.go b/cmd/flux/main.go index 4205b08262..e9742fd514 100644 --- a/cmd/flux/main.go +++ b/cmd/flux/main.go @@ -96,6 +96,7 @@ var rootCmd = &cobra.Command{ var ( kubeconfig string + kubecontext string namespace string timeout time.Duration verbose bool @@ -108,6 +109,7 @@ func init() { rootCmd.PersistentFlags().StringVarP(&namespace, "namespace", "n", defaults.Namespace, "the namespace scope for this operation") rootCmd.PersistentFlags().DurationVar(&timeout, "timeout", 5*time.Minute, "timeout for this operation") rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "print generated objects") + rootCmd.PersistentFlags().StringVarP(&kubecontext, "context", "", "", "kubernetes context to use") } func main() { diff --git a/cmd/flux/reconcile_alert.go b/cmd/flux/reconcile_alert.go index f895a60801..71b5286793 100644 --- a/cmd/flux/reconcile_alert.go +++ b/cmd/flux/reconcile_alert.go @@ -54,7 +54,7 @@ func reconcileAlertCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/reconcile_alertprovider.go b/cmd/flux/reconcile_alertprovider.go index 5c5b829d93..3b76bf00a0 100644 --- a/cmd/flux/reconcile_alertprovider.go +++ b/cmd/flux/reconcile_alertprovider.go @@ -54,7 +54,7 @@ func reconcileAlertProviderCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/reconcile_helmrelease.go b/cmd/flux/reconcile_helmrelease.go index 3371d184e8..9c5a6a6302 100644 --- a/cmd/flux/reconcile_helmrelease.go +++ b/cmd/flux/reconcile_helmrelease.go @@ -69,7 +69,7 @@ func reconcileHrCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/reconcile_kustomization.go b/cmd/flux/reconcile_kustomization.go index 09e7ff67c4..2f1940dd84 100644 --- a/cmd/flux/reconcile_kustomization.go +++ b/cmd/flux/reconcile_kustomization.go @@ -69,7 +69,7 @@ func reconcileKsCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/reconcile_receiver.go b/cmd/flux/reconcile_receiver.go index a874b3912d..16ce2e55e2 100644 --- a/cmd/flux/reconcile_receiver.go +++ b/cmd/flux/reconcile_receiver.go @@ -54,7 +54,7 @@ func reconcileReceiverCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/reconcile_source_bucket.go b/cmd/flux/reconcile_source_bucket.go index 40c237f3c7..f1a638e510 100644 --- a/cmd/flux/reconcile_source_bucket.go +++ b/cmd/flux/reconcile_source_bucket.go @@ -56,7 +56,7 @@ func reconcileSourceBucketCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/reconcile_source_git.go b/cmd/flux/reconcile_source_git.go index 2a60328568..31cbc0b118 100644 --- a/cmd/flux/reconcile_source_git.go +++ b/cmd/flux/reconcile_source_git.go @@ -54,7 +54,7 @@ func reconcileSourceGitCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/reconcile_source_helm.go b/cmd/flux/reconcile_source_helm.go index ae50c6120b..066509b706 100644 --- a/cmd/flux/reconcile_source_helm.go +++ b/cmd/flux/reconcile_source_helm.go @@ -56,7 +56,7 @@ func reconcileSourceHelmCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/resume_alert.go b/cmd/flux/resume_alert.go index 5186392e1f..fcb5aab0c1 100644 --- a/cmd/flux/resume_alert.go +++ b/cmd/flux/resume_alert.go @@ -56,7 +56,7 @@ func resumeAlertCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/resume_helmrelease.go b/cmd/flux/resume_helmrelease.go index 0558d3a90e..3cafd0f565 100644 --- a/cmd/flux/resume_helmrelease.go +++ b/cmd/flux/resume_helmrelease.go @@ -57,7 +57,7 @@ func resumeHrCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/resume_kustomization.go b/cmd/flux/resume_kustomization.go index 9de37bb770..b6e4dd6a00 100644 --- a/cmd/flux/resume_kustomization.go +++ b/cmd/flux/resume_kustomization.go @@ -56,7 +56,7 @@ func resumeKsCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/resume_receiver.go b/cmd/flux/resume_receiver.go index 7e51477f64..42c829f86f 100644 --- a/cmd/flux/resume_receiver.go +++ b/cmd/flux/resume_receiver.go @@ -56,7 +56,7 @@ func resumeReceiverCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/suspend_alert.go b/cmd/flux/suspend_alert.go index e9f589434e..6d2b11d9c4 100644 --- a/cmd/flux/suspend_alert.go +++ b/cmd/flux/suspend_alert.go @@ -50,7 +50,7 @@ func suspendAlertCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/suspend_helmrelease.go b/cmd/flux/suspend_helmrelease.go index 32029b36f5..eef5c05be7 100644 --- a/cmd/flux/suspend_helmrelease.go +++ b/cmd/flux/suspend_helmrelease.go @@ -51,7 +51,7 @@ func suspendHrCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/suspend_kustomization.go b/cmd/flux/suspend_kustomization.go index c9723bc00a..39dc9167c4 100644 --- a/cmd/flux/suspend_kustomization.go +++ b/cmd/flux/suspend_kustomization.go @@ -50,7 +50,7 @@ func suspendKsCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/suspend_receiver.go b/cmd/flux/suspend_receiver.go index 0dbb763e3c..e8877e77ae 100644 --- a/cmd/flux/suspend_receiver.go +++ b/cmd/flux/suspend_receiver.go @@ -50,7 +50,7 @@ func suspendReceiverCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/cmd/flux/uninstall.go b/cmd/flux/uninstall.go index eed2f49318..35a615d291 100644 --- a/cmd/flux/uninstall.go +++ b/cmd/flux/uninstall.go @@ -69,7 +69,7 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - kubeClient, err := utils.KubeClient(kubeconfig) + kubeClient, err := utils.KubeClient(kubeconfig, kubecontext) if err != nil { return err } diff --git a/docs/cmd/flux.md b/docs/cmd/flux.md index cde824d8ed..34b9ea8506 100644 --- a/docs/cmd/flux.md +++ b/docs/cmd/flux.md @@ -67,6 +67,7 @@ Command line utility for assembling Kubernetes CD pipelines the GitOps way. ### Options ``` + --context string kubernetes context to use -h, --help help for flux --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") diff --git a/docs/cmd/flux_bootstrap.md b/docs/cmd/flux_bootstrap.md index 9295229cb0..5a74161ae9 100644 --- a/docs/cmd/flux_bootstrap.md +++ b/docs/cmd/flux_bootstrap.md @@ -24,6 +24,7 @@ The bootstrap sub-commands bootstrap the toolkit components on the targeted Git ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_bootstrap_github.md b/docs/cmd/flux_bootstrap_github.md index bb3d4bc14d..a105a216fc 100644 --- a/docs/cmd/flux_bootstrap_github.md +++ b/docs/cmd/flux_bootstrap_github.md @@ -60,6 +60,7 @@ flux bootstrap github [flags] --arch arch cluster architecture, available options are: (amd64, arm, arm64) (default amd64) --branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main") --components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller]) + --context string kubernetes context to use --image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry --kubeconfig string path to the kubeconfig file (default "~/.kube/config") --log-level logLevel log level, available options are: (debug, info, error) (default info) diff --git a/docs/cmd/flux_bootstrap_gitlab.md b/docs/cmd/flux_bootstrap_gitlab.md index e320dff195..131d7441b9 100644 --- a/docs/cmd/flux_bootstrap_gitlab.md +++ b/docs/cmd/flux_bootstrap_gitlab.md @@ -60,6 +60,7 @@ flux bootstrap gitlab [flags] --arch arch cluster architecture, available options are: (amd64, arm, arm64) (default amd64) --branch string default branch (for GitHub this must match the default branch setting for the organization) (default "main") --components strings list of components, accepts comma-separated values (default [source-controller,kustomize-controller,helm-controller,notification-controller]) + --context string kubernetes context to use --image-pull-secret string Kubernetes secret name used for pulling the toolkit images from a private registry --kubeconfig string path to the kubeconfig file (default "~/.kube/config") --log-level logLevel log level, available options are: (debug, info, error) (default info) diff --git a/docs/cmd/flux_check.md b/docs/cmd/flux_check.md index d84f6ee80d..dd39732634 100644 --- a/docs/cmd/flux_check.md +++ b/docs/cmd/flux_check.md @@ -33,6 +33,7 @@ flux check [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_completion.md b/docs/cmd/flux_completion.md index c129c2681d..ef0e00c80f 100644 --- a/docs/cmd/flux_completion.md +++ b/docs/cmd/flux_completion.md @@ -15,6 +15,7 @@ The completion sub-command generates completion scripts for various shells ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_completion_bash.md b/docs/cmd/flux_completion_bash.md index 1d774ca652..c0038fe381 100644 --- a/docs/cmd/flux_completion_bash.md +++ b/docs/cmd/flux_completion_bash.md @@ -33,6 +33,7 @@ command -v flux >/dev/null && . <(flux completion bash) ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_completion_fish.md b/docs/cmd/flux_completion_fish.md index 37dd69f8e2..662b9f7ed0 100644 --- a/docs/cmd/flux_completion_fish.md +++ b/docs/cmd/flux_completion_fish.md @@ -34,6 +34,7 @@ See http://fishshell.com/docs/current/index.html#completion-own for more details ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_completion_powershell.md b/docs/cmd/flux_completion_powershell.md index f2980bb135..92de9eded0 100644 --- a/docs/cmd/flux_completion_powershell.md +++ b/docs/cmd/flux_completion_powershell.md @@ -40,6 +40,7 @@ flux completion >> flux-completions.ps1 ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_completion_zsh.md b/docs/cmd/flux_completion_zsh.md index 3b7c51fd64..f77af5ea24 100644 --- a/docs/cmd/flux_completion_zsh.md +++ b/docs/cmd/flux_completion_zsh.md @@ -41,6 +41,7 @@ mv _flux ~/.zprezto/modules/completion/external/src/ # zprezto ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_create.md b/docs/cmd/flux_create.md index 4f5a8e0137..48acbae77c 100644 --- a/docs/cmd/flux_create.md +++ b/docs/cmd/flux_create.md @@ -18,6 +18,7 @@ The create sub-commands generate sources and resources. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_create_alert-provider.md b/docs/cmd/flux_create_alert-provider.md index 80d8cf173f..27af0b8931 100644 --- a/docs/cmd/flux_create_alert-provider.md +++ b/docs/cmd/flux_create_alert-provider.md @@ -42,6 +42,7 @@ flux create alert-provider [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_alert.md b/docs/cmd/flux_create_alert.md index c5a2a3fef2..be8abd0b41 100644 --- a/docs/cmd/flux_create_alert.md +++ b/docs/cmd/flux_create_alert.md @@ -34,6 +34,7 @@ flux create alert [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_helmrelease.md b/docs/cmd/flux_create_helmrelease.md index 86fa38ecf3..e14812968a 100644 --- a/docs/cmd/flux_create_helmrelease.md +++ b/docs/cmd/flux_create_helmrelease.md @@ -75,6 +75,7 @@ flux create helmrelease [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_kustomization.md b/docs/cmd/flux_create_kustomization.md index 098fa9e16b..39cb8cc3d6 100644 --- a/docs/cmd/flux_create_kustomization.md +++ b/docs/cmd/flux_create_kustomization.md @@ -61,6 +61,7 @@ flux create kustomization [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_receiver.md b/docs/cmd/flux_create_receiver.md index 69437bad8b..6167fb0fd0 100644 --- a/docs/cmd/flux_create_receiver.md +++ b/docs/cmd/flux_create_receiver.md @@ -37,6 +37,7 @@ flux create receiver [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_source.md b/docs/cmd/flux_create_source.md index 067cca6dc1..83e5137f4c 100644 --- a/docs/cmd/flux_create_source.md +++ b/docs/cmd/flux_create_source.md @@ -15,6 +15,7 @@ The create source sub-commands generate sources. ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_source_bucket.md b/docs/cmd/flux_create_source_bucket.md index b1f7b408b7..5254b5b44d 100644 --- a/docs/cmd/flux_create_source_bucket.md +++ b/docs/cmd/flux_create_source_bucket.md @@ -51,6 +51,7 @@ flux create source bucket [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_source_git.md b/docs/cmd/flux_create_source_git.md index 5aa1b98492..0a1110fb64 100644 --- a/docs/cmd/flux_create_source_git.md +++ b/docs/cmd/flux_create_source_git.md @@ -71,6 +71,7 @@ flux create source git [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_create_source_helm.md b/docs/cmd/flux_create_source_helm.md index 0d5be022e9..267727db8d 100644 --- a/docs/cmd/flux_create_source_helm.md +++ b/docs/cmd/flux_create_source_helm.md @@ -51,6 +51,7 @@ flux create source helm [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --export export in YAML format to stdout --interval duration source sync interval (default 1m0s) --kubeconfig string path to the kubeconfig file (default "~/.kube/config") diff --git a/docs/cmd/flux_delete.md b/docs/cmd/flux_delete.md index 0e01c53ed8..2628ab8fa7 100644 --- a/docs/cmd/flux_delete.md +++ b/docs/cmd/flux_delete.md @@ -16,6 +16,7 @@ The delete sub-commands delete sources and resources. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_delete_alert-provider.md b/docs/cmd/flux_delete_alert-provider.md index 66b9618153..2e24c6508a 100644 --- a/docs/cmd/flux_delete_alert-provider.md +++ b/docs/cmd/flux_delete_alert-provider.md @@ -27,6 +27,7 @@ flux delete alert-provider [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_alert.md b/docs/cmd/flux_delete_alert.md index f596e32d23..caa6aac0c0 100644 --- a/docs/cmd/flux_delete_alert.md +++ b/docs/cmd/flux_delete_alert.md @@ -27,6 +27,7 @@ flux delete alert [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_helmrelease.md b/docs/cmd/flux_delete_helmrelease.md index dbfc70d212..0b0b399750 100644 --- a/docs/cmd/flux_delete_helmrelease.md +++ b/docs/cmd/flux_delete_helmrelease.md @@ -27,6 +27,7 @@ flux delete helmrelease [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_kustomization.md b/docs/cmd/flux_delete_kustomization.md index d4a2ed253e..f25c7fb939 100644 --- a/docs/cmd/flux_delete_kustomization.md +++ b/docs/cmd/flux_delete_kustomization.md @@ -27,6 +27,7 @@ flux delete kustomization [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_receiver.md b/docs/cmd/flux_delete_receiver.md index bd3324e363..459aa6cdaa 100644 --- a/docs/cmd/flux_delete_receiver.md +++ b/docs/cmd/flux_delete_receiver.md @@ -27,6 +27,7 @@ flux delete receiver [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_source.md b/docs/cmd/flux_delete_source.md index a5442963d0..291eccab0b 100644 --- a/docs/cmd/flux_delete_source.md +++ b/docs/cmd/flux_delete_source.md @@ -15,6 +15,7 @@ The delete source sub-commands delete sources. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_source_bucket.md b/docs/cmd/flux_delete_source_bucket.md index f4045d18bd..3d437878ec 100644 --- a/docs/cmd/flux_delete_source_bucket.md +++ b/docs/cmd/flux_delete_source_bucket.md @@ -27,6 +27,7 @@ flux delete source bucket [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_source_git.md b/docs/cmd/flux_delete_source_git.md index 287e61a18d..a2dc1cb25b 100644 --- a/docs/cmd/flux_delete_source_git.md +++ b/docs/cmd/flux_delete_source_git.md @@ -27,6 +27,7 @@ flux delete source git [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_delete_source_helm.md b/docs/cmd/flux_delete_source_helm.md index cd3aed25e1..2063fb452d 100644 --- a/docs/cmd/flux_delete_source_helm.md +++ b/docs/cmd/flux_delete_source_helm.md @@ -27,6 +27,7 @@ flux delete source helm [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") -s, --silent delete resource without asking for confirmation diff --git a/docs/cmd/flux_export.md b/docs/cmd/flux_export.md index 4430bc113f..434810a854 100644 --- a/docs/cmd/flux_export.md +++ b/docs/cmd/flux_export.md @@ -16,6 +16,7 @@ The export sub-commands export resources in YAML format. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_alert-provider.md b/docs/cmd/flux_export_alert-provider.md index 590759f27a..be1452adcf 100644 --- a/docs/cmd/flux_export_alert-provider.md +++ b/docs/cmd/flux_export_alert-provider.md @@ -31,6 +31,7 @@ flux export alert-provider [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_alert.md b/docs/cmd/flux_export_alert.md index c8bc4e85c5..97891971fa 100644 --- a/docs/cmd/flux_export_alert.md +++ b/docs/cmd/flux_export_alert.md @@ -31,6 +31,7 @@ flux export alert [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_helmrelease.md b/docs/cmd/flux_export_helmrelease.md index 68c2d93cfa..9e22666d7e 100644 --- a/docs/cmd/flux_export_helmrelease.md +++ b/docs/cmd/flux_export_helmrelease.md @@ -31,6 +31,7 @@ flux export helmrelease [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_kustomization.md b/docs/cmd/flux_export_kustomization.md index 6e635f8d9c..c201ce24c7 100644 --- a/docs/cmd/flux_export_kustomization.md +++ b/docs/cmd/flux_export_kustomization.md @@ -31,6 +31,7 @@ flux export kustomization [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_receiver.md b/docs/cmd/flux_export_receiver.md index a9544316c8..19e6e4239a 100644 --- a/docs/cmd/flux_export_receiver.md +++ b/docs/cmd/flux_export_receiver.md @@ -31,6 +31,7 @@ flux export receiver [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_source.md b/docs/cmd/flux_export_source.md index 7ab2d58df7..e24c8d5d35 100644 --- a/docs/cmd/flux_export_source.md +++ b/docs/cmd/flux_export_source.md @@ -17,6 +17,7 @@ The export source sub-commands export sources in YAML format. ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_source_bucket.md b/docs/cmd/flux_export_source_bucket.md index df5ad19cc2..7394f971a6 100644 --- a/docs/cmd/flux_export_source_bucket.md +++ b/docs/cmd/flux_export_source_bucket.md @@ -31,6 +31,7 @@ flux export source bucket [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_source_git.md b/docs/cmd/flux_export_source_git.md index df2419fcbd..a50f1b9479 100644 --- a/docs/cmd/flux_export_source_git.md +++ b/docs/cmd/flux_export_source_git.md @@ -31,6 +31,7 @@ flux export source git [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_export_source_helm.md b/docs/cmd/flux_export_source_helm.md index f4172bf386..3c33da82da 100644 --- a/docs/cmd/flux_export_source_helm.md +++ b/docs/cmd/flux_export_source_helm.md @@ -31,6 +31,7 @@ flux export source helm [name] [flags] ``` --all select all resources + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get.md b/docs/cmd/flux_get.md index 794eceeac1..9da674486d 100644 --- a/docs/cmd/flux_get.md +++ b/docs/cmd/flux_get.md @@ -16,6 +16,7 @@ The get sub-commands print the statuses of sources and resources. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_alert-providers.md b/docs/cmd/flux_get_alert-providers.md index e570bf60eb..dc6c63637b 100644 --- a/docs/cmd/flux_get_alert-providers.md +++ b/docs/cmd/flux_get_alert-providers.md @@ -28,6 +28,7 @@ flux get alert-providers [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_alerts.md b/docs/cmd/flux_get_alerts.md index 7afda065b6..95ad76720f 100644 --- a/docs/cmd/flux_get_alerts.md +++ b/docs/cmd/flux_get_alerts.md @@ -28,6 +28,7 @@ flux get alerts [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_helmreleases.md b/docs/cmd/flux_get_helmreleases.md index aec7ab8004..9a7bc66ca6 100644 --- a/docs/cmd/flux_get_helmreleases.md +++ b/docs/cmd/flux_get_helmreleases.md @@ -28,6 +28,7 @@ flux get helmreleases [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_kustomizations.md b/docs/cmd/flux_get_kustomizations.md index 08f35b5b4f..f4a2fd4243 100644 --- a/docs/cmd/flux_get_kustomizations.md +++ b/docs/cmd/flux_get_kustomizations.md @@ -28,6 +28,7 @@ flux get kustomizations [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_receivers.md b/docs/cmd/flux_get_receivers.md index 23b4f8d17f..94d27afae8 100644 --- a/docs/cmd/flux_get_receivers.md +++ b/docs/cmd/flux_get_receivers.md @@ -28,6 +28,7 @@ flux get receivers [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_sources.md b/docs/cmd/flux_get_sources.md index 44fc03f9df..34f61be4d9 100644 --- a/docs/cmd/flux_get_sources.md +++ b/docs/cmd/flux_get_sources.md @@ -16,6 +16,7 @@ The get source sub-commands print the statuses of the sources. ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_sources_bucket.md b/docs/cmd/flux_get_sources_bucket.md index c5e39d1f30..352bcc374a 100644 --- a/docs/cmd/flux_get_sources_bucket.md +++ b/docs/cmd/flux_get_sources_bucket.md @@ -28,6 +28,7 @@ flux get sources bucket [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_sources_git.md b/docs/cmd/flux_get_sources_git.md index 41d35cb7df..ceb22ad3b5 100644 --- a/docs/cmd/flux_get_sources_git.md +++ b/docs/cmd/flux_get_sources_git.md @@ -28,6 +28,7 @@ flux get sources git [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_get_sources_helm.md b/docs/cmd/flux_get_sources_helm.md index c1231319b7..69e5bbf4cb 100644 --- a/docs/cmd/flux_get_sources_helm.md +++ b/docs/cmd/flux_get_sources_helm.md @@ -28,6 +28,7 @@ flux get sources helm [flags] ``` -A, --all-namespaces list the requested object(s) across all namespaces + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_install.md b/docs/cmd/flux_install.md index 99eaba15d1..fbdab64f1c 100644 --- a/docs/cmd/flux_install.md +++ b/docs/cmd/flux_install.md @@ -47,6 +47,7 @@ flux install [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile.md b/docs/cmd/flux_reconcile.md index feb9525d5c..82434e5f85 100644 --- a/docs/cmd/flux_reconcile.md +++ b/docs/cmd/flux_reconcile.md @@ -15,6 +15,7 @@ The reconcile sub-commands trigger a reconciliation of sources and resources. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_alert-provider.md b/docs/cmd/flux_reconcile_alert-provider.md index e8001f2917..3c01e048c4 100644 --- a/docs/cmd/flux_reconcile_alert-provider.md +++ b/docs/cmd/flux_reconcile_alert-provider.md @@ -27,6 +27,7 @@ flux reconcile alert-provider [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_alert.md b/docs/cmd/flux_reconcile_alert.md index b04a88791f..0d955dbd0b 100644 --- a/docs/cmd/flux_reconcile_alert.md +++ b/docs/cmd/flux_reconcile_alert.md @@ -27,6 +27,7 @@ flux reconcile alert [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_helmrelease.md b/docs/cmd/flux_reconcile_helmrelease.md index 4daa63aab8..38424bb7e5 100644 --- a/docs/cmd/flux_reconcile_helmrelease.md +++ b/docs/cmd/flux_reconcile_helmrelease.md @@ -32,6 +32,7 @@ flux reconcile helmrelease [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_kustomization.md b/docs/cmd/flux_reconcile_kustomization.md index 068b091dab..ff838caccc 100644 --- a/docs/cmd/flux_reconcile_kustomization.md +++ b/docs/cmd/flux_reconcile_kustomization.md @@ -32,6 +32,7 @@ flux reconcile kustomization [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_receiver.md b/docs/cmd/flux_reconcile_receiver.md index a53a034f4f..f6ef4c136f 100644 --- a/docs/cmd/flux_reconcile_receiver.md +++ b/docs/cmd/flux_reconcile_receiver.md @@ -27,6 +27,7 @@ flux reconcile receiver [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_source.md b/docs/cmd/flux_reconcile_source.md index 8a17561605..c1f2d9a6ec 100644 --- a/docs/cmd/flux_reconcile_source.md +++ b/docs/cmd/flux_reconcile_source.md @@ -15,6 +15,7 @@ The reconcile source sub-commands trigger a reconciliation of sources. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_source_bucket.md b/docs/cmd/flux_reconcile_source_bucket.md index 679c74abdd..33dd2eba34 100644 --- a/docs/cmd/flux_reconcile_source_bucket.md +++ b/docs/cmd/flux_reconcile_source_bucket.md @@ -27,6 +27,7 @@ flux reconcile source bucket [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_source_git.md b/docs/cmd/flux_reconcile_source_git.md index 6a2edf0d17..52d77492d3 100644 --- a/docs/cmd/flux_reconcile_source_git.md +++ b/docs/cmd/flux_reconcile_source_git.md @@ -27,6 +27,7 @@ flux reconcile source git [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_reconcile_source_helm.md b/docs/cmd/flux_reconcile_source_helm.md index ce221c4217..9b4fe56140 100644 --- a/docs/cmd/flux_reconcile_source_helm.md +++ b/docs/cmd/flux_reconcile_source_helm.md @@ -27,6 +27,7 @@ flux reconcile source helm [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_resume.md b/docs/cmd/flux_resume.md index a61d4ebf21..ad74fb8651 100644 --- a/docs/cmd/flux_resume.md +++ b/docs/cmd/flux_resume.md @@ -15,6 +15,7 @@ The resume sub-commands resume a suspended resource. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_resume_alert.md b/docs/cmd/flux_resume_alert.md index 13efa81b85..3ce26ded5a 100644 --- a/docs/cmd/flux_resume_alert.md +++ b/docs/cmd/flux_resume_alert.md @@ -28,6 +28,7 @@ flux resume alert [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_resume_helmrelease.md b/docs/cmd/flux_resume_helmrelease.md index 3905b5efec..cd9628eb27 100644 --- a/docs/cmd/flux_resume_helmrelease.md +++ b/docs/cmd/flux_resume_helmrelease.md @@ -28,6 +28,7 @@ flux resume helmrelease [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_resume_kustomization.md b/docs/cmd/flux_resume_kustomization.md index a0a6f89843..a3b0d13f7d 100644 --- a/docs/cmd/flux_resume_kustomization.md +++ b/docs/cmd/flux_resume_kustomization.md @@ -28,6 +28,7 @@ flux resume kustomization [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_resume_receiver.md b/docs/cmd/flux_resume_receiver.md index 7e293ca428..860f012025 100644 --- a/docs/cmd/flux_resume_receiver.md +++ b/docs/cmd/flux_resume_receiver.md @@ -28,6 +28,7 @@ flux resume receiver [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_suspend.md b/docs/cmd/flux_suspend.md index 0b49574a41..044c0805b0 100644 --- a/docs/cmd/flux_suspend.md +++ b/docs/cmd/flux_suspend.md @@ -15,6 +15,7 @@ The suspend sub-commands suspend the reconciliation of a resource. ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_suspend_alert.md b/docs/cmd/flux_suspend_alert.md index 8a0f6ff488..4315fbd15e 100644 --- a/docs/cmd/flux_suspend_alert.md +++ b/docs/cmd/flux_suspend_alert.md @@ -27,6 +27,7 @@ flux suspend alert [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_suspend_helmrelease.md b/docs/cmd/flux_suspend_helmrelease.md index ea7d9884a6..a3e0b5641a 100644 --- a/docs/cmd/flux_suspend_helmrelease.md +++ b/docs/cmd/flux_suspend_helmrelease.md @@ -27,6 +27,7 @@ flux suspend helmrelease [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_suspend_kustomization.md b/docs/cmd/flux_suspend_kustomization.md index 2844a8670f..e85e2a8664 100644 --- a/docs/cmd/flux_suspend_kustomization.md +++ b/docs/cmd/flux_suspend_kustomization.md @@ -27,6 +27,7 @@ flux suspend kustomization [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_suspend_receiver.md b/docs/cmd/flux_suspend_receiver.md index 0737d30892..84e87c071f 100644 --- a/docs/cmd/flux_suspend_receiver.md +++ b/docs/cmd/flux_suspend_receiver.md @@ -27,6 +27,7 @@ flux suspend receiver [name] [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/docs/cmd/flux_uninstall.md b/docs/cmd/flux_uninstall.md index 6cf4d08c51..e0c72bc9b2 100644 --- a/docs/cmd/flux_uninstall.md +++ b/docs/cmd/flux_uninstall.md @@ -34,6 +34,7 @@ flux uninstall [flags] ### Options inherited from parent commands ``` + --context string kubernetes context to use --kubeconfig string path to the kubeconfig file (default "~/.kube/config") -n, --namespace string the namespace scope for this operation (default "flux-system") --timeout duration timeout for this operation (default 5m0s) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index afecd774e6..e51ee7189b 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -124,11 +124,19 @@ func ExecTemplate(obj interface{}, tmpl, filename string) error { return file.Sync() } -func KubeClient(kubeConfigPath string) (client.Client, error) { +func KubeClient(kubeConfigPath string, kubeContext string) (client.Client, error) { configFiles := SplitKubeConfigPath(kubeConfigPath) + configOverrides := clientcmd.ConfigOverrides{} + + if len(kubeContext) > 0 { + configOverrides.CurrentContext = kubeContext + } + cfg, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig( &clientcmd.ClientConfigLoadingRules{Precedence: configFiles}, - &clientcmd.ConfigOverrides{}).ClientConfig() + &configOverrides, + ).ClientConfig() + if err != nil { return nil, fmt.Errorf("kubernetes client initialization failed: %w", err) }