Documentation ¶
Index ¶
Constants ¶
View Source
const ( NotifierLevelVerbose = "verbose" NotifierLevelNormal = "normal" NotifierLevelWarning = "warning" NotifierLevelError = "error" )
View Source
const ( NotifierNameSlack = "slack" SectionBlockType = "section" MarkdownTextType = "mrkdwn" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Config ¶
type Config struct { // Namespace speficies the namespace where experiments should be monitored Namespace string `yaml:"namespace,omitempty"` // URL specifies the endpoint to send notification URL string `yaml:"url"` // NotifierName is the name of notification receiver Notifier string `yaml:"notifier"` // Level specifies the informative level Level string `yaml:"level"` // Actions lists the actions that user may want to take during the experiment Actions []string `yaml:"actions,omitempty"` // Labels are used to filter out the experiments for report Labels map[string]string `yaml:"labels,omitempty"` }
Config defines the configuration used for a notifier channel
type ConfiguredNotifier ¶
type ConfiguredNotifier struct {
// contains filtered or unexported fields
}
ConfiguredNotifier is the wrapper of the a notifier implementation and its configuration
type MarkdownText ¶
type NotificationCenter ¶
type NotificationCenter struct { Notifiers map[string]*ConfiguredNotifier // contains filtered or unexported fields }
NotificationCenter is designed to send notifications to registered notifiers
func NewNotificationCenter ¶
func NewNotificationCenter(logger logr.Logger) *NotificationCenter
NewNotificationCenter returns a new NotificationCenter
func (*NotificationCenter) Notify ¶
func (nc *NotificationCenter) Notify(instance *iter8v1alpha2.Experiment, reason string, messageFormat string, messageA ...interface{})
Notify will generate notifications to all the matched notifier specified in the configs Errors occured will only be logged
func (*NotificationCenter) RegisterHandler ¶ added in v0.1.0
func (nc *NotificationCenter) RegisterHandler(cache cache.Cache) error
RegisterHandler adds event handlers to k8s cache
type Notifier ¶
type Notifier interface { // MakeRequest returns the platform-specific request instance MakeRequest(instance *iter8v1alpha2.Experiment, reason string, messageFormat string, messageA ...interface{}) interface{} }
Notifier is the interface for notifier implementations
type SectionBlock ¶
type SectionBlock struct { Type string `json:"type"` Text MarkdownText `json:"text"` }
type SlackRequest ¶
type SlackRequest struct { Text string `json:"text"` Blocks []SectionBlock `json:"blocks"` Attachments []Attachment `json:"attachments"` }
type SlackWebhook ¶
type SlackWebhook struct{}
func NewSlackWebhook ¶
func NewSlackWebhook() *SlackWebhook
func (*SlackWebhook) MakeRequest ¶
func (s *SlackWebhook) MakeRequest(instance *iter8v1alpha2.Experiment, reason string, messageFormat string, messageA ...interface{}) interface{}
MakeRequest implements Notifier MakeRequest function
Click to show internal directories.
Click to hide internal directories.