rename message template parameters so they are not related to slack

This commit is contained in:
Daniel Jimenez Garcia
2020-11-25 16:20:54 +00:00
committed by Jimenez Garcia
parent f059cec794
commit 51cab0dedc
7 changed files with 38 additions and 35 deletions
+6 -3
View File
@@ -94,8 +94,8 @@ Flags:
--slack-channel string slack channel for reboot notfications
--slack-hook-url string slack hook URL for reboot notfications
--slack-username string slack username for reboot notfications (default "kured")
--slack-message-drain string slack message template when notifying about a node being drained (default "Draining node %s")
--slack-message-reboot string slack message template when notifying about a node being rebooted (default "Rebooting node %s")
--message-template-drain string message template used to notify about a node being drained (default "Draining node %s")
--message-template-reboot string message template used to notify about a node being rebooted (default "Rebooting node %s")
--start-time string only reboot after this time of day (default "0:00")
--time-zone string use this timezone to calculate allowed reboot time (default "UTC")
```
@@ -220,7 +220,10 @@ you immediately prior to rebooting a node:
We recommend setting `--slack-username` to be the name of the
environment, e.g. `dev` or `prod`.
Alternatively you can use the `--slack-message-reboot` and `--slack-message-reboot` to customize the text of the message, e.g. `"Draining node %s part of my-cluster in region xyz"`
Alternatively you can use the `--message-template-drain` and `--message-template-reboot` to customize the text of the message, e.g.
```
--message-template-drain="Draining node %s part of *my-cluster* in region *xyz*"
```
### Overriding Lock Configuration
+2 -2
View File
@@ -55,8 +55,8 @@ The following changes have been made compared to the stable chart:
| `configuration.slackChannel` | cli-parameter `--slack-channel` | `""` |
| `configuration.slackHookUrl` | cli-parameter `--slack-hook-url` | `""` |
| `configuration.slackUsername` | cli-parameter `--slack-username` | `""` |
| `configuration.slackMessageDrain` | cli-parameter `--slack-message-drain` | `""` |
| `configuration.slackMessageReboot` | cli-parameter `--slack-message-reboot` | `""` |
| `configuration.messageTemplateDrain` | cli-parameter `--message-template-drain` | `""` |
| `configuration.messageTemplateReboot` | cli-parameter `--message-template-reboot` | `""` |
| `configuration.startTime` | cli-parameter `--start-time` | `""` |
| `configuration.timeZone` | cli-parameter `--time-zone` | `""` |
| `rbac.create` | Create RBAC roles | `true` |
+4 -4
View File
@@ -81,11 +81,11 @@ spec:
{{- if .Values.configuration.slackUsername }}
- --slack-username={{ .Values.configuration.slackUsername }}
{{- end }}
{{- if .Values.configuration.slackMessageDrain }}
- --slack-message-drain={{ .Values.configuration.slackMessageDrain }}
{{- if .Values.configuration.messageTemplateDrain }}
- --message-template-drain={{ .Values.configuration.messageTemplateDrain }}
{{- end }}
{{- if .Values.configuration.slackMessageReboot }}
- --slack-message-reboot={{ .Values.configuration.slackMessageReboot }}
{{- if .Values.configuration.messageTemplateReboot }}
- --message-template-reboot={{ .Values.configuration.messageTemplateReboot }}
{{- end }}
{{- if .Values.configuration.startTime }}
- --start-time={{ .Values.configuration.startTime }}
+2 -2
View File
@@ -15,7 +15,7 @@ configuration:
# slackChannel: "" # slack channel for reboot notfications
# slackHookUrl: "" # slack hook URL for reboot notfications
# slackUsername: "" # slack username for reboot notfications (default "kured")
# slackMessageDrain: "" # slack message template when notifying about a node being drained (default "Draining node %s")
# slackMessageReboot: "" # slack message template when notifying about a node being rebooted (default "Rebooted node %s")
# messageTemplateDrain: "" # slack message template when notifying about a node being drained (default "Draining node %s")
# messageTemplateReboot: "" # slack message template when notifying about a node being rebooted (default "Rebooted node %s")
# startTime: "" # only reboot after this time of day (default "0:00")
# timeZone: "" # time-zone to use (valid zones from "time" golang package)
+2 -2
View File
@@ -32,8 +32,8 @@ configuration:
slackChannel: "" # slack channel for reboot notfications
slackHookUrl: "" # slack hook URL for reboot notfications
slackUsername: "" # slack username for reboot notfications (default "kured")
slackMessageDrain: "" # slack message template when notifying about a node being drained (default "Draining node %s")
slackMessageReboot: "" # slack message template when notifying about a node being rebooted (default "Rebooted node %s")
messageTemplateDrain: "" # slack message template when notifying about a node being drained (default "Draining node %s")
messageTemplateReboot: "" # slack message template when notifying about a node being rebooted (default "Rebooted node %s")
startTime: "" # only reboot after this time of day (default "0:00")
timeZone: "" # time-zone to use (valid zones from "time" golang package)
+20 -20
View File
@@ -31,20 +31,20 @@ var (
version = "unreleased"
// Command line flags
period time.Duration
dsNamespace string
dsName string
lockAnnotation string
lockTTL time.Duration
prometheusURL string
alertFilter *regexp.Regexp
rebootSentinel string
slackHookURL string
slackUsername string
slackChannel string
slackMessageDrain string
slackMessageReboot string
podSelectors []string
period time.Duration
dsNamespace string
dsName string
lockAnnotation string
lockTTL time.Duration
prometheusURL string
alertFilter *regexp.Regexp
rebootSentinel string
slackHookURL string
slackUsername string
slackChannel string
messageTemplateDrain string
messageTemplateReboot string
podSelectors []string
rebootDays []string
rebootStart string
@@ -92,10 +92,10 @@ func main() {
"slack username for reboot notfications")
rootCmd.PersistentFlags().StringVar(&slackChannel, "slack-channel", "",
"slack channel for reboot notfications")
rootCmd.PersistentFlags().StringVar(&slackMessageDrain, "slack-message-drain", "Draining node %s",
"slack message template when notifying about a node being drained")
rootCmd.PersistentFlags().StringVar(&slackMessageReboot, "slack-message-reboot", "Rebooting node %s",
"slack message template when notifying about a node being rebooted")
rootCmd.PersistentFlags().StringVar(&messageTemplateDrain, "message-template-drain", "Draining node %s",
"message template used to notify about a node being drained")
rootCmd.PersistentFlags().StringVar(&messageTemplateReboot, "message-template-reboot", "Rebooting node %s",
"message template used to notify about a node being rebooted")
rootCmd.PersistentFlags().StringArrayVar(&podSelectors, "blocking-pod-selector", nil,
"label selector identifying pods whose presence should prevent reboots")
@@ -243,7 +243,7 @@ func drain(client *kubernetes.Clientset, node *v1.Node) {
log.Infof("Draining node %s", nodename)
if slackHookURL != "" {
if err := slack.NotifyDrain(slackHookURL, slackUsername, slackChannel, slackMessageDrain, nodename); err != nil {
if err := slack.NotifyDrain(slackHookURL, slackUsername, slackChannel, messageTemplateDrain, nodename); err != nil {
log.Warnf("Error notifying slack: %v", err)
}
}
@@ -283,7 +283,7 @@ func commandReboot(nodeID string) {
log.Infof("Commanding reboot for node: %s", nodeID)
if slackHookURL != "" {
if err := slack.NotifyReboot(slackHookURL, slackUsername, slackChannel, slackMessageReboot, nodeID); err != nil {
if err := slack.NotifyReboot(slackHookURL, slackUsername, slackChannel, messageTemplateReboot, nodeID); err != nil {
log.Warnf("Error notifying slack: %v", err)
}
}
+2 -2
View File
@@ -59,7 +59,7 @@ spec:
# - --slack-hook-url=https://hooks.slack.com/...
# - --slack-username=prod
# - --slack-channel=alerting
# - --slack-message-drain=Draining node %s
# - --slack-message-drain=Rebooting node %s
# - --message-template-drain=Draining node %s
# - --message-template-drain=Rebooting node %s
# - --start-time=0:00
# - --time-zone=UTC