config

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() string

Types

type Config

type Config struct {
	// LogLevel defines the engine's logging level.
	LogLevel LogLevel `json:"logLevel,omitempty" jsonschema:"enum=error,enum=warn,enum=info,enum=debug,enum=debugextra,enum=trace"`

	// GC configures the engine's garbage collector.
	GC GCConfig `json:"gc,omitempty"`

	// Security allows configuring various security settings for the engine.
	Security *Security `json:"security,omitempty"`
}

func Load

func Load(r io.Reader) (Config, error)

func LoadDefault

func LoadDefault() (Config, error)

func LoadFile

func LoadFile(fp string) (Config, error)

func (*Config) Save

func (cfg *Config) Save(w io.Writer) error

type DiskSpace

type DiskSpace bkconfig.DiskSpace

func (DiskSpace) AsBytes

func (space DiskSpace) AsBytes(dstat disk.DiskStat) int64

func (DiskSpace) JSONSchema

func (space DiskSpace) JSONSchema() *jsonschema.Schema

func (DiskSpace) MarshalJSON

func (space DiskSpace) MarshalJSON() ([]byte, error)

func (*DiskSpace) UnmarshalJSON

func (space *DiskSpace) UnmarshalJSON(data []byte) error

type Duration

type Duration bkconfig.Duration

func (Duration) JSONSchema

func (duration Duration) JSONSchema() *jsonschema.Schema

func (Duration) MarshalJSON

func (duration Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (duration *Duration) UnmarshalJSON(data []byte) error

type GCConfig

type GCConfig struct {
	// Enabled controls whether the garbage collector is enabled - it is
	// switched on by default (and generally shouldn't be turned off, except
	// for very short-lived dagger instances).
	Enabled *bool `json:"enabled,omitempty"`

	// GCSpace is the amount of space to allow for the entire dagger engine,
	// only used in computing the default Policies.
	GCSpace

	// Policies are a list of manually configured policies - if not specified,
	// an automatic default will be generated from the top-level disk space
	// parameters.
	Policies []GCPolicy `json:"policies,omitempty"`
}

type GCPolicy

type GCPolicy struct {
	// All matches every cache record.
	All bool `json:"all,omitempty"`

	// Filters are a list of containerd filters to match specific cache
	// records. The available filters are: "id", "parents", "description",
	// "inuse", "mutable", "immutable", "type", "shared", and "private".
	Filters []string `json:"filters,omitempty"`

	// KeepDuration specifies the minimum amount of time to keep records in
	// this policy.
	KeepDuration Duration `json:"keepDuration,omitempty"`

	// GCSpace is the amount of space to allow for this policy.
	GCSpace
}

type GCSpace

type GCSpace struct {
	// ReservedSpace is the minimum amount of disk space this policy is guaranteed to retain.
	// Any usage below this threshold will not be reclaimed during garbage collection.
	ReservedSpace DiskSpace `json:"reservedSpace,omitempty"`

	// MaxUsedSpace is the maximum amount of disk space this policy is allowed to use.
	// Any usage exceeding this limit will be cleaned up during a garbage collection sweep.
	MaxUsedSpace DiskSpace `json:"maxUsedSpace,omitempty"`

	// MinFreeSpace is the target amount of free disk space the garbage collector will attempt to leave.
	// However, it will never let the available space fall below ReservedSpace.
	MinFreeSpace DiskSpace `json:"minFreeSpace,omitempty"`
}

func (*GCSpace) IsUnset

func (space *GCSpace) IsUnset() bool

type LogLevel

type LogLevel string
const (
	LevelError      LogLevel = "error"
	LevelWarn       LogLevel = "warn"
	LevelInfo       LogLevel = "info"
	LevelDebug      LogLevel = "debug"
	LevelExtraDebug LogLevel = "debugextra"
	LevelTrace      LogLevel = "trace"
)

func (LogLevel) ToLogrusLevel

func (ll LogLevel) ToLogrusLevel() (logrus.Level, error)

func (LogLevel) ToSlogLevel

func (ll LogLevel) ToSlogLevel() (slog.Level, error)

type Security

type Security struct {
	// InsecureRootCapabilities controls whether the argument of the same name
	// is permitted in Container.withExec - it is allowed by default.
	// Disabling this option ensures that dagger build containers do not run as
	// privileged, and is a basic form of security hardening.
	InsecureRootCapabilities *bool `json:"insecureRootCapabilities,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