runtime

package
v0.5.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package runtime defines interfaces for accessing runtime specific settings, and state.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLocked indicates that the sequencer is currently locked, and processing
	// another sequence.
	ErrLocked = errors.New("locked")

	// ErrReboot indicates that a task is requesting a reboot.
	ErrReboot = errors.New("reboot")

	// ErrInvalidSequenceData indicates that the sequencer got data the wrong
	// data type for a sequence.
	ErrInvalidSequenceData = errors.New("invalid sequence data")

	// ErrUndefinedRuntime indicates that the sequencer's runtime is not defined.
	ErrUndefinedRuntime = errors.New("undefined runtime")
)

Functions

This section is empty.

Types

type APIServer

type APIServer interface {
	ExtraArgs() map[string]string
}

APIServer defines the requirements for a config that pertains to apiserver related options.

type AdminKubeconfig

type AdminKubeconfig interface {
	CertLifetime() time.Duration
}

AdminKubeconfig defines settings for admin kubeconfig.

type Bond

type Bond struct {
	Interfaces      []string `yaml:"interfaces"`
	ARPIPTarget     []string `yaml:"arpIPTarget"`
	Mode            string   `yaml:"mode"`
	HashPolicy      string   `yaml:"xmitHashPolicy"`
	LACPRate        string   `yaml:"lacpRate"`
	ADActorSystem   string   `yaml:"adActorSystem"`
	ARPValidate     string   `yaml:"arpValidate"`
	ARPAllTargets   string   `yaml:"arpAllTargets"`
	Primary         string   `yaml:"primary"`
	PrimaryReselect string   `yaml:"primaryReselect"`
	FailOverMac     string   `yaml:"failOverMac"`
	ADSelect        string   `yaml:"adSelect"`
	MIIMon          uint32   `yaml:"miimon"`
	UpDelay         uint32   `yaml:"updelay"`
	DownDelay       uint32   `yaml:"downdelay"`
	ARPInterval     uint32   `yaml:"arpInterval"`
	ResendIGMP      uint32   `yaml:"resendIgmp"`
	MinLinks        uint32   `yaml:"minLinks"`
	LPInterval      uint32   `yaml:"lpInterval"`
	PacketsPerSlave uint32   `yaml:"packetsPerSlave"`
	NumPeerNotif    uint8    `yaml:"numPeerNotif"`
	TLBDynamicLB    uint8    `yaml:"tlbDynamicLb"`
	AllSlavesActive uint8    `yaml:"allSlavesActive"`
	UseCarrier      bool     `yaml:"useCarrier"`
	ADActorSysPrio  uint16   `yaml:"adActorSysPrio"`
	ADUserPortKey   uint16   `yaml:"adUserPortKey"`
	PeerNotifyDelay uint32   `yaml:"peerNotifyDelay"`
}

Bond contains the various options for configuring a bonded interface.

type CNI

type CNI interface {
	Name() string
	URLs() []string
}

CNI defines the requirements for a config that pertains to Kubernetes cni.

type ClusterConfig

type ClusterConfig interface {
	Name() string
	APIServer() APIServer
	ControllerManager() ControllerManager
	Proxy() Proxy
	Scheduler() Scheduler
	Endpoint() *url.URL
	Token() Token
	CertSANs() []string
	SetCertSANs([]string)
	CA() *x509.PEMEncodedCertificateAndKey
	AESCBCEncryptionSecret() string
	Config(MachineType) (string, error)
	Etcd() Etcd
	Network() ClusterNetwork
	LocalAPIServerPort() int
	PodCheckpointer() PodCheckpointer
	CoreDNS() CoreDNS
	ExtraManifestURLs() []string
	ExtraManifestHeaderMap() map[string]string
	AdminKubeconfig() AdminKubeconfig
}

ClusterConfig defines the requirements for a config that pertains to cluster related options.

type ClusterNetwork

type ClusterNetwork interface {
	CNI() CNI
	PodCIDR() string
	ServiceCIDR() string
	DNSDomain() string
}

ClusterNetwork defines the requirements for a config that pertains to cluster network options.

type ClusterState

type ClusterState interface{}

ClusterState defines the cluster state.

type Configurator

type Configurator interface {
	Version() string
	Debug() bool
	Persist() bool
	Machine() MachineConfig
	Cluster() ClusterConfig
	Validate(Mode) error
	String() (string, error)
	Bytes() ([]byte, error)
}

