notification

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConditionReady indicates the NotificationRequest is ready (or not)
	ConditionReady = "Ready"

	// ConditionTypeRoutingResolved indicates routing rule resolution completed
	// Status: True = routing resolved (rule matched or fallback)
	// Status: False = routing failed (error state)
	ConditionTypeRoutingResolved = "RoutingResolved"

	// Routing success reasons
	ReasonRoutingRuleMatched = "RoutingRuleMatched" // A routing rule matched successfully
	ReasonRoutingFallback    = "RoutingFallback"    // No rules matched, using console fallback
	ReasonRoutingFailed      = "RoutingFailed"      // Routing resolution failed (error state)

	// Ready condition reasons
	ReasonReady    = "Ready"
	ReasonNotReady = "NotReady"
)
View Source
const (
	NotificationTypeEscalation   = notificationv1alpha1.NotificationTypeEscalation
	NotificationTypeSimple       = notificationv1alpha1.NotificationTypeSimple
	NotificationTypeStatusUpdate = notificationv1alpha1.NotificationTypeStatusUpdate
)

Re-export notification type constants

View Source
const (
	NotificationPriorityCritical = notificationv1alpha1.NotificationPriorityCritical
	NotificationPriorityHigh     = notificationv1alpha1.NotificationPriorityHigh
	NotificationPriorityMedium   = notificationv1alpha1.NotificationPriorityMedium
	NotificationPriorityLow      = notificationv1alpha1.NotificationPriorityLow
)

Re-export priority constants

View Source
const (
	NotificationPhasePending       = notificationv1alpha1.NotificationPhasePending
	NotificationPhaseSending       = notificationv1alpha1.NotificationPhaseSending
	NotificationPhaseSent          = notificationv1alpha1.NotificationPhaseSent
	NotificationPhasePartiallySent = notificationv1alpha1.NotificationPhasePartiallySent
	NotificationPhaseFailed        = notificationv1alpha1.NotificationPhaseFailed
)

Re-export phase constants

Re-export channel constants

Variables

This section is empty.

Functions

func GetCondition

func GetCondition(notif *notificationv1alpha1.NotificationRequest, condType string) *metav1.Condition

GetCondition returns the condition with the given type, or nil if not found.

func GetRoutingResolved

func GetRoutingResolved(notif *notificationv1alpha1.NotificationRequest) *metav1.Condition

GetRoutingResolved returns the RoutingResolved condition from the NotificationRequest.

func IsRoutingResolved

func IsRoutingResolved(notif *notificationv1alpha1.NotificationRequest) bool

IsRoutingResolved checks if routing was successfully resolved. Both RoutingRuleMatched and RoutingFallback are considered successful (Status=True).

func SetCondition

func SetCondition(notif *notificationv1alpha1.NotificationRequest, condType string, status metav1.ConditionStatus, reason, message string)

SetCondition sets an arbitrary condition on the NotificationRequest using meta.SetStatusCondition, which handles LastTransitionTime correctly.

func SetReady

func SetReady(notif *notificationv1alpha1.NotificationRequest, ready bool, reason, message string)

SetReady sets the Ready condition on the NotificationRequest.

func SetRoutingResolved

func SetRoutingResolved(notif *notificationv1alpha1.NotificationRequest, status metav1.ConditionStatus, reason, message string)

SetRoutingResolved sets the RoutingResolved condition on the NotificationRequest.

Types

type ActionLink = notificationv1alpha1.ActionLink

ActionLink represents external service links

type Channel

type Channel = notificationv1alpha1.Channel

Channel defines delivery channels

type Client

type Client interface {
	// Create creates a new notification request
	// Returns error if creation fails or if notification already exists
	Create(ctx context.Context, notif *notificationv1alpha1.NotificationRequest) error

	// Get retrieves a notification request by name and namespace
	// Returns the notification or error if not found
	Get(ctx context.Context, name, namespace string) (*notificationv1alpha1.NotificationRequest, error)

	// List lists all notification requests in a namespace
	// Pass empty string for namespace to list across all namespaces
	List(ctx context.Context, namespace string, opts ...client.ListOption) (*notificationv1alpha1.NotificationRequestList, error)

	// Update updates an existing notification request
	// Note: Updates to spec may be rejected by the controller based on current phase
	Update(ctx context.Context, notif *notificationv1alpha1.NotificationRequest) error

	// Delete deletes a notification request
	// Uses foreground deletion policy to ensure cleanup
	Delete(ctx context.Context, name, namespace string) error

	// UpdateStatus updates the status subresource
	// This is used by the controller to update delivery status, phase, etc.
	UpdateStatus(ctx context.Context, notif *notificationv1alpha1.NotificationRequest) error
}

Client provides operations for NotificationRequest CRDs This interface abstracts Kubernetes client operations for notification resources, enabling clean integration with RemediationOrchestrator and other controllers.

Usage in RemediationOrchestrator:

notifClient := notification.NewClient(k8sClient)
err := notifClient.Create(ctx, &notificationv1alpha1.NotificationRequest{
    ObjectMeta: metav1.ObjectMeta{Name: "alert-notification", Namespace: "default"},
    Spec: notificationv1alpha1.NotificationRequestSpec{...},
})

func NewClient

func NewClient(k8sClient client.Client) Client

NewClient creates a new notification client The k8sClient should be a controller-runtime client with NotificationRequest scheme registered

type NotificationPhase

type NotificationPhase = notificationv1alpha1.NotificationPhase

NotificationPhase defines the lifecycle phase

type NotificationPriority

type NotificationPriority = notificationv1alpha1.NotificationPriority

NotificationPriority defines the priority level

type NotificationRequest

type NotificationRequest = notificationv1alpha1.NotificationRequest

NotificationRequest is the main CRD type

type NotificationRequestList

type NotificationRequestList = notificationv1alpha1.NotificationRequestList

NotificationRequestList contains a list of NotificationRequest

type NotificationRequestSpec

type NotificationRequestSpec = notificationv1alpha1.NotificationRequestSpec

NotificationRequestSpec defines the desired state

type NotificationRequestStatus

type NotificationRequestStatus = notificationv1alpha1.NotificationRequestStatus

NotificationRequestStatus defines the observed state

type NotificationType

type NotificationType = notificationv1alpha1.NotificationType

NotificationType defines the type of notification

type RetryPolicy

type RetryPolicy = notificationv1alpha1.RetryPolicy

RetryPolicy defines retry behavior

Directories

Path Synopsis
Package delivery provides shared error types for notification delivery
Package delivery provides shared error types for notification delivery
Package metrics provides Prometheus metrics for the Notification controller.
Package metrics provides Prometheus metrics for the Notification controller.
Package phase provides phase constants and state machine logic for Notification service.
Package phase provides phase constants and state machine logic for Notification service.
Package routing implements BR-NOT-065 (Channel Routing Based on Spec Fields) and BR-NOT-066 (Alertmanager-Compatible Configuration Format).
Package routing implements BR-NOT-065 (Channel Routing Based on Spec Fields) and BR-NOT-066 (Alertmanager-Compatible Configuration Format).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL