msgbus

package
v1.24.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NamespacedNameFrom

func NamespacedNameFrom(namespace, name string) string

func NamespacedNameSplit

func NamespacedNameSplit(nm string) (string, string)

default/a -> default a default -> default "" -> "","" a/b/c -> a,b NamespacedNameSplit

Types

type ControlMessage

type ControlMessage struct {
	MessageType `json:"kind"`
	Content     CurrentWatch
}

type CurrentWatch

type CurrentWatch map[string]map[string][]string // cluster->kind->[]namespacedName

type EventKind

type EventKind string
const (
	Add    EventKind = "add"
	Update EventKind = "update"
	Delete EventKind = "delete"
)

type InvolvedObject

type InvolvedObject struct {
	Cluster        string
	Group          string
	Kind           string
	Version        string
	NamespacedName string
}

type MessageContent

type MessageContent struct {
	ResourceType
	ResouceID     uint
	CreatedAt     time.Time
	From          string
	To            []uint // 只在通知消息时有
	Detail        string
	AffectedUsers []uint // 受影响的用户
}

type MessageTarget

type MessageTarget struct {
	Message NotifyMessage
	Users   []uint
}

type MessageType

type MessageType string
const (
	Approve MessageType = "approve"       // 审批
	Message MessageType = "message"       // 消息
	Changed MessageType = "objectChanged" // k8s 对象变动
	Alert   MessageType = "alert"         // 告警消息
)

type NotifyMessage

type NotifyMessage struct {
	MessageType
	EventKind
	InvolvedObject *InvolvedObject
	Content        interface{}
}

type Options

type Options struct {
	Addr string `json:"addr" description:"msgbus host"`
}

func DefaultMsgbusOptions

func DefaultMsgbusOptions() *Options

type ResourceType

type ResourceType string
const (
	VirtualSpace ResourceType = "virtualSpace"
	Tenant       ResourceType = "tenant"
	Project      ResourceType = "project"
	Environment  ResourceType = "environment"
	Application  ResourceType = "application"
	Cluster      ResourceType = "cluster"
	User         ResourceType = "user"

	TenantResourceQuota ResourceType = "tenant-resource-quota"
)

Jump to

Keyboard shortcuts

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