sensu-go
sensu-go copied to clipboard
Add support for custom headers with sensuctl create
Feature Suggestion
The sensuctl create
command has supported reading from HTTP urls since version 5.13.0 (see https://github.com/sensu/sensu-go/pull/3238). The current implementation does not provide support for reading from URLs that require authentication. It would be great if we could provide additional arguments for customizing the HTTP GET request (e.g. custom headers).
Possible Implementation
At a minimum it would be helpful to provide support for custom headers, but it might also be useful to expose more/all of the underlying http lib configuration flags.
Context
A customer is hosting their Sensu assets and monitoring code templates (e.g. YAML/JSON files) in Artifactory. Their organization had previously allowed anonymous access to Artifactory, but this is no longer supported. This doesn't present a challenge for Assets since we already support custom headers in Asset definitions (enabling Sensu to fetch assets that require authentication by sending the appropriate auth headers), but it is impacting their ability to sensuctl create -f https://artifactory.company.com/artifactory/sensu/example-checks.yaml
.
Workaround
It's worth noting that a relatively simple workaround is likely viable here in the form of a curl -s <url> | sensuctl create --namespce example
. Linux pipes ftw.
The workaround is pretty darn good...