Documentation
¶
Overview ¶
pkg/notification/email.go
Email notification dispatch via SMTP. SMTP credentials are read from pkg/konfig env vars:
SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_FROM
Recipients are declared per team in the Katalog notification config. Multiple recipients receive one email each (BCC is not used — per-recipient tracking allows future per-recipient suppression).
pkg/notification/slack.go
Slack notification dispatch via incoming webhooks. One HTTP POST per channel per send. Channels are notified in parallel.
Message format: plain text with Markdown-like formatting that Slack renders. The message template is evaluated against the full resolver data map before dispatch so it can reference .spec.*, .metadata.*, .status.*, metrics.*, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirectNotifier ¶ added in v0.4.9
type DirectNotifier struct {
// contains filtered or unexported fields
}
DirectNotifier dispatches via SMTP/Slack without a gateway. Used when gatewayEndpoint is not configured.
func NewDirectNotifier ¶ added in v0.4.9
func NewDirectNotifier(kat *katalog.Katalog) *DirectNotifier
type Event ¶ added in v0.4.9
type Event struct {
KatalogName string `json:"katalogName"`
CRName string `json:"crName"`
CRNamespace string `json:"crNamespace"`
GVK string `json:"gvk"`
CondKey string `json:"condKey"`
TeamName string `json:"teamName"`
Subject string `json:"subject"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
Data map[string]interface{} `json:"data,omitempty"`
}
Event is a dispatch-ready notification unit. The runtime builds one per condition+team pair after the throttle check passes.
type GatewayNotifier ¶ added in v0.4.9
type GatewayNotifier struct {
// contains filtered or unexported fields
}
GatewayNotifier POSTs events to <endpoint>/notify. The gateway owns SMTP/Slack credential lookup and actual dispatch.
func NewGatewayNotifier ¶ added in v0.4.9
func NewGatewayNotifier(endpoint string) *GatewayNotifier
type NotificationStack ¶
type NotificationStack struct {
Katalog *katalog.Katalog
State *NotificationState
Notifier Notifier
}
NotificationStack combines Katalog context, throttle state, and the active Notifier. One instance per GenericReconciler when notification is enabled.
func NewNotificationStack ¶ added in v0.4.9
func NewNotificationStack(kat *katalog.Katalog, notifier Notifier) *NotificationStack
NewNotificationStack creates a ready-to-use stack. notifier is either a DirectNotifier (standalone) or GatewayNotifier (gateway path).
func (*NotificationStack) ProcessConditionNotifications ¶ added in v0.4.9
func (s *NotificationStack) ProcessConditionNotifications( ctx context.Context, data map[string]interface{}, cond orktypes.Condition, now time.Time, )
ProcessConditionNotifications enforces per-team throttle and fires an Event via s.Notifier for every team whose interval has elapsed.
Call this after a condition has already been evaluated as true.
type NotificationState ¶
type NotificationState struct {
// key: operatorName + "|" + conditionKey + "|" + teamName
LastSent map[string]time.Time
}
NotificationState tracks per condition+team last-send timestamps for throttling.
func NewNotificationState ¶
func NewNotificationState() *NotificationState
type Notifier ¶ added in v0.4.9
Notifier dispatches a resolved, throttle-checked notification event. DirectNotifier handles standalone (no-gateway) deployments. GatewayNotifier delegates to the gateway process via HTTP.
type SMTPConfig ¶ added in v0.1.9
type SMTPConfig struct {
Host string
Port string // default "587"
User string
Pass string
From string
}
SMTPConfig holds the SMTP connection parameters read from pkg/konfig. Constructed by the caller (notification.Notifier) from konfig at startup.
func (SMTPConfig) EffectivePort ¶ added in v0.1.9
func (c SMTPConfig) EffectivePort() string
EffectivePort returns the port, defaulting to 587 (STARTTLS submission).
func (SMTPConfig) IsConfigured ¶ added in v0.1.9
func (c SMTPConfig) IsConfigured() bool
IsConfigured returns true when the minimum required SMTP fields are present.