services

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MPL-2.0 Imports: 6 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

This section is empty.

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"`
	// 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"`
}

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"`
}

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