config

package
v0.0.1-test1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultAPIVersion = "v1"
	DefaultGPUdPort   = 15132
)

Variables

View Source
var (
	DefaultRefreshPeriod   = metav1.Duration{Duration: time.Minute}
	DefaultRetentionPeriod = metav1.Duration{Duration: 30 * time.Minute}
)

Functions

func DefaultConfigFile

func DefaultConfigFile() (string, error)

func DefaultFifoFile

func DefaultFifoFile() (string, error)

func DefaultStateFile

func DefaultStateFile() (string, error)

Types

type Config

type Config struct {
	APIVersion string `json:"api_version"`

	// Basic server annotations (e.g., machine id, host name, etc.).
	Annotations map[string]string `json:"annotations,omitempty"`

	// Address for the server to listen on.
	Address string `json:"address"`

	// Component specific configurations.
	Components map[string]any `json:"components,omitempty"`

	// State file that persists the latest status.
	// If empty, the states are not persisted to file.
	State string `json:"state"`

	// Amount of time to retain states/metrics for.
	// Once elapsed, old states/metrics are purged/compacted.
	RetentionPeriod metav1.Duration `json:"retention_period"`

	// Set true to enable profiler.
	Pprof bool `json:"pprof"`

	// Configures the local web configuration.
	Web *Web `json:"web,omitempty"`
}

Config provides gpud configuration data for the server

func DefaultConfig

func DefaultConfig(ctx context.Context) (*Config, error)

func LoadConfigYAML

func LoadConfigYAML(file string) (*Config, error)

func ParseConfigYAML

func ParseConfigYAML(data []byte) (*Config, error)

func (*Config) SyncYAML

func (config *Config) SyncYAML(file string) error

func (*Config) Validate

func (config *Config) Validate() error

func (*Config) YAML

func (config *Config) YAML() ([]byte, error)

type Web

type Web struct {
	// Enable the web interface.
	Enable bool `json:"enable"`

	// Enable the admin interface.
	Admin bool `json:"admin"`

	// RefreshPeriod is the time period to refresh metrics.
	RefreshPeriod metav1.Duration `json:"refresh_period"`

	// SincePeriod is the time period to start displaying metrics from.
	SincePeriod metav1.Duration `json:"since_period"`
}

Configures the local web configuration.

Jump to

Keyboard shortcuts

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