config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergedConfigsReader

func MergedConfigsReader(ctx context.Context, path string) (io.Reader, error)

Types

type BridgeModeNetwork

type BridgeModeNetwork struct {
	Name              string        `yaml:"name,omitempty" json:"name,omitempty"`
	HostInterfaceName string        `yaml:"hostInterfaceName,omitempty" json:"hostInterfaceName,omitempty"`
	CIDR              string        `yaml:"cidr,omitempty" json:"cidr,omitempty"`
	Priority          int           `yaml:"priority,omitempty" json:"priority,omitempty"`
	Containers        []ContainerIP `yaml:"containers,omitempty" json:"containers,omitempty"`
}

BridgeModeNetwork represents a docker bridge mode network that one or more containers attach to.

type ConfigEnv

type ConfigEnv struct {
	Var          string   `yaml:"var,omitempty" json:"var,omitempty"`
	Value        string   `yaml:"value,omitempty" json:"value,omitempty"`
	ValueCommand []string `yaml:"valueCommand,omitempty" json:"valueCommand,omitempty"`
}

ConfigEnv is a pair of environment variable name and value that will be substituted in all string field values read from the homelab configuration file.

type Container

type Container struct {
	Info       ContainerReference     `yaml:"info,omitempty" json:"info,omitempty"`
	Config     ContainerConfigOptions `yaml:"config,omitempty" json:"config,omitempty"`
	Image      ContainerImage         `yaml:"image,omitempty" json:"image,omitempty"`
	Metadata   ContainerMetadata      `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	Lifecycle  ContainerLifecycle     `yaml:"lifecycle,omitempty" json:"lifecycle,omitempty"`
	User       ContainerUser          `yaml:"user,omitempty" json:"user,omitempty"`
	Filesystem ContainerFilesystem    `yaml:"fs,omitempty" json:"fs,omitempty"`
	Network    ContainerNetwork       `yaml:"network,omitempty" json:"network,omitempty"`
	Security   ContainerSecurity      `yaml:"security,omitempty" json:"security,omitempty"`
	Health     ContainerHealth        `yaml:"health,omitempty" json:"health,omitempty"`
	Runtime    ContainerRuntime       `yaml:"runtime,omitempty" json:"runtime,omitempty"`
}

Container represents a single docker container.

func (*Container) ApplyCmdExecutor added in v0.1.1

func (c *Container) ApplyCmdExecutor(exec cmdexec.Executor) error

func (*Container) ApplyConfigEnv

func (c *Container) ApplyConfigEnv(env *env.ConfigEnvManager)

type ContainerConfigOptions

type ContainerConfigOptions struct {
	Env []ConfigEnv `yaml:"env,omitempty" json:"env,omitempty"`
}

ContainerConfigOptions represents options that are applied while evaluating the config for this docker container.

type ContainerDevice added in v0.1.1

type ContainerDevice struct {
	Static         []Device `yaml:"static,omitempty" json:"static,omitempty"`
	DynamicCommand []string `yaml:"dynamic,omitempty" json:"dynamic,omitempty"`
	Dynamic        []Device `yaml:"-" json:"-"`
}

ContainerDevice represents the set of devices exposed to a container.

type ContainerEnv

type ContainerEnv struct {
	Var   string `yaml:"var,omitempty" json:"var,omitempty"`
	Value string `yaml:"value,omitempty" json:"value,omitempty"`
}

ContainerEnv represents an environment variable and value pair that will be set on the specified container.

type ContainerFilesystem

type ContainerFilesystem struct {
	ReadOnlyRootfs bool            `yaml:"readOnlyRootfs,omitempty" json:"readOnlyRootfs,omitempty"`
	Mounts         []Mount         `yaml:"mounts,omitempty" json:"mounts,omitempty"`
	Devices        ContainerDevice `yaml:"devices,omitempty" json:"devices,omitempty"`
}

ContainerFilesystem represents the fileystem information for the docker container.

type ContainerGroup

type ContainerGroup struct {
	Name  string `yaml:"name,omitempty" json:"name,omitempty"`
	Order int    `yaml:"order,omitempty" json:"order,omitempty"`
}

ContainerGroup represents a single logical container group, which is basically a collection of containers within.

type ContainerGroupNameOnly

type ContainerGroupNameOnly struct {
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
}

ContainerGroupNameOnly represents a minimal single logical container group that includes just the name of the group.

type ContainerHealth

type ContainerHealth struct {
	Cmd           []string `yaml:"cmd,omitempty" json:"cmd,omitempty"`
	Retries       int      `yaml:"retries,omitempty" json:"retries,omitempty"`
	Interval      string   `yaml:"interval,omitempty" json:"interval,omitempty"`
	Timeout       string   `yaml:"timeout,omitempty" json:"timeout,omitempty"`
	StartPeriod   string   `yaml:"startPeriod,omitempty" json:"startPeriod,omitempty"`
	StartInterval string   `yaml:"startInterval,omitempty" json:"startInterval,omitempty"`
}

ContainerHealth represents the health check options for the docker container.

type ContainerIP

type ContainerIP struct {
	IP        string             `yaml:"ip,omitempty" json:"ip,omitempty"`
	Container ContainerReference `yaml:"container,omitempty" json:"container,omitempty"`
}

ContainerIP represents the IP information for a container.

type ContainerImage

type ContainerImage struct {
	Image                   string `yaml:"image,omitempty" json:"image,omitempty"`
	SkipImagePull           bool   `yaml:"skipImagePull,omitempty" json:"skipImage,omitempty"`
	IgnoreImagePullFailures bool   `yaml:"ignoreImagePullFailures,omitempty" json:"ignoreImagePullFailures,omitempty"`
	PullImageBeforeStop     bool   `yaml:"pullImageBeforeStop,omitempty" json:"pullImageBeforeStop,omitempty"`
}

ContainerImage respresents the image configuration for the docker container.

type ContainerLifecycle

type ContainerLifecycle struct {
	Order         int                    `yaml:"order,omitempty" json:"order,omitempty"`
	StartPreHook  []string               `yaml:"startPreHook,omitempty" json:"startPreHook,omitempty"`
	RestartPolicy ContainerRestartPolicy `yaml:"restartPolicy,omitempty" json:"restartPolicy,omitempty"`
	AutoRemove    bool                   `yaml:"autoRemove,omitempty" json:"autoRemove,omitempty"`
	StopSignal    string                 `yaml:"stopSignal,omitempty" json:"stopSignal,omitempty"`
	StopTimeout   int                    `yaml:"stopTimeout,omitempty" json:"stopTimeout,omitempty"`
}

ContainerLifecycle represents the lifecycle information for the docker container.

type ContainerMetadata

type ContainerMetadata struct {
	Labels []Label `yaml:"labels,omitempty" json:"labels,omitempty"`
}

ContainerMetadata represents the metadata for the docker container.

type ContainerModeNetwork

type ContainerModeNetwork struct {
	Name                string               `yaml:"name,omitempty" json:"name,omitempty"`
	Container           ContainerReference   `yaml:"container,omitempty" json:"container,omitempty"`
	AttachingContainers []ContainerReference `yaml:"attachingContainers,omitempty" json:"attachingContainers,omitempty"`
}

ContainerModeNetwork represents a container network meant to attach a container to another container's network stack.

type ContainerNameOnly

type ContainerNameOnly struct {
	Info ContainerReference `yaml:"info,omitempty" json:"info,omitempty"`
}

ContainerNameOnly represents a single docker container with just the group and the container name.

type ContainerNetwork

type ContainerNetwork struct {
	HostName       string          `yaml:"hostName,omitempty" json:"hostName,omitempty"`
	DomainName     string          `yaml:"domainName,omitempty" json:"domainName,omitempty"`
	DNSServers     []string        `yaml:"dnsServers,omitempty" json:"dnsServers,omitempty"`
	DNSOptions     []string        `yaml:"dnsOptions,omitempty" json:"dnsOptions,omitempty"`
	DNSSearch      []string        `yaml:"dnsSearch,omitempty" json:"dnsSearch,omitempty"`
	ExtraHosts     []string        `yaml:"extraHosts,omitempty" json:"extraHosts,omitempty"`
	PublishedPorts []PublishedPort `yaml:"publishedPorts,omitempty" json:"publishedPorts,omitempty"`
}

ContainerNetwork represents the networking information for the docker container.

type ContainerReference

type ContainerReference struct {
	Group     string `yaml:"group,omitempty" json:"group,omitempty"`
	Container string `yaml:"container,omitempty" json:"container,omitempty"`
}

ContainerReference identifies a specific container part of a group.

type ContainerRestartPolicy

type ContainerRestartPolicy struct {
	Mode          string `yaml:"mode,omitempty" json:"mode,omitempty"`
	MaxRetryCount int    `yaml:"maxRetryCount,omitempty" json:"maxRetryCount,omitempty"`
}

ContainerRestartPolicy represents the restart policy for the container.

type ContainerRuntime

type ContainerRuntime struct {
	AttachToTty bool           `yaml:"tty,omitempty" json:"tty,omitempty"`
	ShmSize     string         `yaml:"shmSize,omitempty" json:"shmSize,omitempty"`
	Env         []ContainerEnv `yaml:"env,omitempty" json:"env,omitempty"`
	Entrypoint  []string       `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
	Args        []string       `yaml:"args,omitempty" json:"args,omitempty"`
}

