Skip to content

Commit

Permalink
feature: adding kube-context flag (#8849)
Browse files Browse the repository at this point in the history
* feature: adding support for kube-context flag to override kubeconfig if wanted. #8829

Signed-off-by: elad-codefresh <[email protected]>

* feat: fixed lint

Signed-off-by: elad-codefresh <[email protected]>

* feat: codegen

Signed-off-by: elad-codefresh <[email protected]>
  • Loading branch information
elad-codefresh authored Apr 7, 2022
1 parent d00fa53 commit 5c2391f
Show file tree
Hide file tree
Showing 142 changed files with 145 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/argocd/commands/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ argocd login cd.argoproj.io --core`,
PortForward: globalClientOpts.PortForward,
PortForwardNamespace: globalClientOpts.PortForwardNamespace,
Headers: globalClientOpts.Headers,
KubeOverrides: globalClientOpts.KubeOverrides,
}

if ctxName == "" {
Expand Down
4 changes: 4 additions & 0 deletions cmd/argocd/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ func NewCommand() *cobra.Command {
command.PersistentFlags().StringVar(&clientOpts.PortForwardNamespace, "port-forward-namespace", config.GetFlag("port-forward-namespace", ""), "Namespace name which should be used for port forwarding")
command.PersistentFlags().IntVar(&clientOpts.HttpRetryMax, "http-retry-max", 0, "Maximum number of retries to establish http connection to Argo CD server")
command.PersistentFlags().BoolVar(&clientOpts.Core, "core", false, "If set to true then CLI talks directly to Kubernetes instead of talking to Argo CD API server")

clientOpts.KubeOverrides = &clientcmd.ConfigOverrides{}
command.PersistentFlags().StringVar(&clientOpts.KubeOverrides.CurrentContext, "kube-context", "", "Directs the command to the given kube-context")

return command
}
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ argocd [flags]
-h, --help help for argocd
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ argocd account [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account_can-i.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Resources: [clusters projects applications repositories certificates logs]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account_delete-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ argocd account delete-token --account <account-name> ID
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account_generate-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ argocd account generate-token --account <account-name>
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account_get-user-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ argocd account get-user-info [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ argocd account get --account <account-name>
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ argocd account list
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_account_update-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ argocd account update-password [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ argocd admin [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ argocd admin app [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ argocd admin app diff-reconcile-results PATH1 PATH2 [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_app_generate-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ argocd admin app generate-spec APPNAME [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ argocd admin app get-reconcile-results PATH [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ argocd admin cluster [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ argocd admin cluster generate-spec CONTEXT [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ argocd admin cluster kubeconfig CLUSTER_URL OUTPUT_PATH [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ argocd admin cluster namespaces [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ argocd admin cluster namespaces disable-namespaced-mode PATTERN [flags]
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kube-context string Directs the command to the given kube-context
--kubeconfig string Path to a kube config. Only required if out-of-cluster
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ argocd admin cluster namespaces enable-namespaced-mode PATTERN [flags]
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
--kube-context string Directs the command to the given kube-context
--kubeconfig string Path to a kube config. Only required if out-of-cluster
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_cluster_shards.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ argocd admin cluster shards [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_cluster_stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ argocd admin cluster stats [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ argocd admin dashboard [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_admin_export.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ argocd admin export [flags]
-H, --header strings Sets additional header to all requests made by Argo CD CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers)
--http-retry-max int Maximum number of retries to establish http connection to Argo CD server
--insecure Skip server certificate and domain verification
--kube-context string Directs the command to the given kube-context
--logformat string Set the logging format. One of: text|json (default "text")
--loglevel string Set the logging level. One of: debug|info|warn|error (default "info")
--plaintext Disable TLS
Expand Down
Loading

0 comments on commit 5c2391f

Please sign in to comment.