app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 54 Imported by: 0

Documentation

Overview

Package app implements a server that runs a set of active components. This includes sync controllers, chains and namespace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAvailableResources

func GetAvailableResources(clientBuilder clientbuilder.ControllerClientBuilder) (map[schema.GroupVersionResource]bool, error)

GetAvailableResources gets the map which contains all available resources of the apiserver TODO: In general, any controller checking this needs to be dynamic so users don't have to restart their controller manager if they change the apiserver. Until we get there, the structure here needs to be exposed for the construction of a proper ControllerContext.

func NewControllerManagerCommand

func NewControllerManagerCommand() *cobra.Command

NewControllerManagerCommand creates a *cobra.Command object with default parameters.

func ResyncPeriod

func ResyncPeriod(c *config.CompletedConfig) func() time.Duration

ResyncPeriod returns a function which generates a duration each time it is invoked; this is so that multiple controllers don't get into lock-step and all hammer the apiserver with list requests simultaneously.

func Run

func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error

Run runs the controller manager options. This should never exit.

Types

type Cleaner

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

Cleaner is a struct that represents a set of cleaners used to clean deleted resources from onex db.

func (*Cleaner) Start

func (c *Cleaner) Start(ctx context.Context) error

Start starts the Cleaner and runs the SyncAll() method periodically.

func (*Cleaner) SyncAll

func (c *Cleaner) SyncAll(ctx context.Context)

SyncAll runs the Sync() method of all registered cleaners.

type ControllerContext

type ControllerContext struct {
	// ClientBuilder will provide a client for this controller to use
	ClientBuilder clientbuilder.ControllerClientBuilder

	// InformerFactory gives access to informers for the controller.
	InformerFactory informers.SharedInformerFactory

	// ObjectOrMetadataInformerFactory gives access to informers for typed resources
	// and dynamic resources by their metadata. All generic controllers currently use
	// object metadata - if a future controller needs access to the full object this
	// would become GenericInformerFactory and take a dynamic client.
	ObjectOrMetadataInformerFactory informerfactory.InformerFactory

	// DeferredDiscoveryRESTMapper is a RESTMapper that will defer
	// initialization of the RESTMapper until the first mapping is
	// requested.
	RESTMapper *restmapper.DeferredDiscoveryRESTMapper

	// AvailableResources is a map listing currently available resources
	AvailableResources map[schema.GroupVersionResource]bool

	// InformersStarted is closed after all of the controllers have been initialized and are running.  After this point it is safe,
	// for an individual controller to start the shared informers. Before it is closed, they should not.
	InformersStarted chan struct{}

	// ResyncPeriod generates a duration each time it is invoked; this is so that
	// multiple controllers don't get into lock-step and all hammer the apiserver
	// with list requests simultaneously.
	ResyncPeriod func() time.Duration

	// ComponentConfig provides access to init options for a given controller
	ComponentConfig *ctrlmgrconfig.OneXControllerManagerConfiguration
}

ControllerContext defines the context object for controller.

func CreateControllerContext

func CreateControllerContext(s *config.CompletedConfig, rootClientBuilder, clientBuilder clientbuilder.ControllerClientBuilder, stop <-chan struct{}) (ControllerContext, error)

CreateControllerContext creates a context struct containing references to resources needed by the controllers such as clientBuilder. rootClientBuilder is only used for the shared-informers client.

type ICleaner

type ICleaner interface {
	// Name returns the name of the cleaner.
	Name() string

	// Sync performs the synchronization operation.
	Sync(ctx context.Context) error

	// Initialize initializes the cleaner with the provided client and store client.
	Initialize(client client.Client, storeClient store.IStore)
}

ICleaner interface defines the methods required for a cleaner implementation:.

Directories

Path Synopsis
Package options provides the flags used for the controller manager.
Package options provides the flags used for the controller manager.

Jump to

Keyboard shortcuts

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