ContainerRuntime represents the execution and runtime information for the docker container.

type ContainerSecurity

type ContainerSecurity struct {
	Privileged bool     `yaml:"privileged,omitempty" json:"privileged,omitempty"`
	Sysctls    []Sysctl `yaml:"sysctls,omitempty" json:"sysctls,omitempty"`
	CapAdd     []string `yaml:"capAdd,omitempty" json:"capAdd,omitempty"`
	CapDrop    []string `yaml:"capDrop,omitempty" json:"capDrop,omitempty"`
}

ContainerSecurity represents the security information for the docker container.

type ContainerUser

type ContainerUser struct {
	User             string   `yaml:"user,omitempty" json:"user,omitempty"`
	PrimaryGroup     string   `yaml:"primaryGroup,omitempty" json:"primaryGroup,omitempty"`
	AdditionalGroups []string `yaml:"additionalGroups,omitempty" json:"additionalGroups,omitempty"`
}

ContainerUser represents the user and group information for the docker container.

type Device

type Device struct {
	Src           string `yaml:"src,omitempty" json:"src,omitempty"`
	Dst           string `yaml:"dst,omitempty" json:"dst,omitempty"`
	DisallowRead  bool   `yaml:"disallowRead,omitempty" json:"disallowRead,omitempty"`
	DisallowWrite bool   `yaml:"disallowWrite,omitempty" json:"disallowWrite,omitempty"`
	DisallowMknod bool   `yaml:"disallowMknod,omitempty" json:"disallowMknod,omitempty"`
}

