Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argo CLI support for custom request headers #7985

Closed
tatodorov opened this issue Feb 23, 2022 · 2 comments · Fixed by #8004
Closed

Argo CLI support for custom request headers #7985

tatodorov opened this issue Feb 23, 2022 · 2 comments · Fixed by #8004
Labels
area/cli The `argo` CLI good first issue Good for newcomers type/feature Feature request

Comments

@tatodorov
Copy link
Contributor

Summary

Add support for setting custom HTTP headers to argo CLI, similar to argocd -H, --header.

Use Cases

When Argo Workflows is configured behind IAP proxy like Cloudflare Access, we need to set a custom header with key cf-access-token and the actual token as a value.
Otherwise, when we execute argo list, we face the following error:

FATA[2022-02-23T22:38:56.530Z] invalid character '<' looking for beginning of value

This is already implemented in argocd CLI.
As an example, you can see issue #7036.


Message from the maintainers:

Love this enhancement proposal? Give it a 👍. We prioritise the proposals with the most 👍.

@tatodorov tatodorov added the type/feature Feature request label Feb 23, 2022
@tatodorov tatodorov changed the title Argo CLI support for request headers Argo CLI support for custom request headers Feb 23, 2022
@alexec alexec added the area/cli The `argo` CLI label Feb 23, 2022
@alexec
Copy link
Contributor

alexec commented Feb 23, 2022

I'm assuming you're using ARGO_HTTP1=true.

We would need to pass the header here:

req.Header.Set("Authorization", h.authorization)

It would get the header values from here:

type ArgoServerOpts struct {

Which would be set here:

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.")

Would you like to submit a PR?

@alexec alexec added the good first issue Good for newcomers label Feb 23, 2022
@tatodorov
Copy link
Contributor Author

Would you like to submit a PR?

Yes, I will be working on a PR.

alexec pushed a commit that referenced this issue Mar 1, 2022
Signed-off-by: Todor Todorov <todor@todorov.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli The `argo` CLI good first issue Good for newcomers type/feature Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants