app

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHealthStatusExpirationPeriod = time.Duration(time.Minute)
	DefaultHTTPAPIEndpoint              = ":80"
	DefaultHTTPMonitoringEndpoint       = ":2223"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	HTTPAPIServer        *httpserver.HTTPServer
	HTTPMonitoringServer *httpserver.HTTPServer
	// contains filtered or unexported fields
}

func New

func New(config *Config, options *Options, cfs map[string]strawberry.ControllerFactory) (app App)

func (*App) IsLeader

func (app *App) IsLeader() bool

func (*App) Run

func (app *App) Run(stopCh <-chan struct{})

Run starts the infinite loop consisting of lock acquisition and agent operation.

type BaseConfig

type BaseConfig struct {
	// Token of the user for cluster initialization.
	// If not present, it is taken from STRAWBERRY_TOKEN env var.
	Token string `yson:"token"`

	// LocationProxy to be initialized
	Proxy string `yson:"proxy"`

	// Root points to root directory with operation states.
	StrawberryRoot ypath.Path `yson:"strawberry_root"`
}

type ClusterInitializer

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

func NewClusterInitializer

func NewClusterInitializer(config *ClusterInitializerConfig, familyToInitializerFactory map[string]strawberry.ClusterInitializerFactory) (initializer ClusterInitializer)

func (*ClusterInitializer) InitCluster

func (initializer *ClusterInitializer) InitCluster() error

type ClusterInitializerConfig

type ClusterInitializerConfig struct {
	BaseConfig

	// RobotUsername is the name of the robot from which all controller operations are done.
	RobotUsername string `yson:"robot_username"`

	Families []string `yson:"families"`
}

type Config

type Config struct {
	// Token of the user for coordination, operation and state management.
	// If not present, it is taken from STRAWBERRY_TOKEN env var.
	Token string `yson:"token"`

	// CoordinationProxy defines coordination cluster if it is needed; e.g. locke.
	CoordinationProxy *string `yson:"coordination_proxy"`

	// CoordinationPath is the path for a lock at the coordination cluster.
	CoordinationPath ypath.Path `yson:"coordination_path"`

	// LocationProxies defines operating clusters; e.g. hume or localhost:4243.
	LocationProxies []string `yson:"location_proxies"`

	// Strawberry contains strawberry-specific configuration.
	Strawberry agent.Config `yson:"strawberry"`

	// Controllers contains a mapping from controller family to opaque controller configs.
	Controllers map[string]yson.RawValue `yson:"controllers"`

	// Controller is a legacy way for defining CHYT controller config.
	Controller yson.RawValue `yson:"controller"`

	HTTPAPIEndpoint        *string `yson:"http_api_endpoint"`
	HTTPMonitoringEndpoint *string `yson:"http_monitoring_endpoint"`
	// HTTPControllerMappings contains rules of mapping a host to a controller family.
	// See https://github.com/go-chi/hostrouter/blob/master/README.md for key examples.
	HTTPControllerMappings map[string]string `yson:"http_controller_mappings"`
	// HTTPLocationAliases contains aliases for location proxies,
	// under which the location is accessible through http api.
	HTTPLocationAliases map[string][]string `yson:"http_location_aliases"`

	// HealthStatusExpirationPeriod defines when agent health status becomes outdated.
	HealthStatusExpirationPeriod *time.Duration `yson:"health_status_expiration_period"`

	BaseACL []yt.ACE `yson:"base_acl"`

	DisableAPIAuth bool `yson:"disable_api_auth"`
}

Config is taken from yson config file. It contains both strawberry-specific options and controller-specific options; at this point they are opaque and passed as raw YSON.

func (*Config) HTTPAPIEndpointOrDefault

func (c *Config) HTTPAPIEndpointOrDefault() string

func (*Config) HTTPMonitoringEndpointOrDefault

func (c *Config) HTTPMonitoringEndpointOrDefault() string

func (*Config) HealthStatusExpirationPeriodOrDefault

func (c *Config) HealthStatusExpirationPeriodOrDefault() time.Duration

type Location

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

Location defines an operating cluster.

type OneShotRunner

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

func NewOneShotRunner

func NewOneShotRunner(config *OneShotRunnerConfig, options *Options, cf strawberry.ControllerFactory) (runner OneShotRunner)

func (*OneShotRunner) Run

func (runner *OneShotRunner) Run(alias string, specletYson yson.RawValue) error

type OneShotRunnerConfig

type OneShotRunnerConfig struct {
	BaseConfig

	// Controller contains opaque controller config.
	Controller yson.RawValue `yson:"controller"`
}

type Options

type Options struct {
	LogToStderr bool
}

Options contains all options not controlled by config (e.g.. taken from CLI flags).

Jump to

Keyboard shortcuts

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