Skip to content

Commit

Permalink
chore!: remove duplicate Server env vars, plus --basehref -> `--bas…
Browse files Browse the repository at this point in the history
…e-href` (#12653)

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
  • Loading branch information
agilgur5 authored Jun 9, 2024
1 parent cc604e4 commit b560ad3
Show file tree
Hide file tree
Showing 61 changed files with 77 additions and 78 deletions.
2 changes: 1 addition & 1 deletion cmd/argo/commands/client/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func AddAPIClientFlagsToCmd(cmd *cobra.Command) {
cmd.PersistentFlags().StringVar(&instanceID, "instanceid", os.Getenv("ARGO_INSTANCEID"), "submit with a specific controller's instance id label. Default to the ARGO_INSTANCEID environment variable.")
// "-s" like kubectl
cmd.PersistentFlags().StringVarP(&ArgoServerOpts.URL, "argo-server", "s", os.Getenv("ARGO_SERVER"), "API server `host:port`. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.")
cmd.PersistentFlags().StringVar(&ArgoServerOpts.Path, "argo-base-href", os.Getenv("ARGO_BASE_HREF"), "Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.")
cmd.PersistentFlags().StringVar(&ArgoServerOpts.Path, "argo-base-href", os.Getenv("ARGO_BASE_HREF"), "Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.")
cmd.PersistentFlags().BoolVar(&ArgoServerOpts.HTTP1, "argo-http1", os.Getenv("ARGO_HTTP1") == "true", "If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.")
cmd.PersistentFlags().StringSliceVarP(&ArgoServerOpts.Headers, "header", "H", []string{}, "Sets additional header to all requests made by Argo CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers) Used only when either ARGO_HTTP1 or --argo-http1 is set to true.")
// "-e" for encrypted - like zip
Expand Down
2 changes: 1 addition & 1 deletion cmd/argo/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Use the same configuration as GRPC mode, but also set:
ARGO_HTTP1=true
If your server is behind an ingress with a path (you'll be running "argo server --basehref /...) or "BASE_HREF=/... argo server"):
If your server is behind an ingress with a path (running "argo server --base-href /argo" or "ARGO_BASE_HREF=/argo argo server"):
ARGO_BASE_HREF=/argo
`,
Expand Down
15 changes: 2 additions & 13 deletions cmd/argo/commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"crypto/tls"
"fmt"
"os"
"reflect"
"strings"
"time"
Expand Down Expand Up @@ -191,18 +190,8 @@ See %s`, help.ArgoServer),
},
}

defaultBaseHRef := os.Getenv("BASE_HREF")
if defaultBaseHRef == "" {
defaultBaseHRef = "/"
}

defaultAllowedLinkProtocol := []string{"http", "https"}
if protocol := os.Getenv("ALLOWED_LINK_PROTOCOL"); protocol != "" {
defaultAllowedLinkProtocol = strings.Split(protocol, ",")
}

command.Flags().IntVarP(&port, "port", "p", 2746, "Port to listen on")
command.Flags().StringVar(&baseHRef, "basehref", defaultBaseHRef, "Value for base href in index.html. Used if the server is running behind reverse proxy under subpath different from /. Defaults to the environment variable BASE_HREF.")
command.Flags().StringVar(&baseHRef, "base-href", "/", "Value for base href in index.html. Used if the server is running behind reverse proxy under subpath different from /.")
// "-e" for encrypt, like zip
command.Flags().BoolVarP(&secure, "secure", "e", true, "Whether or not we should listen on TLS.")
command.Flags().StringVar(&tlsCertificateSecretName, "tls-certificate-secret-name", "", "The name of a Kubernetes secret that contains the server certificates")
Expand All @@ -218,7 +207,7 @@ See %s`, help.ArgoServer),
command.Flags().StringVar(&frameOptions, "x-frame-options", "DENY", "Set X-Frame-Options header in HTTP responses.")
command.Flags().StringVar(&accessControlAllowOrigin, "access-control-allow-origin", "", "Set Access-Control-Allow-Origin header in HTTP responses.")
command.Flags().Uint64Var(&apiRateLimit, "api-rate-limit", 1000, "Set limit per IP for api ratelimiter")
command.Flags().StringArrayVar(&allowedLinkProtocol, "allowed-link-protocol", defaultAllowedLinkProtocol, "Allowed protocols for links feature. Defaults to the environment variable ALLOWED_LINK_PROTOCOL: http,https")
command.Flags().StringArrayVar(&allowedLinkProtocol, "allowed-link-protocol", []string{"http", "https"}, "Allowed protocols for links feature.")
command.Flags().StringVar(&logFormat, "log-format", "text", "The formatter to use for logs. One of: text|json")
command.Flags().Float32Var(&kubeAPIQPS, "kube-api-qps", 20.0, "QPS to use while talking with kube-apiserver.")
command.Flags().IntVar(&kubeAPIBurst, "kube-api-burst", 30, "Burst to use while talking with kube-apiserver.")
Expand Down
6 changes: 3 additions & 3 deletions docs/argo-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ See [managed namespace](managed-namespace.md).
### Base HREF

If the server is running behind reverse proxy with a sub-path different from `/` (for example,
`/argo`), you can set an alternative sub-path with the `--basehref` flag or the `BASE_HREF`
`/argo`), you can set an alternative sub-path with the `--base-href` flag or the `ARGO_BASE_HREF`
environment variable.

You probably now should [read how to set-up an ingress](#ingress)
Expand Down Expand Up @@ -97,7 +97,7 @@ argo-server LoadBalancer 10.43.43.130 172.18.0.2 2746:30008/TCP 18h

You can get ingress working as follows:

Add `BASE_HREF` as environment variable to `deployment/argo-server`. Do not forget to add a trailing '/' character.
Add `ARGO_BASE_HREF` as environment variable to `deployment/argo-server`. Do not forget to add a trailing '/' character.

```yaml
---
Expand All @@ -118,7 +118,7 @@ spec:
- args:
- server
env:
- name: BASE_HREF
- name: ARGO_BASE_HREF
value: /argo/
image: argoproj/argocli:latest
name: argo-server
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/argo.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Use the same configuration as GRPC mode, but also set:

ARGO_HTTP1=true

If your server is behind an ingress with a path (you'll be running "argo server --basehref /...) or "BASE_HREF=/... argo server"):
If your server is behind an ingress with a path (running "argo server --base-href /argo" or "ARGO_BASE_HREF=/argo argo server"):

ARGO_BASE_HREF=/argo

Expand All @@ -69,7 +69,7 @@ argo [flags]
### Options

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo archive [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo archive delete UID... [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo archive get UID [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_list-label-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo archive list-label-keys [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_list-label-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo archive list-label-values [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ argo archive list [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_resubmit.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ argo archive resubmit [WORKFLOW...] [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_retry.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ argo archive retry [WORKFLOW...] [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo auth [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_auth_token.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo auth token [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo cluster-template [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ argo cluster-template create FILE1 FILE2... [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo cluster-template delete WORKFLOW_TEMPLATE [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo cluster-template get CLUSTER WORKFLOW_TEMPLATE... [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ argo cluster-template lint FILE... [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ argo cluster-template list [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ argo cluster-template update FILE1 FILE2... [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ argo completion SHELL [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cp.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ argo cp my-wf output-directory ... [flags]
### Options inherited from parent commands

```
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to Base HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
Loading

0 comments on commit b560ad3

Please sign in to comment.