orchestrator

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEnvPrefix = "VMCLARITY_ORCHESTRATOR"

	// Approximately half the polling delay to allow for more efficient
	// reconcile cascading e.g. reconciling scan config creates a scan, the
	// poller for scan is offset by 7 seconds so should pick up the new
	// scan after 7 seconds instead of the full poller time.
	DefaultControllerStartupDelay = 7 * time.Second
	DefaultProviderKind           = models.AWS
	DefaultHealthCheckAddress     = ":8082"
)

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(ctx context.Context, kind models.CloudProvider) (provider.Provider, error)

nolint:wrapcheck NewProvider returns an initialized provider.Provider based on the kind models.CloudProvider.

func Run

func Run(ctx context.Context, config *Config) error

Types

type Config

type Config struct {
	ProviderKind models.CloudProvider `json:"provider,omitempty" mapstructure:"provider"`

	APIServerAddress   string `json:"apiserver-address,omitempty" mapstructure:"apiserver_address"`
	HealthCheckAddress string `json:"healthcheck-address,omitempty" mapstructure:"healthcheck_address"`

	// The Orchestrator starts the Controller(s) in a sequence and the ControllerStartupDelay is used for waiting
	// before starting each Controller to avoid them hitting the API at the same time and allow one Controller
	// to pick up an event generated by the other without waiting until the next polling cycle.
	ControllerStartupDelay time.Duration `json:"controller-startup-delay,omitempty" mapstructure:"controller_startup_delay"`

	DiscoveryConfig                  discovery.Config                  `json:"discovery,omitempty" mapstructure:"discovery"`
	ScanConfigWatcherConfig          scanconfigwatcher.Config          `json:"scanconfig-watcher,omitempty" mapstructure:"scanconfig_watcher"`
	ScanWatcherConfig                scanwatcher.Config                `json:"scan-watcher,omitempty" mapstructure:"scan_watcher"`
	AssetScanWatcherConfig           assetscanwatcher.Config           `json:"assetscan-watcher,omitempty" mapstructure:"assetscan_watcher"`
	AssetScanEstimationWatcherConfig assetscanestimationwatcher.Config `json:"assetscan-estimation-watcher,omitempty" mapstructure:"assetscan_estimation_watcher"`
	ScanEstimationWatcherConfig      scanestimationwatcher.Config      `json:"scan-estimation-watcher,omitempty" mapstructure:"scan_estimation_watcher"`
	AssetScanProcessorConfig         assetscanprocessor.Config         `json:"assetscan-processor,omitempty" mapstructure:"assetscan_processor"`
}

func NewConfig

func NewConfig() (*Config, error)

type Controller

type Controller interface {
	Start(ctx context.Context)
}

type Orchestrator

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

func New

func New(ctx context.Context, config *Config) (*Orchestrator, error)

New returns a new Orchestrator initialized using the provided configuration.

func NewWithProvider

func NewWithProvider(config *Config, p provider.Provider, b *backendclient.BackendClient) (*Orchestrator, error)

NewWithProvider returns an Orchestrator initialized using the p provider.Provider. Use this method when Orchestrator needs to rely on custom provider.Provider implementation. E.g. End-to-End testing.

func (*Orchestrator) Start

func (o *Orchestrator) Start(ctx context.Context)

Start makes the Orchestrator to start all Controller(s).

func (*Orchestrator) Stop

func (o *Orchestrator) Stop(ctx context.Context)

Start makes the Orchestrator to stop all Controller(s).

Jump to

Keyboard shortcuts

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