Configurator defines the configuration interface.

type ConfiguratorBundle

type ConfiguratorBundle interface {
	Init() Configurator
	ControlPlane() Configurator
	Join() Configurator
	TalosConfig() *config.Config
}

ConfiguratorBundle defines the configuration bundle interface.

type Controller

type Controller interface {
	Runtime() Runtime
	Sequencer() Sequencer
	Run(Sequence, interface{}) error
}

Controller represents the controller responsible for managing the execution of sequences.

type ControllerManager

type ControllerManager interface {
	ExtraArgs() map[string]string
}

ControllerManager defines the requirements for a config that pertains to controller manager related options.

type CoreDNS

type CoreDNS interface {
	Image() string
}

CoreDNS defines the requirements for a config that pertains to bootkube coredns options.

type Device

type Device struct {
	Interface string  `yaml:"interface"`
	CIDR      string  `yaml:"cidr"`
	Routes    []Route `yaml:"routes"`
	Bond      *Bond   `yaml:"bond"`
	Vlans     []*Vlan `yaml:"vlans"`
	MTU       int     `yaml:"mtu"`
	DHCP      bool    `yaml:"dhcp"`
	Ignore    bool    `yaml:"ignore"`
}

Device represents a network interface.

type Disk

type Disk struct {
	Device     string      `yaml:"device,omitempty"`
	Partitions []Partition `yaml:"partitions,omitempty"`
}

Disk represents the options available for partitioning, formatting, and mounting extra disks.

type Env

type Env = map[string]string

Env represents a set of environment variables.

type Etcd

type Etcd interface {
	Image() string
	CA() *x509.PEMEncodedCertificateAndKey
	ExtraArgs() map[string]string
}

Etcd defines the requirements for a config that pertains to etcd related options.

type EventFatalSequencerError

type EventFatalSequencerError struct {
	Error    error
	Sequence Sequence
}

EventFatalSequencerError represents a fatal sequencer error.

type EventSequenceStart

type EventSequenceStart struct {
	Sequence Sequence
}

EventSequenceStart represents the sequence start event.

type EventStream

type EventStream interface {
	Watcher
	Publisher
}

EventStream defines the runtime event stream.

type ExtraHost

type ExtraHost struct {
	IP      string   `yaml:"ip"`
	Aliases []string `yaml:"aliases"`
}

ExtraHost represents a host entry in /etc/hosts

type File

type File struct {
	Content     string      `yaml:"content"`
	Permissions os.FileMode `yaml:"permissions"`
	Path        string      `yaml:"path"`
	Op          string      `yaml:"op"`
}

File represents a file to write to disk.

type Install

type Install interface {
	Image() string
	Disk() string
	ExtraKernelArgs() []string
	Zero() bool
	Force() bool
	WithBootloader() bool
}

Install defines the requirements for a config that pertains to install related options.

type Kubelet

type Kubelet interface {
	Image() string
	ExtraArgs() map[string]string
	ExtraMounts() []specs.Mount
}

Kubelet defines the requirements for a config that pertains to kubelet related options.

type Machine

type Machine interface {
	State() MachineState
	Config() MachineConfig
}

Machine defines the runtime parameters.

type MachineConfig

type MachineConfig interface {
	Install() Install
	Security() Security
	Network() MachineNetwork
	Disks() []Disk
	Time() Time
	Env() Env
	Files() ([]File, error)
	Type() MachineType
	Kubelet() Kubelet
	Sysctls() map[string]string
	Registries() Registries
}

MachineConfig defines the requirements for a config that pertains to machine related options.

type MachineNetwork

type MachineNetwork interface {
	Hostname() string
	SetHostname(string)
	Resolvers() []string
	Devices() []Device
	ExtraHosts() []ExtraHost
}

MachineNetwork defines the requirements for a config that pertains to network related options.

type MachineState

type MachineState interface {
	Disk() *probe.ProbedBlockDevice
	Close() error
	Installed() bool
}

MachineState defines the machined state.

type MachineType

type MachineType int

MachineType represents a machine type.

const (
	// MachineTypeInit represents a bootstrap node.
	MachineTypeInit MachineType = iota
	// MachineTypeControlPlane represents a control plane node.
	MachineTypeControlPlane
	// MachineTypeJoin represents a worker node.
	MachineTypeJoin
)

func ParseMachineType

