event

package
v0.0.0-...-41dce0b Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreateEvent event associated with new objects in an informer
	CreateEvent = "CREATE"
	// UpdateEvent event associated with an object update in an informer
	UpdateEvent = "UPDATE"
	// DeleteEvent event associated when an object is removed from an informer
	DeleteEvent = "DELETE"
)

Variables

View Source
var AdminAlertNS = map[string]string{
	"kube-system":        "kube-system-ns",
	"kube-public":        "kube-public-ns",
	"default":            "default-ns",
	"ingress-nginx":      "ingress-nginx",
	"ingress-nginx-blue": "ingress-nginx-blue",
	"cre":                "cre",
	"monitoring":         "monitoring",
	"ops":                "ops",
	"weave":              "weave",
}

TODO 改为可配置的

View Source
var AdminAlertReasonType = map[string]string{
	"SystemOOM":                    "节点系统发生oom",
	"FailedCreatePodContainer":     "创建容器失败",
	"Evicted":                      "Pod因节点异常被驱逐",
	"DeletingAllPods":              "删除节点上所有pod",
	"FailedCreate":                 "FailedCreate",
	"ReplicaSetCreateError":        "ReplicaSetCreateError",
	"EvictionThresholdMet":         "磁盘空间不足准备尝试清理",
	"FailedToStartNodeHealthcheck": "FailedToStartNodeHealthcheck",
	"NodeHasDiskPressure":          "kubelet面临节点磁盘可用空间不足的压力",
	"NodeNotReady":                 "Node节点不可用",
	"NodeHasInsufficientMemory":    "Node没有足够的可用内存",
	"InvalidDiskCapacity":          "InvalidDiskCapacity ",
	"FreeDiskSpaceFailed":          "FreeDiskSpaceFailed",
	"InsufficientFreeCPU":          "没有足够的CPU",
	"InsufficientFreeMemory":       "没有足够的内存",
	"HostNetworkNotSupported":      "HostNetworkNotSupported",
	"Failed":                       "Failed",
	"NodeNotSchedulable":           "Node不可被调度",
	"KubeletSetupFailed":           "KubeletSetupFailed",
	"FailedAttachVolume":           "FailedAttachVolume",
	"FailedDetachVolume":           "FailedDetachVolume",
	"VolumeResizeFailed":           "VolumeResizeFailed",
	"FileSystemResizeFailed":       "FileSystemResizeFailed",
	"FailedUnMount":                "FailedUnMount",
	"FailedUnmapDevice":            "FailedUnmapDevice",
	"HostPortConflict":             "Host节点端口冲突,请配置正确的端口",
	"NodeSelectorMismatching":      "NodeSelectorMismatching",
	"NilShaper":                    "NilShaper",
	"Rebooted":                     "Rebooted",
	"ContainerGCFailed":            "ContainerGCFailed",
	"ErrImageNeverPull":            "ErrImageNeverPull",
	"NetworkNotReady":              "NetworkNotReady",
	"FailedKillPod":                "FailedKillPod",
	"RemovingNode":                 "节点被执行下线",
	"FailedMount":                  "FailedMount",
	"FailedScheduling":             "调度失败",
}
View Source
var NormalReasonType = map[string]string{
	"NodeSchedulable":         "NodeSchedulable",
	"NodeReady":               "NodeReady",
	"Pulling":                 "Pulling",
	"Scheduled":               "Scheduled",
	"Pulled":                  "Pulled",
	"Started":                 "Started",
	"Created":                 "Created",
	"CREATE":                  "CREATE",
	"UPDATE":                  "UPDATE",
	"DELETE":                  "DELETE",
	"Starting":                "Starting",
	"SuccessfulMountVolume":   "SuccessfulMountVolume",
	"SuccessfulCreate":        "SuccessfulCreate",
	"SuccessfulDelete":        "SuccessfulDelete",
	"ScalingReplicaSet":       "ScalingReplicaSet",
	"RegisteredNode":          "RegisteredNode",
	"LeaderElection":          "LeaderElection",
	"CreatedLoadBalancer":     "CreatedLoadBalancer",
	"NodeHasNoDiskPressure":   "Node节点没有磁盘压力",
	"NodeHasSufficientMemory": "Node节点有足够的可用内存",
	"NodeHasSufficientDisk":   "Node节点有足够的可用硬盘空间",
	"SandboxChanged":          "SandboxChanged",
	"FailedCreatePodSandBox":  "FailedCreatePodSandBox",
	"FailedPodSandBoxStatus":  "FailedPodSandBoxStatus",
}
View Source
var RecoverReasonType = map[string]string{
	"NodeReady": "NodeReady",
}
View Source
var UserAlertReasonType = map[string]string{
	"HostPortConflict": "Host节点端口冲突,请配置正确的端口",
	"BackOff":          "BackOff",
	"CrashLoopBackOff": "容器启动失败",
	"Killing":          "容器被删除",
	"UnhealthKilling":  "容器因健康检查失败被删除",
}
View Source
var WarnAlertReasonType = map[string]string{
	"Unhealthy":               "容器Health接口异常,状态为Unhealthy",
	"FailedSync":              "FailedSync",
	"FailedPostStartHook":     "容器创建时,执行初始化脚本出错",
	"FailedPreStopHook":       "容器销毁时,执行脚本出错,容器会被正常销毁,需要修改PreStop shell",
	"ImageGCFailed":           "ImageGCFailed",
	"FailedDaemonPod":         "FailedDaemonPod",
	"NodeControllerEviction":  "标记node上的pod为待删除",
	"NodeAllocatableEnforced": "NodeAllocatableEnforced",
	"ProbeWarning":            "ProbeWarning 健康检查有异常",
	"UnfinishedPreStopHook":   "容器在销毁前执行用户自定义脚本超过用户设置的TimeOut,容器会被强行删除,请配置正确的Shell脚本",
}

可不报警,仅做警示。

Functions

This section is empty.

Types

type Event

type Event struct {
	Namespace               string `json:"namespace"`
	Kind                    string `json:"kind"`
	Component               string `json:"component"`
	Host                    string `json:"host"`
	Reason                  string `json:"reason"`
	Status                  string `json:"status"` //暂未用到
	Name                    string `json:"name"`
	CreationTimestamp       string `json:"creationTimestamp"`
	Action                  string `json:"action"`
	Count                   int32  `json:"count"`
	Messages                string `json:"short_message"`
	Type                    string `json:"type"`
	FirstTimestamp          string `json:"firstTimestamp"`
	LastTimestamp           string `json:"lastTimestamp"`
	ServiceName             string `json:"serviceName"`
	ResourceVersion         string `json:"resourceVersion"`
	UpdateContent           string
	InvolvedName            string `json:"involvedName"` //add for event's InvolvedObject
	InvolvedNamespace       string `json:"involvedNamespace"`
	InvolvedKind            string `json:"involvedKind"`
	InvolvedResourceVersion string `json:"involvedResourceVersion"`
}

Event represent an event got from k8s api server Events from different endpoints need to be casted to KubewatchEvent before being able to be handled by handler

kind 和cache.NewListWatchFromClient使用的resource要一致

func New

func New(obj interface{}, action string) Event

New create new diy K8satchEvent 涵盖几乎所有k8s资源对象 handler各自调用,改为统一New之后传给handler 避免重复New

func (*Event) Message

func (e *Event) Message() (msg string)

Jump to

Keyboard shortcuts

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