-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat: Allow custom User-Agent headers for Helm repository requests #25473
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
base: master
Are you sure you want to change the base?
Conversation
Enables configuration of a custom HTTP User-Agent header via CLI flag, declarative config, or API fields for Helm repository operations. Signed-off-by: Yugan <[email protected]>
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
Signed-off-by: Yugan <[email protected]>
b458a3e to
2a00617
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #25473 +/- ##
==========================================
+ Coverage 62.49% 62.52% +0.02%
==========================================
Files 351 351
Lines 49602 49620 +18
==========================================
+ Hits 31001 31026 +25
+ Misses 15631 15621 -10
- Partials 2970 2973 +3 ☔ View full report in Codecov by Sentry. |
| // UserAgent specifies a custom User-Agent string for HTTP requests to this Helm repository. | ||
| // If not set, a default User-Agent will be used. | ||
| UserAgent string `json:"userAgent,omitempty" protobuf:"bytes,28,opt,name=userAgent"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be set as an environment variable on the repo-server rather than being set on the repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback! I'd like to understand your reasoning better before refactoring.
Questions:
- Would you prefer a single global User-Agent for all Helm repos, or should there be a way to override per-repository?
- Are there specific concerns with the current per-repository approach?
- Would a hybrid approach (env var as default + per-repo override) make sense?
My concern: Other repo-specific configs (credentials, proxy, TLS) are set per-repository. Would an env-var-only approach be inconsistent? Or is User-Agent different enough that it should be global?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer a single global User-Agent for all Helm repos, or should there be a way to override per-repository?
IMO this should be a global option. Up until now there has been no need for setting a header for a Helm repository, and I don't anticipate there will be much of a need to configure this on a per repository basis either.
Are there specific concerns with the current per-repository approach?
We already have too many options on the Repository object as-is.
Would a hybrid approach (env var as default + per-repo override) make sense?
No
|
Refactored per feedback - Changed from per-repository User-Agent configuration to a global environment variable approach, Please review it Thank you :) |
blakepettersson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment
|
All requested changes have been addressed: The Helm User-Agent is now set globally via the repo-server using the ARGOCD_HELM_USER_AGENT environment variable. |
Allow custom User-Agent headers for Helm repository requests
Adds support for configuring custom HTTP User-Agent headers for Helm repository requests. This enables users to identify and track requests from ArgoCD, meet server requirements, or debug connectivity issues.
Closes #25459
Motivation
Some Helm repositories and OCI registries require or recommend specific User-Agent headers for:
Currently, ArgoCD uses default HTTP client User-Agent values that may not meet these requirements.
Changes
Core Implementation
UserAgentfield toRepositoryCRD (pkg/apis/application/v1alpha1/repository_types.go)util/helm/client.go,util/helm/creds.go)CLI Support
--user-agentflag toargocd repo addcommandcmd/util/repo.goandcmd/argocd/commands/repo.goDocumentation
docs/operator-manual/declarative-setup.md)docs/user-guide/private-repositories.md)Testing
util/helm/client_test.go:TestUserAgentIsSet- Verifies default and custom User-AgentTestUserAgentRequiredByServer- Tests server requirementsTestUserAgentPriority- Validates precedence rulesExample Usage
CLI
argocd repo add https://charts.example.com --type=helm --user-agent="my-custom-agent/1.0"Declarative
Checklist: