-
Notifications
You must be signed in to change notification settings - Fork 67
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
support discord #185
support discord #185
Conversation
pkg/apis/v2beta2/receiver_types.go
Outdated
MentionedRoles []string `json:"mentionedRoles,omitempty"` | ||
|
||
// DiscordConfigSelector to be selected for this receiver | ||
DiscordConfigSelector *metav1.LabelSelector `json:"webhookConfigSelector,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.
The discord
has no config, no need for this.
pkg/internal/discord/types.go
Outdated
Type *string `json:"type,omitempty"` | ||
MentionedUsers []string `json:"mentionedUsers,omitempty"` | ||
MentionedRoles []string `json:"mentionedRoles,omitempty"` | ||
*Config |
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.
No need for this.
pkg/internal/discord/types.go
Outdated
r.Webhook = discord.Webhook | ||
} | ||
|
||
r.ResourceVersion, _ = strconv.ParseUint(obj.ResourceVersion, 10, 64) |
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.
What is the purpose of ResourceVersion
?
} | ||
|
||
if utils.StringIsNil(n.receiver.TmplName) { | ||
if tmplName != "" { |
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.
Can the content
and embed
messages use the same template?
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.
code := resp.StatusCode | ||
level.Debug(n.logger).Log("msg", "DiscordNotifier", "response code:", code) | ||
|
||
if code != http.StatusNoContent { |
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.
Does the discord server return a 204 for sending successfully, not 200?
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.
}() | ||
|
||
retry := 0 | ||
for { |
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.
Will it retry infinitely under extreme conditions?
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.
Should we limit the number of times?
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.
Yes
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.
120 is too large, I think 3 is more suitable.
pkg/internal/discord/types.go
Outdated
} | ||
|
||
func (r *Receiver) SetConfig(c internal.Config) { | ||
if reflect2.IsNil(c) { |
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.
Just return, no need to add this if statement.
pkg/internal/discord/types.go
Outdated
} | ||
|
||
func (c *Config) Clone() internal.Config { | ||
return &Config{ |
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.
Just return.
}() | ||
|
||
retry := 0 | ||
for { |
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.
120 is too large, I think 3 is more suitable.
Signed-off-by: Gentleelephant <birdhk@kubesphere.io> support discord Signed-off-by: Gentleelephant <birdhk@kubesphere.io>
Signed-off-by: Gentleelephant birdhk@kubesphere.io