Documentation ¶
Index ¶
- Variables
- func InitFlags(flagset *pflag.FlagSet)
- func RecordCompleteLatency(meta *metav1.ObjectMeta, kind string, controller string, version string, ...)
- func StartMonitor(carbonInformerFactory carboninformers.SharedInformerFactory, ...)
- type Controller
- type DefaultController
- func (c *DefaultController) AddRateLimited(key string)
- func (c *DefaultController) DeleteResource(obj interface{})
- func (c *DefaultController) DeleteSubObj(namespace, key string) error
- func (c *DefaultController) Enqueue(obj interface{})
- func (c *DefaultController) EnqueueAfter(key string, delay time.Duration)
- func (c *DefaultController) EnqueueDelayDuration(obj interface{})
- func (c *DefaultController) EnqueueNow(obj interface{})
- func (c *DefaultController) EnqueueWithoutEvent(obj interface{})
- func (c *DefaultController) Event(obj runtime2.Object, eventtype, reason, message string)
- func (c *DefaultController) Eventf(obj runtime2.Object, eventtype, reason, messageFmt string, args ...interface{})
- func (c *DefaultController) GetLatestUpdateTime(obj interface{}) time.Time
- func (c *DefaultController) GetObj(namespace, key string) (interface{}, error)
- func (c *DefaultController) HandleSubObject(obj interface{})
- func (c *DefaultController) HandleSubObjectDelayDuration(obj interface{})
- func (c *DefaultController) HandleSubObjectWithoutEvent(obj interface{})
- func (c *DefaultController) HandlerSubObjectIgnoreOwner(obj interface{})
- func (c *DefaultController) InitRecorder()
- func (c *DefaultController) RecordCrdChangeLatency(key string, kind string, obj metav1.Object)
- func (c *DefaultController) Run(threadiness int, stopCh <-chan struct{}, waiter *sync.WaitGroup) error
Constants ¶
This section is empty.
Variables ¶
var ( //UpdateCrdLatency crd UPDATE 到controller处理链路的延迟 UpdateCrdLatency = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: "carbon", Subsystem: "controller", Name: "update_crd_latency", Help: "no help can be found here", MaxAge: metric.SummaryMaxAge, AgeBuckets: metric.SummaryAgeBuckets, Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, }, []string{"cluster", "application", "rollingset", "group", "role", "kind", "controller"}, ) //CompleteLatency 从创建/更新到complete的时间 CompleteLatency = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: "carbon", Subsystem: "controller", Name: "complete_latency", Help: "no help can be found here", MaxAge: metric.SummaryMaxAge, AgeBuckets: metric.SummaryAgeBuckets, Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, }, []string{"cluster", "application", "rollingset", "group", "role", "kind", "controller"}, ) )
Functions ¶
func RecordCompleteLatency ¶
func RecordCompleteLatency(meta *metav1.ObjectMeta, kind string, controller string, version string, currCompleted bool)
RecordCompleteLatency 记录crd变更到实际处理的延迟
func StartMonitor ¶
func StartMonitor(carbonInformerFactory carboninformers.SharedInformerFactory, informerFactory informers.SharedInformerFactory, namespace string, selector labels.Selector)
StartMonitor 启动基础监控
Types ¶
type Controller ¶
type Controller interface { Run(threadiness int, stopCh <-chan struct{}, waiter *sync.WaitGroup) error ProcessNextWorkItem() bool Enqueue(obj interface{}) EnqueueWithoutEvent(obj interface{}) HandleSubObject(obj interface{}) HandleSubObjectWithoutEvent(obj interface{}) Sync(key string) error // impl by subclass // Get obj from apiserver by namespace and key GetObj(namespace, key string) (interface{}, error) // DeleteSubObj do garbage collection DeleteSubObj(namespace, key string) error // wait for informers synced WaitForCacheSync(stopCh <-chan struct{}) bool }
Controller is a general controllers defines, to handle crds
type DefaultController ¶
type DefaultController struct { Controller // GroupVersionKind indicates the controller type. // Different instances of this struct may handle different GVKs. // For example, this struct can be used (with adapters) to handle ReplicationController. schema.GroupVersionKind ResourceManager util.ResourceManager DelayProcessDuration time.Duration Waiter *sync.WaitGroup StopChan <-chan struct{} // contains filtered or unexported fields }
DefaultController is the abstract controller
func NewDefaultController ¶
func NewDefaultController( kubeclientset kubernetes.Interface, carbonclientset clientset.Interface, controllerAgentName string, controllerKind schema.GroupVersionKind, controller Controller) *DefaultController
NewDefaultController create DefaultController
func (*DefaultController) AddRateLimited ¶
func (c *DefaultController) AddRateLimited(key string)
AddRateLimited AddRateLimited
func (*DefaultController) DeleteResource ¶
func (c *DefaultController) DeleteResource(obj interface{})
DeleteResource delete resource record in controller
func (*DefaultController) DeleteSubObj ¶
func (c *DefaultController) DeleteSubObj(namespace, key string) error
DeleteSubObj DeleteSubObj
func (*DefaultController) Enqueue ¶
func (c *DefaultController) Enqueue(obj interface{})
Enqueue takes a obj resource and converts it into a namespace/name string which is then put onto the work queue. This method should *not* be passed resources of any type other than ReplicaSet.
func (*DefaultController) EnqueueAfter ¶
func (c *DefaultController) EnqueueAfter(key string, delay time.Duration)
EnqueueAfter enqueue key to the queue after the indicated duration has passed
func (*DefaultController) EnqueueDelayDuration ¶
func (c *DefaultController) EnqueueDelayDuration(obj interface{})
EnqueueDelayDuration takes a obj resource and compute a delay to add into
func (*DefaultController) EnqueueNow ¶
func (c *DefaultController) EnqueueNow(obj interface{})
EnqueueNow Enqueue immediately
func (*DefaultController) EnqueueWithoutEvent ¶
func (c *DefaultController) EnqueueWithoutEvent(obj interface{})
EnqueueWithoutEvent takes a obj resource and converts it into a namespace/name
func (*DefaultController) Event ¶
func (c *DefaultController) Event(obj runtime2.Object, eventtype, reason, message string)
func (*DefaultController) Eventf ¶
func (c *DefaultController) Eventf(obj runtime2.Object, eventtype, reason, messageFmt string, args ...interface{})
func (*DefaultController) GetLatestUpdateTime ¶
func (c *DefaultController) GetLatestUpdateTime(obj interface{}) time.Time
GetLatestUpdateTime 获取对象最近的更新时间
func (*DefaultController) GetObj ¶
func (c *DefaultController) GetObj(namespace, key string) (interface{}, error)
GetObj GetObj
func (*DefaultController) HandleSubObject ¶
func (c *DefaultController) HandleSubObject(obj interface{})
HandleSubObject will take any resource implementing metav1.Object and attempt to find the ReplicaSet resource that 'owns' it. It does this by looking at the objects metadata.ownerReferences field for an appropriate OwnerReference. It then enqueues that ReplicaSet resource to be processed. If the object does not have an appropriate OwnerReference, it will simply be skipped.
func (*DefaultController) HandleSubObjectDelayDuration ¶
func (c *DefaultController) HandleSubObjectDelayDuration(obj interface{})
HandleSubObjectDelayDuration will take any resource implementing metav1.Object and attempt to find the owner resource that 'owns' it. It does this by looking at the objects metadata.ownerReferences field for an appropriate OwnerReference. If the object does not have an appropriate OwnerReference, it will simply be skipped. It then enqueues that owner resource with delay duration.
func (*DefaultController) HandleSubObjectWithoutEvent ¶
func (c *DefaultController) HandleSubObjectWithoutEvent(obj interface{})
HandleSubObjectWithoutEvent will take any resource implementing metav1.Object and attempt to find the ReplicaSet resource that 'owns' it. It does this by looking at the objects metadata.ownerReferences field for an appropriate OwnerReference. It then enqueues that ReplicaSet resource to be processed. If the object does not have an appropriate OwnerReference, it will simply be skipped.
func (*DefaultController) HandlerSubObjectIgnoreOwner ¶
func (c *DefaultController) HandlerSubObjectIgnoreOwner(obj interface{})
HandlerSubObjectIgnoreOwner will take any resource implementing metav1.Object and attempt to find the owner resource that 'owns' it. It does this by looking at the objects metadata.ownerReferences field for an appropriate OwnerReference. If the object does not have an appropriate OwnerReference, it will simply be skipped. It does not enqueues that owner resource.
func (*DefaultController) InitRecorder ¶
func (c *DefaultController) InitRecorder()
func (*DefaultController) RecordCrdChangeLatency ¶
func (c *DefaultController) RecordCrdChangeLatency(key string, kind string, obj metav1.Object)
RecordCrdChangeLatency 记录crd变更到实际处理的延迟
func (*DefaultController) Run ¶
func (c *DefaultController) Run(threadiness int, stopCh <-chan struct{}, waiter *sync.WaitGroup) error
Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the workqueue and wait for workers to finish processing their current work items.
Directories ¶
Path | Synopsis |
---|---|
mock
Package mock_carbonjob is a generated GoMock package.
|
Package mock_carbonjob is a generated GoMock package. |
mock
Package mock_healthcheck is a generated GoMock package.
|
Package mock_healthcheck is a generated GoMock package. |
mock
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
Package worker is a generated GoMock package.
|
Package worker is a generated GoMock package. |