func ParseMachineType(t string) (MachineType, error)

ParseMachineType parses string constant as Type

func (MachineType) String

func (t MachineType) String() string

String returns the string representation of Type.

type Mode

type Mode int

Mode is a runtime mode.

const (
	// ModeCloud is the cloud runtime mode.
	ModeCloud Mode = iota
	// ModeContainer is the container runtime mode.
	ModeContainer
	// ModeMetal is the metal runtime mode.
	ModeMetal
)

func ParseMode

func ParseMode(s string) (mod Mode, err error)

ParseMode returns a `Mode` that matches the specified string.

func (Mode) String

func (m Mode) String() string

String returns the string representation of a Mode.

type Partition

type Partition struct {
	Size       uint   `yaml:"size,omitempty"`
	MountPoint string `yaml:"mountpoint,omitempty"`
}

Partition represents the options for a device partition.

type Phase

type Phase []TaskSetupFunc

Phase represents a collection of tasks to be performed concurrently.

type Platform

type Platform interface {
	Name() string
	Configuration() ([]byte, error)
	Hostname() ([]byte, error)
	Mode() Mode
	ExternalIPs() ([]net.IP, error)
	KernelArgs() procfs.Parameters
}

Platform defines the requirements for a platform.

type PodCheckpointer

type PodCheckpointer interface {
	Image() string
}

PodCheckpointer defines the requirements for a config that pertains to bootkube pod-checkpointer options.

type Proxy

type Proxy interface {

	// Mode indicates the proxy mode for kube-proxy.  By default, this is `iptables`.  Other options include `ipvs`.
	Mode() string

	// ExtraArgs describe an additional set of arguments to be supplied to the execution of `kube-proxy`
	ExtraArgs() map[string]string
}

Proxy defines the requirements for a config that pertains to the kube-proxy options.

type Publisher

type Publisher interface {
	Publish(proto.Message)
}

Publisher defines a runtime event publisher.

type Registries

type Registries interface {
	// Mirror config by registry host (first part of image reference).
	Mirrors() map[string]RegistryMirrorConfig
	// Registry config (auth, TLS) by hostname.
	Config() map[string]RegistryConfig
	// ExtraFiles generates TOML config for containerd CRI plugin.
	ExtraFiles() ([]File, error)
}

Registries defines the configuration for image fetching.

type RegistryAuthConfig

type RegistryAuthConfig struct {
	//   description: |
	//     Optional registry authentication.
	//     The meaning of each field is the same with the corresponding field in .docker/config.json.
	Username string `yaml:"username"`
	//   description: |
	//     Optional registry authentication.
	//     The meaning of each field is the same with the corresponding field in .docker/config.json.
	Password string `yaml:"password"`
	//   description: |
	//     Optional registry authentication.
	//     The meaning of each field is the same with the corresponding field in .docker/config.json.
	Auth string `yaml:"auth"`
	//   description: |
	//     Optional registry authentication.
	//     The meaning of each field is the same with the corresponding field in .docker/config.json.
	IdentityToken string `yaml:"identityToken"`
}

RegistryAuthConfig specifies authentication configuration for a registry.

type RegistryConfig

type RegistryConfig struct {
	TLS  *RegistryTLSConfig  `yaml:"tls,omitempty"`
	Auth *RegistryAuthConfig `yaml:"auth,omitempty"`
}

RegistryConfig specifies auth & TLS config per registry.

type RegistryMirrorConfig

type RegistryMirrorConfig struct {
	//   description: |
	//     List of endpoints (URLs) for registry mirrors to use.
	//     Endpoint configures HTTP/HTTPS access mode, host name,
	//     port and path (if path is not set, it defaults to `/v2`).
	Endpoints []string `yaml:"endpoints"`
}

RegistryMirrorConfig represents mirror configuration for a registry.

type RegistryTLSConfig

type RegistryTLSConfig struct {
	//   description: |
	//     Enable mutual TLS authentication with the registry.
	//     Client certificate and key should be base64-encoded.
	//   examples:
	//     - |
	//       clientIdentity:
	//         crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJIekNCMHF...
	//         key: LS0tLS1CRUdJTiBFRDI1NTE5IFBSSVZBVEUgS0VZLS0tLS0KTUM...
	ClientIdentity *x509.PEMEncodedCertificateAndKey `yaml:"clientIdentity,omitempty"`
	//   description: |
	//     CA registry certificate to add the list of trusted certificates.
	//     Certificate should be base64-encoded.
	CA []byte `yaml:"ca,omitempty"`
	//   description: |
	//     Skip TLS server certificate verification (not recommended).
	InsecureSkipVerify bool `yaml:"insecureSkipVerify,omitempty"`
}

