Skip to content

Commit

Permalink
chore!: remove duplicated Server env vars
Browse files Browse the repository at this point in the history
- every CLI flag has had an equivalent env var since 96c5626
- `ALLOWED_LINK_PROTOCOL` and `BASE_HREF` each had a duplicate env var as the odd ones out
  - so remove them in a breaking change, and refer users to their `ARGO_*` equivalents in the upgrade notes

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
  • Loading branch information
agilgur5 committed Feb 11, 2024
1 parent 66680f1 commit 8571e1f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
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, "basehref", "/", "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
2 changes: 1 addition & 1 deletion 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 `--basehref` flag or the `ARGO_BASE_HREF`
environment variable.

You probably now should [read how to set-up an ingress](#ingress)
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/argo_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ See https://argo-workflows.readthedocs.io/en/latest/argo-server/

```
--access-control-allow-origin string Set Access-Control-Allow-Origin header in HTTP responses.
--allowed-link-protocol stringArray Allowed protocols for links feature. Defaults to the environment variable ALLOWED_LINK_PROTOCOL: http,https (default [http,https])
--allowed-link-protocol stringArray Allowed protocols for links feature. (default [http,https])
--api-rate-limit uint Set limit per IP for api ratelimiter (default 1000)
--auth-mode stringArray API server authentication mode. Any 1 or more length permutation of: client,server,sso (default [client])
--basehref string 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. (default "/")
--basehref string Value for base href in index.html. Used if the server is running behind reverse proxy under subpath different from /. (default "/")
-b, --browser enable automatic launching of the browser [local mode]
--configmap string Name of K8s configmap to retrieve workflow controller configuration (default "workflow-controller-configmap")
--event-async-dispatch dispatch event async
Expand Down
2 changes: 0 additions & 2 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@ data:

| Name | Type | Default | Description |
|--------------------------------------------|----------|---------|-------------------------------------------------------------------------------------------------------------------------|
| `ALLOWED_LINK_PROTOCOL` | `string` | `http,https` | List of comma separated protocols allowed for the [Links feature](links.md)
| `ARGO_ARTIFACT_SERVER` | `bool` | `true` | Enable [Workflow Archive](workflow-archive.md) endpoints
| `ARGO_PPROF` | `bool` | `false` | Enable [`pprof`](https://go.dev/blog/pprof) endpoints
| `ARGO_SERVER_METRICS_AUTH` | `bool` | `true` | Enable auth on the `/metrics` endpoint
| `BASE_HREF` | `string` | `/` | [Base HREF](argo-server.md#base-href) of the Server
| `DISABLE_VALUE_LIST_RETRIEVAL_KEY_PATTERN` | `string` | `""` | Disable the retrieval of the list of label values for keys based on this regular expression. |
| `FIRST_TIME_USER_MODAL` | `bool` | `true` | Show this modal. |
| `FEEDBACK_MODAL` | `bool` | `true` | Show this modal. |
Expand Down
6 changes: 6 additions & 0 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Breaking changes typically (sometimes we don't realise they are breaking) have "!" in the commit message, as per
the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).

## Upgrading to v3.6

### Removed redundant Server environment variables

`ALLOWED_LINK_PROTOCOL` and `BASE_HREF` have been removed as redundant, use `ARGO_ALLOWED_LINK_PROTOCOL` and `ARGO_BASE_HREF` instead.

## Upgrading to v3.5

There are no known breaking changes in this release. Please file an issue if you encounter any unexpected problems after upgrading.
Expand Down

0 comments on commit 8571e1f

Please sign in to comment.