Skip to content

Commit

Permalink
Merge pull request #108 from gianlucam76/slack-notification
Browse files Browse the repository at this point in the history
Add slack notification type
  • Loading branch information
gianlucam76 authored Feb 16, 2023
2 parents f3b22a1 + 4c466bf commit 1cc3d57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion api/v1alpha1/clusterhealthcheck_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ const (
FeatureClusterHealthCheck = "ClusterHealthCheck"
)

// Slack constant
// To have Sveltos sends a slack notification, create a Secret of type "addons.projectsveltos.io/cluster-profile"
// In the data section set both slack token and slack channel id
const (
SlackToken = "SLACK_TOKEN"
SlackChannelID = "SLACK_CHANNEL_ID"
)

// ConditionSeverity expresses the severity of a Condition Type failing.
type ConditionSeverity string

Expand Down Expand Up @@ -118,12 +126,15 @@ type LivenessCheck struct {
}

// NotificationType specifies different type of notifications
// +kubebuilder:validation:Enum:=KubernetesEvent
// +kubebuilder:validation:Enum:=KubernetesEvent;Slack
type NotificationType string

const (
// NotificationTypeKubernetesEvent refers to generating a Kubernetes event
NotificationTypeKubernetesEvent = NotificationType("KubernetesEvent")

// NotificationTypeSlack refers to generating a Slack message
NotificationTypeSlack = NotificationType("Slack")
)

type Notification struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ spec:
description: NotificationType specifies the type of notification
enum:
- KubernetesEvent
- Slack
type: string
required:
- name
Expand Down
1 change: 1 addition & 0 deletions lib/crd/clusterhealthchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ spec:
description: NotificationType specifies the type of notification
enum:
- KubernetesEvent
- Slack
type: string
required:
- name
Expand Down

0 comments on commit 1cc3d57

Please sign in to comment.