當前位置: 首頁>>代碼示例>>Golang>>正文


Golang unversioned.EventsGetter類代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/pkg/client/typed/generated/core/unversioned.EventsGetter的典型用法代碼示例。如果您正苦於以下問題:Golang EventsGetter類的具體用法?Golang EventsGetter怎麽用?Golang EventsGetter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了EventsGetter類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewHorizontalController

func NewHorizontalController(evtNamespacer unversionedcore.EventsGetter, scaleNamespacer unversionedextensions.ScalesGetter, hpaNamespacer unversionedextensions.HorizontalPodAutoscalersGetter, metricsClient metrics.MetricsClient) *HorizontalController {
    broadcaster := record.NewBroadcaster()
    broadcaster.StartRecordingToSink(evtNamespacer.Events(""))
    recorder := broadcaster.NewRecorder(api.EventSource{Component: "horizontal-pod-autoscaler"})

    return &HorizontalController{
        metricsClient:   metricsClient,
        eventRecorder:   recorder,
        scaleNamespacer: scaleNamespacer,
        hpaNamespacer:   hpaNamespacer,
    }
}
開發者ID:jdevesa,項目名稱:kubernetes,代碼行數:12,代碼來源:horizontal.go

示例2: NewHorizontalController

func NewHorizontalController(evtNamespacer unversionedcore.EventsGetter, scaleNamespacer unversionedextensions.ScalesGetter, hpaNamespacer unversionedextensions.HorizontalPodAutoscalersGetter, metricsClient metrics.MetricsClient, resyncPeriod time.Duration) *HorizontalController {
    broadcaster := record.NewBroadcaster()
    broadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{evtNamespacer.Events("")})
    recorder := broadcaster.NewRecorder(api.EventSource{Component: "horizontal-pod-autoscaler"})

    controller := &HorizontalController{
        metricsClient:   metricsClient,
        eventRecorder:   recorder,
        scaleNamespacer: scaleNamespacer,
        hpaNamespacer:   hpaNamespacer,
    }

    controller.store, controller.controller = framework.NewInformer(
        &cache.ListWatch{
            ListFunc: func(options api.ListOptions) (runtime.Object, error) {
                return controller.hpaNamespacer.HorizontalPodAutoscalers(api.NamespaceAll).List(options)
            },
            WatchFunc: func(options api.ListOptions) (watch.Interface, error) {
                return controller.hpaNamespacer.HorizontalPodAutoscalers(api.NamespaceAll).Watch(options)
            },
        },
        &extensions.HorizontalPodAutoscaler{},
        resyncPeriod,
        framework.ResourceEventHandlerFuncs{
            AddFunc: func(obj interface{}) {
                hpa := obj.(*extensions.HorizontalPodAutoscaler)
                hasCPUPolicy := hpa.Spec.CPUUtilization != nil
                _, hasCustomMetricsPolicy := hpa.Annotations[HpaCustomMetricsTargetAnnotationName]
                if !hasCPUPolicy && !hasCustomMetricsPolicy {
                    controller.eventRecorder.Event(hpa, api.EventTypeNormal, "DefaultPolicy", "No scaling policy specified - will use default one. See documentation for details")
                }
                err := controller.reconcileAutoscaler(hpa)
                if err != nil {
                    glog.Warningf("Failed to reconcile %s: %v", hpa.Name, err)
                }
            },
            UpdateFunc: func(old, cur interface{}) {
                hpa := cur.(*extensions.HorizontalPodAutoscaler)
                err := controller.reconcileAutoscaler(hpa)
                if err != nil {
                    glog.Warningf("Failed to reconcile %s: %v", hpa.Name, err)
                }
            },
            // We are not interested in deletions.
        },
    )

    return controller
}
開發者ID:jwforres,項目名稱:origin,代碼行數:49,代碼來源:horizontal.go

示例3: NewHorizontalController

func NewHorizontalController(evtNamespacer unversionedcore.EventsGetter, scaleNamespacer unversionedextensions.ScalesGetter, hpaNamespacer unversionedextensions.HorizontalPodAutoscalersGetter, metricsClient metrics.MetricsClient, resyncPeriod time.Duration) *HorizontalController {
    broadcaster := record.NewBroadcaster()
    broadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{evtNamespacer.Events("")})
    recorder := broadcaster.NewRecorder(api.EventSource{Component: "horizontal-pod-autoscaler"})

    controller := &HorizontalController{
        metricsClient:   metricsClient,
        eventRecorder:   recorder,
        scaleNamespacer: scaleNamespacer,
        hpaNamespacer:   hpaNamespacer,
    }
    store, frameworkController := newInformer(controller, resyncPeriod)
    controller.store = store
    controller.controller = frameworkController

    return controller
}
開發者ID:xiaohui,項目名稱:kubernetes,代碼行數:17,代碼來源:horizontal.go


注:本文中的k8s/io/kubernetes/pkg/client/typed/generated/core/unversioned.EventsGetter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。