services

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package services contains definitions for non-system services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RestartKindStrings added in v1.7.0

func RestartKindStrings() []string

RestartKindStrings returns a slice of all String values of the enum

Types

type Container

type Container struct {
	// Entrypoint for the service, relative to the container rootfs.
	Entrypoint string `yaml:"entrypoint"`
	// Environment variables for the service.
	Environment []string `yaml:"environment"`
	// EnvironmentFile to load environment vars before running the service.
	EnvironmentFile string `yaml:"environmentFile"`
	// Args to pass to the entrypoint.
	Args []string `yaml:"args"`
	// Volume mounts.
	Mounts []specs.Mount `yaml:"mounts"`
	// Security options.
	Security Security `yaml:"security"`
}

Container specifies service container to run.

func (*Container) Validate

func (ctr *Container) Validate() error

Validate the container spec.

type Dependency

type Dependency struct {
	// Depends on a service being running and healthy (if health checks are available).
	Service string `yaml:"service,omitempty"`
	// Depends on file/directory existence.
	Path string `yaml:"path,omitempty"`
	// Network readiness checks.
	//
	// Valid options are nethelpers.Status string values.
	Network []nethelpers.Status `yaml:"network,omitempty"`
	// Time sync check.
	Time bool `yaml:"time,omitempty"`
	// Depends on configuration files to be present.
	Configuration bool `yaml:"configuration,omitempty"`
}

Dependency describes a service Dependency.

Only a single dependency out of the list might be specified.

func (*Dependency) Validate

func (dep *Dependency) Validate() error

Validate the dependency spec.

type RestartKind

type RestartKind int

RestartKind specifies how the service should be restarted.

const (
	RestartAlways       RestartKind = 1 // always
	RestartNever        RestartKind = 2 // never
	RestartUntilSuccess RestartKind = 3 // untilSuccess
)

RestartKind constants.

func RestartKindString

func RestartKindString(s string) (RestartKind, error)

RestartKindString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func RestartKindValues

func RestartKindValues() []RestartKind

RestartKindValues returns all values of the enum

func (RestartKind) IsARestartKind

func (i RestartKind) IsARestartKind() bool

IsARestartKind returns "true" if the value is listed in the enum definition. "false" otherwise

func (RestartKind) MarshalText

func (i RestartKind) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for RestartKind

func (RestartKind) String

func (i RestartKind) String() string

func (*RestartKind) UnmarshalText

func (i *RestartKind) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for RestartKind

type Security

type Security struct {
	// WriteableSysfs makes the '/sys' path writeable in the container namespace if set to true.
	WriteableSysfs bool `yaml:"writeableSysfs"`
	// MaskedPaths is a list of paths in the container namespace that should not be readable.
	MaskedPaths []string `yaml:"maskedPaths"`
	// ReadonlyPaths is a list of paths in the container namespace that should be read-only.
	ReadonlyPaths []string `yaml:"readonlyPaths"`
	// WriteableRootfs
	WriteableRootfs bool `yaml:"writeableRootfs"`
	// RootfsPropagation is the propagation mode for the rootfs mount.
	RootfsPropagation string `yaml:"rootfsPropagation,omitempty"`
}

Security options for containers.

type Spec

type Spec struct {
	// Name of the service to run, will be prefixed with `ext-` when registered as Talos service.
	//
	// Valid: [-_a-z0-9]+
	Name string `yaml:"name"`
	// Container to run.
	//
	// Container rootfs should be extracted to the /usr/local/lib/containers/<name>.
	Container Container `yaml:"container"`
	// Service dependencies.
	Depends []Dependency `yaml:"depends"`
	// Restart configuration.
	Restart RestartKind `yaml:"restart"`
}

Spec is represents non-system service definition.

func (*Spec) Validate

func (spec *Spec) Validate() error

Validate the service spec.

Jump to

Keyboard shortcuts

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