RegistryTLSConfig specifies TLS config for HTTPS registries.

func (*RegistryTLSConfig) GetTLSConfig

func (cfg *RegistryTLSConfig) GetTLSConfig() (*tls.Config, error)

GetTLSConfig prepares TLS configuration for connection.

type Route

type Route struct {
	Network string `yaml:"network"`
	Gateway string `yaml:"gateway"`
}

Route represents a network route.

type Runtime

type Runtime interface {
	Config() Configurator
	SetConfig([]byte) error
	State() State
	Events() EventStream
}

Runtime defines the runtime parameters.

type Scheduler

type Scheduler interface {
	ExtraArgs() map[string]string
}

Scheduler defines the requirements for a config that pertains to scheduler related options.

type Security

type Security interface {
	CA() *x509.PEMEncodedCertificateAndKey
	Token() string
	CertSANs() []string
	SetCertSANs([]string)
}

Security defines the requirements for a config that pertains to security related options.

type Sequence

type Sequence int

Sequence represents a sequence type.

const (
	// SequenceBoot is the boot sequence.
	SequenceBoot Sequence = iota
	// SequenceBootstrap is the boot sequence.
	SequenceBootstrap
	// SequenceInitialize is the initialize sequence.
	SequenceInitialize
	// SequenceInstall is the install sequence.
	SequenceInstall
	// SequenceShutdown is the shutdown sequence.
	SequenceShutdown
	// SequenceUpgrade is the upgrade sequence.
	SequenceUpgrade
	// SequenceReset is the reset sequence.
	SequenceReset
	// SequenceReboot is the reboot sequence.
	SequenceReboot
	// SequenceRecover is the recover sequence.
	SequenceRecover
	// SequenceNoop is the noop sequence.
	SequenceNoop
)

func ParseSequence

func ParseSequence(s string) (seq Sequence, err error)

ParseSequence returns a `Sequence` that matches the specified string.

nolint: gocyclo

func (Sequence) String

func (s Sequence) String() string

String returns the string representation of a `Sequence`.

type Sequencer

type Sequencer interface {
	Boot(Runtime) []Phase
	Bootstrap(Runtime) []Phase
	Initialize(Runtime) []Phase
	Install(Runtime) []Phase
	Reboot(Runtime) []Phase
	Recover(Runtime, *machine.RecoverRequest) []Phase
	Reset(Runtime, *machine.ResetRequest) []Phase
	Shutdown(Runtime) []Phase
	Upgrade(Runtime, *machine.UpgradeRequest) []Phase
}

Sequencer describes the set of sequences required for the lifecycle management of the operating system.

type State

type State interface {
	Platform() Platform
	Machine() MachineState
	Cluster() ClusterState
}

State defines the state.

type TaskExecutionFunc

type TaskExecutionFunc func(context.Context, *log.Logger, Runtime) error

TaskExecutionFunc defines the function that a task will execute for a specific runtime mode.

type TaskSetupFunc

type TaskSetupFunc func(seq Sequence, data interface{}) TaskExecutionFunc

TaskSetupFunc defines the function that a task will execute for a specific runtime mode.

type Time

type Time interface {
	Servers() []string
}

Time defines the requirements for a config that pertains to time related options.

type Token

type Token interface {
	ID() string
	Secret() string
}

Token defines the requirements for a config that pertains to Kubernetes bootstrap token.

type Vlan

type Vlan struct {
	CIDR   string  `ỳaml:"cidr"`
	Routes []Route `yaml:"routes"`
	DHCP   bool    `yaml:"dhcp"`
	ID     uint16  `yaml:"vlanId"`
}

Vlan represents vlan settings for a device

type WatchFunc

type WatchFunc func(<-chan machine.Event)

WatchFunc defines the watcher callback function.

type Watcher

type Watcher interface {
	Watch(WatchFunc)
}

Watcher defines a runtime event watcher.

Directories

Path Synopsis
Package v1alpha1 implements a `Runtime`.
Package v1alpha1 implements a `Runtime`.

Jump to

Keyboard shortcuts

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