controller

package
v0.0.0-...-bd297b8 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: Apache-2.0 Imports: 19 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"
	// ConfigurationEvent event associated when a configuration object is created or updated
	ConfigurationEvent = "CONFIGURATION"
)

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-decision": "ingress-nginx-decision",
	"ingress-nginx-newapp":   "ingress-nginx-newapp",
}
View Source
var AdminAlertReasonType = map[string]string{
	"NodeHasNoDiskPressure":    "Node节点没有足够的磁盘可供分配",
	"NodeHasSufficientMemory":  "Node节点没有足够的内存可供分配",
	"NodeHasSufficientDisk":    "Node节点没有足够的硬盘可供分配",
	"NodeNotReady":             "Node节点不可用",
	"SandboxChanged":           "Network Error Or init image was changed",
	"InvalidDiskCapacity":      "InvalidDiskCapacity ",
	"FreeDiskSpaceFailed":      "FreeDiskSpaceFailed",
	"InsufficientFreeCPU":      "没有足够的CPU",
	"InsufficientFreeMemory":   "没有足够的内存",
	"HostNetworkNotSupported":  "HostNetworkNotSupported",
	"FailedCreatePodContainer": "FailedCreatePodContainer",
	"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",
	"ImageGCFailed":            "ImageGCFailed",
	"FailedCreatePodSandBox":   "FailedCreatePodSandBox",
	"FailedPodSandBoxStatus":   "FailedPodSandBoxStatus",
	"ErrImageNeverPull":        "ErrImageNeverPull",
	"NetworkNotReady":          "NetworkNotReady",
	"FailedKillPod":            "FailedKillPod",
	"RemovingNode":             "节点被执行下线",
}
View Source
var NormalReasonType = map[string]string{
	"NodeSchedulable":       "NodeSchedulable",
	"Pulling":               "Pulling",
	"Scheduled":             "Scheduled",
	"Pulled":                "Pulled",
	"Started":               "Started",
	"Created":               "Created",
	"SuccessfulMountVolume": "SuccessfulMountVolume",
	"SuccessfulCreate":      "SuccessfulCreate",
	"SuccessfulDelete":      "SuccessfulDelete",
}
View Source
var RecoverReasonType = map[string]string{}
View Source
var UserAlertReasonType = map[string]string{
	"FailedPostStartHook": "容器创建时,执行初始化脚本出错",

	"UnfinishedPreStopHook":    "容器在销毁前执行用户自定义脚本超过用户设置的TimeOut,容器会被强行删除,请配置正确的Shell脚本",
	"HostPortConflict":         "Host节点端口冲突,请配置正确的端口",
	"BackOff":                  "BackOff",
	"Failed":                   "Failed",
	"CrashLoopBackOff":         "容器启动失败",
	"FailedCreatePodContainer": "创建容器失败",

	"Killing": "容器被删除",
}

Functions

This section is empty.

Types

type Controller

type Controller struct {
	MQClient       *store.RabbitMQClient
	InfluxdbClient *store.InfluxDBClient
	// contains filtered or unexported fields
}

Controller object

func NewResourceController

func NewResourceController(client kubernetes.Interface, informer cache.SharedIndexInformer, config config.Config) *Controller

func (*Controller) AlertWorker

func (c *Controller) AlertWorker(msg map[string]string, evt *api_v1.Event) error

//判断事件性质,区分出管理员类别admin和用户类别user //1,基于alerttype进行初步区分,匹配adminType的设置为admin //2,对于usertype的,排除正常的kill //3,属于管理员的ns则设置为admin //4,其他不发送报警

func (*Controller) HasSynced

func (c *Controller) HasSynced() bool

HasSynced is required for the cache.Controller interface.

func (*Controller) LastSyncResourceVersion

func (c *Controller) LastSyncResourceVersion() string

LastSyncResourceVersion is required for the cache.Controller interface.

func (*Controller) Run

func (c *Controller) Run(stopCh <-chan struct{})

Run starts the kubewatch controller

type Event

type Event struct {
	Type string
	Obj  *api_v1.Event
	Key  string
}

Jump to

Keyboard shortcuts

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