di

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package di organizes the dependencies. All services are only initialized on this package. di means dependency injection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

Container saves and provides dependencies.

func NewDIContainer

func NewDIContainer(
	client clientset.Interface,
	dynamicClient dynamic.Interface,
	restMapper meta.RESTMapper,
	etcdclient *clientv3.Client,
	restclientCfg *restclient.Config,
	initialSchedulerCfg *configv1.KubeSchedulerConfiguration,
	externalImportEnabled bool,
	resourceSyncEnabled bool,
	externalClient clientset.Interface,
	externalDynamicClient dynamic.Interface,
	externalSchedulerEnabled bool,
	simulatorPort int,
	syncerOptions syncer.Options,
) (*Container, error)

NewDIContainer initializes Container. It initializes all service and puts to Container. Only when externalImportEnabled is true, the simulator uses externalClient and creates ImportClusterResourceService.

func (*Container) ExportService

func (c *Container) ExportService() SnapshotService

ExportService returns ExportService.

func (*Container) ExtenderService

func (c *Container) ExtenderService() ExtenderService

ExtenderService returns ExtenderService.

func (*Container) OneshotClusterResourceImporter added in v0.3.0

func (c *Container) OneshotClusterResourceImporter() OneShotClusterResourceImporter

OneshotClusterResourceImporter returns OneshotClusterResourceImporter. Note: this service will return nil when `externalImportEnabled` is false.

func (*Container) ResetService

func (c *Container) ResetService() ResetService

ResetService returns ResetService.

func (*Container) ResourceSyncer added in v0.3.0

func (c *Container) ResourceSyncer() ResourceSyncer

ResourceSyncer returns ResourceSyncer.

func (*Container) ResourceWatcherService

func (c *Container) ResourceWatcherService() ResourceWatcherService

ResourceWatcherService returns ResourceWatcherService.

func (*Container) SchedulerService

func (c *Container) SchedulerService() SchedulerService

SchedulerService returns SchedulerService.

type ExtenderService

ExtenderService represents service for the extender of scheduler.

type OneShotClusterResourceImporter added in v0.3.0

type OneShotClusterResourceImporter interface {
	ImportClusterResources(ctx context.Context) error
}

OneShotClusterResourceImporter represents a service to import resources from an target cluster when starting the simulator.

type ResetService

type ResetService interface {
	Reset(ctx context.Context) error
}

type ResourceSyncer added in v0.3.0

type ResourceSyncer interface {
	// Run starts the resource syncer.
	// It should be run until the context is canceled.
	Run(ctx context.Context) error
}

ResourceSyncer represents a service to constantly sync resources from an target cluster.

type ResourceWatcherService

type ResourceWatcherService interface {
	ListWatch(ctx context.Context, stream streamwriter.ResponseStream, lrVersions *resourcewatcher.LastResourceVersions) error
}

ResourceWatcherService represents service for watch k8s resources.

type SchedulerService

type SchedulerService interface {
	GetSchedulerConfig() (*configv1.KubeSchedulerConfiguration, error)
	RestartScheduler(cfg *configv1.KubeSchedulerConfiguration) error
	StartScheduler(cfg *configv1.KubeSchedulerConfiguration) error
	ResetScheduler() error
	ShutdownScheduler()
	ExtenderService() scheduler.ExtenderService
}

SchedulerService represents service for manage scheduler.

type SnapshotService added in v0.1.1

type SnapshotService interface {
	Snap(ctx context.Context, opts ...snapshot.Option) (*snapshot.ResourcesForSnap, error)
	Load(ctx context.Context, resources *snapshot.ResourcesForLoad, opts ...snapshot.Option) error
	IgnoreErr() snapshot.Option
}

SnapshotService represents a service for exporting/importing resources on the simulator.

Jump to

Keyboard shortcuts

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