Device represents a device node that will be exposed to a container.

type Global

type Global struct {
	BaseDir   string          `yaml:"baseDir,omitempty" json:"baseDir,omitempty"`
	Env       []ConfigEnv     `yaml:"env,omitempty" json:"env,omitempty"`
	MountDefs []Mount         `yaml:"mountDefs,omitempty" json:"mountDefs,omitempty"`
	Container GlobalContainer `yaml:"container,omitempty" json:"container,omitempty"`
}

Global represents the configuration that will be applied across the entire homelab deployment.

func (*Global) ApplyConfigEnv

func (g *Global) ApplyConfigEnv(env *env.ConfigEnvManager)

type GlobalContainer

type GlobalContainer struct {
	StopSignal    string                 `yaml:"stopSignal,omitempty" json:"stopSignal,omitempty"`
	StopTimeout   int                    `yaml:"stopTimeout,omitempty" json:"stopTimeout,omitempty"`
	RestartPolicy ContainerRestartPolicy `yaml:"restartPolicy,omitempty" json:"restartPolicy,omitempty"`
	DomainName    string                 `yaml:"domainName,omitempty" json:"domainName,omitempty"`
	DNSSearch     []string               `yaml:"dnsSearch,omitempty" json:"dnsSearch,omitempty"`
	Env           []ContainerEnv         `yaml:"env,omitempty" json:"env,omitempty"`
	Mounts        []Mount                `yaml:"mounts,omitempty" json:"mounts,omitempty"`
	Labels        []Label                `yaml:"labels,omitempty" json:"labels,omitempty"`
}

GlobalContainer represents container related configuration that will be applied globally across all containers.

type Homelab

