-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat: Add new discord message fields #7307
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
feat: Add new discord message fields #7307
Conversation
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.
Thanks for the PR
You will also need to add unit tests
// HTTP client configuration. | ||
// +optional | ||
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` | ||
|
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.
nit: remove blank line
I have added unit tests for related code. |
I guess you added only golden files, you also need to write testcases see #7310 for eg |
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.
we need to reset the fields in *discordConfig.sanitize()
if the version isn't >= v0.28.0.
Created #7313 to add only in am config secret |
Sorry, I forgot to add the changes in the commit. |
// The template of the content's body. | ||
// +optional | ||
Content *string `json:"content,omitempty"` | ||
// +optional | ||
Username *string `json:"username,omitempty"` | ||
// +optional | ||
AvatarURL *string `json:"avatarURL,omitempty"` |
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.
same remarks.
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.
thanks for the suggestion.
I have incorporated it in code.
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.
Hi @junaidk seems you added the kubebuilder checks only in v1beta1, missing for v1alpha1
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.
Done.
I forgot to save and commit changes for v1alpha1.
This adds the functionality to configure the discord message content, username and avatar_url.
3de4b47
to
eca6cca
Compare
Hi @simonpasquier |
…nfig. remove empty lines from DiscordConfig struct.
@slashpai and @simonpasquier can you also have a look again please. |
@heliapb can you guide on how can I get this PR reviewed and merged. |
Hi @junaidk sure thing, let's see if the team has time to review it /cc @slashpai @simonpasquier when you have time please take a look. Thanks |
// +required | ||
// +kubebuilder:validation:Required |
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.
Repeated
// +optional | ||
// +kubebuilder:validation:Optional |
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.
nit
// +required | ||
// +kubebuilder:validation:Required |
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.
nits
// +kubebuilder:validation:MinLength=1 | ||
AvatarURL *string `json:"avatarURL,omitempty"` |
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.
// +kubebuilder:validation:MinLength=1 | |
AvatarURL *string `json:"avatarURL,omitempty"` | |
// +kubebuilder:validation:MinLength=1 | |
// +kubebuilder:validation:Pattern:="^http(s)?://.+$" | |
AvatarURL *string `json:"avatarURL,omitempty"` |
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.
thanks. updated
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.
Thanks for the PR!
// +optional | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:Pattern:="^http(s)?://.+$" | ||
AvatarURL *string `json:"avatarURL,omitempty"` |
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.
we can reuse the URL type in fact
AvatarURL *string `json:"avatarURL,omitempty"` | |
AvatarURL *URL `json:"avatarURL,omitempty"` |
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.
thanks, updated
|
||
// HTTP client configuration. | ||
// +optional | ||
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"` |
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.
(nit) can we keep the HTTPConfig field at the bottom of the struct definition?
|
||
// The template of the message's title. | ||
// +optional | ||
// +kubebuilder:validation:MinLength=1 |
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.
let's discuss new validations on existing fields in a different PR
// +kubebuilder:validation:MinLength=1 |
|
||
// The template of the message's body. | ||
// +optional | ||
// +kubebuilder:validation:MinLength=1 |
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.
same here
out.Message = *in.Message | ||
} | ||
|
||
if in.Content != nil && *in.Content != "" { |
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.
(nit)
if in.Content != nil && *in.Content != "" { | |
if ptr.Deref(in.Content, "") != "" { |
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.
Thanks!
42229a7
into
prometheus-operator:main
Description
This adds the functionality to configure the discord message content, username and avatar_url introduced in alertmanager release v0.28.0.
Type of change
CHANGE
(fix or feature that would cause existing functionality to not work as expected)FEATURE
(non-breaking change which adds functionality)BUGFIX
(non-breaking change which fixes an issue)ENHANCEMENT
(non-breaking change which improves existing functionality)NONE
(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Verification
Please check the Prometheus-Operator testing guidelines for recommendations about automated tests.
Changelog entry
Add discord message content, username and avatar_url fields introduced in alertmanager v0.28.0