From 8571e1f1e8b78776e02a5d48013dd3c1f4ecd853 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Sat, 10 Feb 2024 19:42:53 -0500 Subject: [PATCH] chore!: remove duplicated Server env vars - every CLI flag has had an equivalent env var since 96c5626497df9eedad062df9b8aaaaeea3561407 - `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 --- cmd/argo/commands/server.go | 15 ++------------- docs/argo-server.md | 2 +- docs/cli/argo_server.md | 4 ++-- docs/environment-variables.md | 2 -- docs/upgrading.md | 6 ++++++ 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/cmd/argo/commands/server.go b/cmd/argo/commands/server.go index d9860b30ea69..559c7f9a3c87 100644 --- a/cmd/argo/commands/server.go +++ b/cmd/argo/commands/server.go @@ -4,7 +4,6 @@ import ( "context" "crypto/tls" "fmt" - "os" "reflect" "strings" "time" @@ -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") @@ -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.") diff --git a/docs/argo-server.md b/docs/argo-server.md index 0be64ed77895..3ac64a89545c 100644 --- a/docs/argo-server.md +++ b/docs/argo-server.md @@ -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) diff --git a/docs/cli/argo_server.md b/docs/cli/argo_server.md index f702272249ce..5782a5bc908e 100644 --- a/docs/cli/argo_server.md +++ b/docs/cli/argo_server.md @@ -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 diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 8237692361b3..c9a56c852f6b 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -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. | diff --git a/docs/upgrading.md b/docs/upgrading.md index edcf92986c25..2f58fad8eac4 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -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.