Repository navigation
Conversation
…rConfig The Slack receiver of AlertmanagerConfig only accepted the webhook URL as a secret key reference. Users who get the URL from a file on disk, for example written by a Vault sidecar, could not use it. Add apiURLFile to SlackConfig in v1alpha1 and v1beta1 and pass it to the generated configuration as api_url_file. It follows the existing Telegram botTokenFile and Pushover userKeyFile fields: * it is mutually exclusive with apiURL, which the validation enforces * it requires Alertmanager >= 0.22.0 * it is rejected when the Alertmanager filesystem mode denies AlertmanagerConfig objects from referencing files Fixes prometheus-operator#5077 Signed-off-by: Aryan Deshmukh <[email protected]>
simonpasquier
left a comment
Contributor
There was a problem hiding this comment.
can we add CEL validation too pls?
…he Slack config Reject a SlackConfig that sets both apiURL and apiURLFile at the API server, in v1alpha1 and v1beta1, as the operator already does in its Go validation. Signed-off-by: Aryan Deshmukh <[email protected]>
Contributor
Author
|
Added CEL validation for apiURL and apiURLFile to both versions, CRDs regenerated (44b9450). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
apiURLFileto the Slack receiver ofAlertmanagerConfig(v1alpha1 and v1beta1). Until now the webhook URL could only come from a secret key reference, so users who get it from a file on disk, for example a Vault sidecar as described in the issue, could not useAlertmanagerConfigfor Slack.The field follows the existing Telegram
botTokenFileand PushoveruserKeyFilefields and is passed to the generated configuration asapi_url_file. It is mutually exclusive withapiURL(validation error), it requires Alertmanager >= 0.22.0, and it is rejected when the Alertmanager filesystem mode denies file references inAlertmanagerConfigobjects. Alertmanager's own handling ofapi_url_file(precedence, version drop) already existed insanitize.Closes: #5077
Type of change
FEATURE(non-breaking change which adds functionality)Verification
New tests: a golden config for
apiURLFile, the filesystem guard (allowed withAllowAll, denied withDenyAll), the validation ofapiURLtogether withapiURLFile, and the v1alpha1 to v1beta1 conversion. Generated files come frommake generate.Changelog entry
Open points
The field has
MinLength=1, which the Telegram and Pushover file fields do not have, so that an empty string cannot silently fall back to the global Slack URL. Happy to drop it to match them.