type Homelab struct {
	Global     Global           `yaml:"global,omitempty" json:"global,omitempty"`
	IPAM       IPAM             `yaml:"ipam,omitempty" json:"ipam,omitempty"`
	Hosts      []Host           `yaml:"hosts,omitempty" json:"hosts,omitempty"`
	Groups     []ContainerGroup `yaml:"groups,omitempty" json:"groups,omitempty"`
	Containers []Container      `yaml:"containers,omitempty" json:"containers,omitempty"`
	Ignore     []IgnoredConfig  `yaml:"ignore,omitempty" json:"ignore,omitempty"`
}

Homelab represents the entire homelab deployment configuration.

func (*Homelab) Parse

func (h *Homelab) Parse(ctx context.Context, r io.Reader) error

type HomelabContainersOnly

type HomelabContainersOnly struct {
	Containers []ContainerNameOnly `yaml:"containers,omitempty" json:"containers,omitempty"`
}

HomelabGroupsOnly represents a minimal container name information only version of the homelab deployment configuration.

func (*HomelabContainersOnly) ListContainers

func (h *HomelabContainersOnly) ListContainers() []string

func (*HomelabContainersOnly) Parse

type HomelabGroupsOnly

type HomelabGroupsOnly struct {
	Groups []ContainerGroupNameOnly `yaml:"groups,omitempty" json:"groups,omitempty"`
}

HomelabGroupsOnly represents a minimal group name information only version of the homelab deployment configuration.

func (*HomelabGroupsOnly) ListGroups

func (h *HomelabGroupsOnly) ListGroups() []string

func (*HomelabGroupsOnly) Parse

func (h *HomelabGroupsOnly) Parse(ctx context.Context, r io.Reader) error

type Host

type Host struct {
	Name              string               `yaml:"name,omitempty" json:"name,omitempty"`
	AllowedContainers []ContainerReference `yaml:"allowedContainers,omitempty" json:"allowedContainers,omitempty"`
}

Host represents the host specific information.

type IPAM

type IPAM struct {
	Networks Networks `yaml:"networks,omitempty" json:"networks,omitempty"`
}

IPAM represents the IP Addressing and management information for all containers in the homelab configuration.

type IgnoredConfig

type IgnoredConfig interface{}

IgnoredConfig represents arbitrary information that can be thrown into the configuration that will not be directly interpreted by homelab. The common use case for this is to define reusable blocks of configuration using anchors and aliases in yaml.

type Label

type Label struct {
	Name  string `yaml:"name,omitempty" json:"name,omitempty"`
	Value string `yaml:"value,omitempty" json:"value,omitempty"`
}

Label represents a label set on a container.

type Mount

type Mount struct {
	Name      string `yaml:"name,omitempty" json:"name,omitempty"`
	Type      string `yaml:"type,omitempty" json:"type,omitempty"`
	Src       string `yaml:"src,omitempty" json:"src,omitempty"`
	Dst       string `yaml:"dst,omitempty" json:"dst,omitempty"`
	ReadOnly  bool   `yaml:"readOnly,omitempty" json:"readOnly,omitempty"`
	TmpfsSize int64  `yaml:"tmpfsSize,omitempty" json:"tmpfsSize,omitempty"`
}

Mount represents a filesystem mount.

type Networks

type Networks struct {
	BridgeModeNetworks    []BridgeModeNetwork    `yaml:"bridgeModeNetworks,omitempty" json:"bridgeModeNetworks,omitempty"`
	ContainerModeNetworks []ContainerModeNetwork `yaml:"containerModeNetworks,omitempty" json:"containerModeNetworks,omitempty"`
}

Networks represents all networks in the homelab configuration.

type PublishedPort

type PublishedPort struct {
	ContainerPort string `yaml:"containerPort,omitempty" json:"containerPort,omitempty"`
	Protocol      string `yaml:"proto,omitempty" json:"proto,omitempty"`
	HostIP        string `yaml:"hostIp,omitempty" json:"hostIp,omitempty"`
	HostPort      string `yaml:"hostPort,omitempty" json:"hostPort,omitempty"`
}

PublishedPort represents a port published from a container.

type Sysctl

type Sysctl struct {
	Key   string `yaml:"key,omitempty" json:"key,omitempty"`
	Value string `yaml:"value,omitempty" json:"value,omitempty"`
}

Sysctl represents a sysctl config to apply to a container.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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