reporter

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

Package reporter is responsible for collecting per-node resources for scheduler; those resources are collected through multiple different sources, and updated in different K8S objects for needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterConverterInitializer added in v0.2.0

func RegisterConverterInitializer(gvk metav1.GroupVersionKind, initFunc ConverterInitFunc)

RegisterConverterInitializer registers a converter initializer function for a specific gvk, the function will be called when the reporter manager is created. The function should return a converter for the gvk. If the function is called multiple times for the same gvk, the last one will be used.

func RegisterReporterInitializer

func RegisterReporterInitializer(gvk metav1.GroupVersionKind, initFunc InitFunc)

Types

type Converter added in v0.2.0

type Converter interface {
	Convert(ctx context.Context, reportFields []*v1alpha1.ReportField) (*v1alpha1.ReportContent, error)
}

Converter converts the report fields to the format the reporter expects, for example, if the target crd version needs to be changed from v1alpha1 to v1, the converter can convert the v1alpha1's plugin report fields to v1 fields and report to the v1 reporter

type ConverterInitFunc added in v0.2.0

ConverterInitFunc is the function to initialize a converter

type InitFunc

InitFunc is used to initialize a particular reporter.

type Manager

type Manager interface {
	// PushContents gets ReportField list from report manager, the reporter implementation
	// should be responsible for assembling and updating the specific object.
	PushContents(ctx context.Context, responses map[string]*v1alpha1.GetReportContentResponse) error

	// Run starts all the updaters registered in this Manager.
	Run(ctx context.Context)
}

Manager indicates the way that resources are updated, and it is also responsible for other

func NewReporterManager

func NewReporterManager(genericClient *client.GenericClientSet, metaServer *metaserver.MetaServer,
	emitter metrics.MetricEmitter, conf *config.Configuration,
) (Manager, error)

NewReporterManager is to create a reporter manager

type ManagerStub

type ManagerStub struct {
	// contains filtered or unexported fields
}

ManagerStub a reporter manager stub

func NewReporterManagerStub

func NewReporterManagerStub() *ManagerStub

NewReporterManagerStub new a reporter stub

func (*ManagerStub) GetReportContentResponse

func (s *ManagerStub) GetReportContentResponse(pluginName string) *v1alpha1.GetReportContentResponse

GetReportContentResponse get reporter content from local cache

func (*ManagerStub) PushContents

func (s *ManagerStub) PushContents(_ context.Context, responses map[string]*v1alpha1.GetReportContentResponse) error

PushContents store response to local cache

func (*ManagerStub) Run

func (s *ManagerStub) Run(context.Context)

Run start the reporter manager stub

type Reporter

type Reporter interface {
	// Update receives ReportField list from report manager, the reporter implementation
	// should be responsible for assembling and updating the specific object
	// todo: consider whether we should perform real update actions asynchronously
	Update(ctx context.Context, fields []*v1alpha1.ReportField) error

	// Run starts the syncing logic of reporter
	Run(ctx context.Context)
}

Reporter use to update specific kind crd

type Stub

type Stub struct {
	// contains filtered or unexported fields
}

func NewReporterStub

func NewReporterStub() *Stub

func (*Stub) GetReportedFields

func (s *Stub) GetReportedFields() []*v1alpha1.ReportField

GetReportedFields get current fields just for test

func (*Stub) Run

func (s *Stub) Run(ctx context.Context)

func (*Stub) Update

func (s *Stub) Update(ctx context.Context, fields []*v1alpha1.ReportField) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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