processconfig

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeConfig

func MergeConfig(into, from *Config) error

MergeConfig merges config from one into another, note that it does not support all fields as it's not necessary yet, mostly external configuration ones

func MergeConfigFromEnv

func MergeConfigFromEnv(cfg *Config) error

func MergeTeleConfig

func MergeTeleConfig(into, from *telecfg.FileConfig) error

func MergeTeleConfigFromEnv

func MergeTeleConfigFromEnv(cfg *telecfg.FileConfig) error

func ReplacePublicAddrs

func ReplacePublicAddrs(into, from *service.Config)

ReplacePublicAddrs replaces public addresses of all services in the specified config from the provided config.

Types

type ChartsConfig

type ChartsConfig struct {
	// Backend is the chart repository backend.
	//
	// Currently only cluster-local backend is supported (i.e. repository
	// index file and charts are stored in the cluster's database/object
	// storage). Other backends, such as S3, will/can be added later.
	Backend string `yaml:"backend"`
}

ChartsConfig defines Helm charts repository configuration.

func (*ChartsConfig) CheckAndSetDefaults

func (c *ChartsConfig) CheckAndSetDefaults() error

CheckAndSetDefaults validates chart repository configuration.

type Config

type Config struct {
	Hostname string `yaml:"hostname"`

	// Mode specifies operation mode, either opscenter or site
	Mode string `yaml:"mode"`

	// Profile specifies performance profiling settings
	Profile ProfileConfig `yaml:"profile"`

	// Devmode defines a development mode that takes several shortcuts in favor
	// of simplicity.
	// In this mode the following things are different:
	//  - web assets are assumed in certain static locations (and not as a package)
	//  - SSL traffic uses self-signed certificates
	Devmode bool `yaml:"devmode"`

	// ClusterName is used in wizard mode to indicate the name of the cluster
	// that is being installed
	ClusterName string `yaml:"-"`

	// WebAssetsDir defines the location of the web assets.
	// If unspecified, defaults to:
	//   * web/dist (relative to current directory, when Devmode == true)
	//   * GravityWebAssetsDir
	WebAssetsDir string `yaml:"web_assets_dir"`

	// DataDir is a directory with local database and package files
	DataDir string `yaml:"data_dir"`

	// HealthAddr provides HTTP API for health and readiness checks
	HealthAddr teleutils.NetAddr `yaml:"health_addr"`

	// BackendType is a type of storage backend
	BackendType string `yaml:"backend_type"`

	// ETCD provides etcd config options
	ETCD keyval.ETCDConfig `yaml:"etcd"`

	// OpsCenter provides settings for OpsCenter
	OpsCenter OpsCenterConfig `yaml:"ops"`

	// Pack provides settings for package service
	Pack PackageServiceConfig `yaml:"pack"`

	// Charts is Helm chart repository configuration.
	Charts ChartsConfig `yaml:"charts"`

	// Users list allows to add registered users to the application
	// e.g. application admins, what is handy for development purposes
	Users Users `yaml:"users"`

	// InstallLogFiles is a list of install log files with user
	// facing diagnostic logs
	InstallLogFiles []string `yaml:"install_log_files"`

	// ImportDir specifies optional directory with bootstrap data.
	//
	// An instance of gravity working in site mode will use this location
	// to bootstrap itself with the data from Ops Center
	ImportDir string `yaml:"-"`

	// ServiceUser specifies the service user to use for wizard-based installation.
	ServiceUser *systeminfo.User `yaml:"-"`

	// InstallToken specifies the authentication token for the install operation
	InstallToken string `yaml:"-"`
}

Config is a gravity specific file config

func ReadConfig

func ReadConfig(configDir string) (*Config, *telecfg.FileConfig, error)

ReadConfig reads gravity OpsCenter or Site configuration directory if path is empty, it looks in default locations.

func (*Config) CheckAndSetDefaults

func (cfg *Config) CheckAndSetDefaults() error

func (Config) CreateBackend

func (cfg Config) CreateBackend() (backend storage.Backend, err error)

func (Config) ProcessID

func (cfg Config) ProcessID() string

func (Config) WizardAddr

func (cfg Config) WizardAddr() (addr string)

WizardAddr returns the address of the wizard endpoint

type Identity

type Identity struct {
	Email       string `yaml:"email" json:"email"`
	ConnectorID string `yaml:"connector_id" json:"connector_id"`
}

func (*Identity) Parse

type Locators

type Locators []loc.Locator

func (*Locators) UnmarshalYAML

func (l *Locators) UnmarshalYAML(unmarshal func(interface{}) error) error

type OpsCenterConfig

type OpsCenterConfig struct {
	// SeedConfig defines optional configuration to apply on OpsCenter start
	SeedConfig *ops.SeedConfig `yaml:"seed_config"`
}

OpsCenterConfig provides settings for access and installation portal

type PackageServiceConfig

type PackageServiceConfig struct {
	// ListenAddr provides HTTP API for package service
	ListenAddr teleutils.NetAddr `yaml:"listen_addr"`
	// PublicListenAddr is the listen address for a server that serves
	// user traffic such as UI, will be used only if user and cluster
	// traffic are separated in Ops Center mode
	PublicListenAddr teleutils.NetAddr `yaml:"public_listen_addr"`

	// AdvertiseAddr is the address advertised to clients
	AdvertiseAddr teleutils.NetAddr `yaml:"advertise_addr" env:"ADVERTISE_ADDR"`
	// PublicAdvertiseAddr is the advertise address for user traffic such
	// as UI
	PublicAdvertiseAddr teleutils.NetAddr `yaml:"public_advertise_addr"`

	// ReadDir is an optional directory with extra packages
	ReadDir string `yaml:"read_dir"`
}

PackageServiceConfig provides settings for package service

func (*PackageServiceConfig) GetAddr

func (p *PackageServiceConfig) GetAddr() teleutils.NetAddr

func (*PackageServiceConfig) GetPublicAddr

func (p *PackageServiceConfig) GetPublicAddr() teleutils.NetAddr

func (*PackageServiceConfig) PeerAddr

func (p *PackageServiceConfig) PeerAddr() (*teleutils.NetAddr, error)

PeerAddr returns peer address of the package service instance

type ProfileConfig

type ProfileConfig struct {
	// HTTPEndpoint is HTTP profile endpoint
	HTTPEndpoint string `yaml:"http_endpoint"`
	// OutputDir is where profiler will put samples
	OutputDir string `yaml:"output_dir"`
}

ProfileConfig is a profile configuration

type User

type User struct {
	Owner      bool       `yaml:"owner" json:"owner"`
	Password   string     `yaml:"password" json:"password"`
	Type       string     `yaml:"type" json:"type"`
	Org        string     `yaml:"org" json:"org"`
	Identities []Identity `yaml:"identities" json:"identities"`
	Email      string     `yaml:"email" json:"email"`
	Roles      []string   `yaml:"roles" json:"roles"`
	Tokens     []string   `yaml:"tokens" json:"tokens"`
}

User provides

func (*User) ParsedIdentities

func (u *User) ParsedIdentities() ([]teleservices.ExternalIdentity, error)

type Users

type Users []User

func (*Users) UnmarshalYAML

func (u *Users) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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