v1alpha1

package
v0.11.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MPL-2.0 Imports: 76 Imported by: 0

Documentation

Overview

Package v1alpha1 implements a `Runtime`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateLogicalVolumes added in v0.6.0

func ActivateLogicalVolumes(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

ActivateLogicalVolumes represents the task for activating logical volumes.

func BootstrapEtcd

func BootstrapEtcd(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

BootstrapEtcd represents the task for bootstrapping etcd.

func CheckControlPlaneStatus added in v0.9.0

func CheckControlPlaneStatus(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

CheckControlPlaneStatus represents the CheckControlPlaneStatus task.

func CordonAndDrainNode

func CordonAndDrainNode(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

CordonAndDrainNode represents the task for stop all containerd tasks in the k8s.io namespace.

func CreateOSReleaseFile

func CreateOSReleaseFile(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

CreateOSReleaseFile represents the CreateOSReleaseFile task.

func EnforceKSPPRequirements

func EnforceKSPPRequirements(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

EnforceKSPPRequirements represents the EnforceKSPPRequirements task.

func Install

func Install(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

Install mounts or installs the system partitions.

func LabelNodeAsMaster

func LabelNodeAsMaster(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

LabelNodeAsMaster represents the LabelNodeAsMaster task.

func LeaveEtcd

func LeaveEtcd(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

LeaveEtcd represents the task for removing a control plane node from etcd.

func LoadConfig

func LoadConfig(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

LoadConfig represents the LoadConfig task.

func MountBPFFS

func MountBPFFS(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountBPFFS represents the MountBPFFS task.

func MountBootPartition

func MountBootPartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountBootPartition mounts the boot partition.

func MountCgroups

func MountCgroups(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountCgroups represents the MountCgroups task.

func MountEFIPartition added in v0.7.0

func MountEFIPartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountEFIPartition mounts the EFI partition.

func MountEphemeralPartition added in v0.9.0

func MountEphemeralPartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountEphemeralPartition mounts the ephemeral partition.

func MountOverlayFilesystems

func MountOverlayFilesystems(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountOverlayFilesystems represents the MountOverlayFilesystems task.

func MountPseudoFilesystems

func MountPseudoFilesystems(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountPseudoFilesystems represents the MountPseudoFilesystems task.

func MountStatePartition added in v0.7.0

func MountStatePartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountStatePartition mounts the system partition.

func MountUserDisks

func MountUserDisks(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

MountUserDisks represents the MountUserDisks task.

func OSRelease

func OSRelease() (err error)

OSRelease renders a valid /etc/os-release file and writes it to disk. The node's OS Image field is reported by the node from /etc/os-release.

func Reboot

func Reboot(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

Reboot represents the Reboot task.

func RemoveAllPods

func RemoveAllPods(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

RemoveAllPods represents the task for stopping and removing all pods.

func ResetSystemDisk

func ResetSystemDisk(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

ResetSystemDisk represents the task to reset the system disk.

func ResetSystemDiskSpec added in v0.8.0

func ResetSystemDiskSpec(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

ResetSystemDiskSpec represents the task to reset the system disk by spec.

func SaveConfig

func SaveConfig(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SaveConfig represents the SaveConfig task.

func SaveStateEncryptionConfig added in v0.9.0

func SaveStateEncryptionConfig(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SaveStateEncryptionConfig saves state partition encryption info in the meta partition.

func SetRLimit

func SetRLimit(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SetRLimit represents the SetRLimit task.

func SetUserEnvVars

func SetUserEnvVars(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SetUserEnvVars represents the SetUserEnvVars task.

func SetupLogger

func SetupLogger(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SetupLogger represents the SetupLogger task.

func SetupSharedFilesystems

func SetupSharedFilesystems(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SetupSharedFilesystems represents the SetupSharedFilesystems task.

func SetupSystemDirectory

func SetupSystemDirectory(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SetupSystemDirectory represents the SetupSystemDirectory task.

func SetupVarDirectory

func SetupVarDirectory(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

SetupVarDirectory represents the SetupVarDirectory task.

func Shutdown

func Shutdown(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

Shutdown represents the Shutdown task.

func StartAllServices

func StartAllServices(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

StartAllServices represents the task to start the system services.

func StartContainerd

func StartContainerd(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

StartContainerd represents the task to start containerd.

func StartUdevd added in v0.6.0

func StartUdevd(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

StartUdevd represents the task to start udevd.

func StopAllPods added in v0.6.3

func StopAllPods(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

StopAllPods represents the task for stopping all pods.

func StopAllServices

func StopAllServices(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

StopAllServices represents the StopAllServices task.

func StopServicesForUpgrade

func StopServicesForUpgrade(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

StopServicesForUpgrade represents the StopServicesForUpgrade task.

func UncordonNode added in v0.6.0

func UncordonNode(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UncordonNode represents the task for mark node as scheduling enabled.

This action undoes the CordonAndDrainNode task.

func UnmountBootPartition

func UnmountBootPartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountBootPartition unmounts the boot partition.

func UnmountEFIPartition added in v0.7.0

func UnmountEFIPartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountEFIPartition unmounts the EFI partition.

func UnmountEphemeralPartition

func UnmountEphemeralPartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountEphemeralPartition unmounts the ephemeral partition.

func UnmountOverlayFilesystems

func UnmountOverlayFilesystems(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountOverlayFilesystems represents the UnmountOverlayFilesystems task.

func UnmountPodMounts

func UnmountPodMounts(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountPodMounts represents the UnmountPodMounts task.

func UnmountStatePartition added in v0.7.0

func UnmountStatePartition(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountStatePartition unmounts the system partition.

func UnmountSystemDiskBindMounts

func UnmountSystemDiskBindMounts(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountSystemDiskBindMounts represents the UnmountSystemDiskBindMounts task.

func UnmountUserDisks added in v0.8.2

func UnmountUserDisks(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UnmountUserDisks represents the UnmountUserDisks task.

func UpdateBootloader

func UpdateBootloader(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

UpdateBootloader represents the UpdateBootloader task.

func Upgrade

func Upgrade(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

Upgrade represents the task for performing an upgrade.

func ValidateConfig

func ValidateConfig(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

ValidateConfig validates the config.

func VerifyDiskAvailability

func VerifyDiskAvailability(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

VerifyDiskAvailability represents the task for verifying that the system disk is not in use.

func VerifyInstallation

func VerifyInstallation(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

VerifyInstallation represents the VerifyInstallation task.

func WriteIMAPolicy

func WriteIMAPolicy(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

WriteIMAPolicy represents the WriteIMAPolicy task.

func WriteRequiredSysctls

func WriteRequiredSysctls(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

WriteRequiredSysctls represents the WriteRequiredSysctls task.

func WriteRequiredSysctlsForContainer

func WriteRequiredSysctlsForContainer(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

WriteRequiredSysctlsForContainer represents the WriteRequiredSysctlsForContainer task.

func WriteUserFiles

func WriteUserFiles(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

WriteUserFiles represents the WriteUserFiles task.

func WriteUserSysctls

func WriteUserSysctls(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string)

WriteUserSysctls represents the WriteUserSysctls task.

Types

type ClusterState

type ClusterState struct{}

ClusterState represents the cluster's state.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

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

func NewController

func NewController(b []byte) (*Controller, error)

NewController intializes and returns a controller.

func (*Controller) ListenForEvents

func (c *Controller) ListenForEvents(ctx context.Context) error

ListenForEvents starts the event listener. The listener will trigger a shutdown in response to a SIGTERM signal and ACPI button/power event.

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, seq runtime.Sequence, data interface{}, setters ...runtime.ControllerOption) error

Run executes all phases known to the controller in serial. `Controller` aborts immediately if any phase fails.

func (*Controller) Runtime

func (c *Controller) Runtime() runtime.Runtime

Runtime implements the controller interface.

func (*Controller) Sequencer

func (c *Controller) Sequencer() runtime.Sequencer

Sequencer implements the controller interface.

func (*Controller) TryLock

func (c *Controller) TryLock() bool

TryLock attempts to set a lock that prevents multiple sequences from running at once. If currently locked, a value of true will be returned. If not currently locked, a value of false will be returned.

func (*Controller) Unlock

func (c *Controller) Unlock() bool

Unlock removes the lock set by `TryLock`.

func (*Controller) V1Alpha2 added in v0.9.0

func (c *Controller) V1Alpha2() runtime.V1Alpha2Controller

V1Alpha2 implements the controller interface.

type Events

type Events struct {
	// contains filtered or unexported fields
}

Events represents the runtime event stream.

Events internally is implemented as circular buffer of `runtime.Event`. `e.stream` slice is allocated to the initial capacity and slice size doesn't change throughout the lifetime of Events.

To explain the internals, let's call `Publish()` method 'Publisher' (there might be multiple callers for it), and each `Watch()` handler as 'Consumer'.

For Publisher, `Events` keeps `e.writePos`, `e.writePos` is write offset into `e.stream`. Offset `e.writePos` is always incremeneted, real write index is `e.writePos % e.cap`

Each Consumer captures initial position it starts consumption from as `pos` which is local to each Consumer, as Consumers are free to work on their own pace. Following diagram shows Publisher and three Consumers:

                                               Consumer 3                         Consumer 2
                                               pos = 27                           pos = 34
e.stream []Event                               |                                  |
                                               |                                  |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
| 0  | 1  | 2  | 3  | 4  | 5  | 6  | 7  | 8  | 9  | 10 | 11 | 12 | 13 | 14 | 15 | 16 |17  |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
                                     |                                  |
                                     |                                  |
                                     Consumer 1                         Publisher
                                     pos = 43                           e.writePos = 50

Capacity of Events in this diagram is 18, Publisher published already 50 events, so it already overwrote `e.stream` twice fully.

Consumer1 is trying to keep up with the publisher, it has 14-7 = 7 events to catch up.

Consumer2 is reading events published by Publisher before last wraparound, it has 50-34 = 16 events to catch up. Consumer 2 has a lot of events to catch up, but as it stays on track, it can still do that.

Consumer3 is doing bad: 50-27 = 23 > 18 (capacity), so its read position has already been overwritten, it can't read consistent data, soit should error out.

Synchronization: at the moment single mutex protects `e.stream` and `e.writePos`, consumers keep their position as local variable, so it doesn't require synchronization. If Consumer catches up with Publisher, it sleeps on condition variable to be woken up by Publisher on next publish.

func NewEvents

func NewEvents(capacity, gap int) *Events

NewEvents initializes and returns the v1alpha1 runtime event stream.

Argument cap is a maximum event stream capacity (available event history). Argument gap is a safety gap to separate consumer from the publisher. Maximum available event history is (cap-gap).

func (*Events) Publish

func (e *Events) Publish(msg proto.Message)

Publish implements the Events interface.

func (*Events) Watch

func (e *Events) Watch(f runtime.WatchFunc, opt ...runtime.WatchOptionFunc) error

Watch implements the Events interface.

type MachineState

type MachineState struct {
	// contains filtered or unexported fields
}

MachineState represents the machine's state.

func (*MachineState) Close

func (s *MachineState) Close() error

Close implements the machine state interface.

func (*MachineState) Disk

func (s *MachineState) Disk(options ...disk.Option) *probe.ProbedBlockDevice

Disk implements the machine state interface.

func (*MachineState) Installed

func (s *MachineState) Installed() bool

Installed implements the machine state interface.

func (*MachineState) IsInstallStaged added in v0.8.0

func (s *MachineState) IsInstallStaged() bool

IsInstallStaged implements the machine state interface.

func (*MachineState) StagedInstallImageRef added in v0.8.0

func (s *MachineState) StagedInstallImageRef() string

StagedInstallImageRef implements the machine state interface.

func (*MachineState) StagedInstallOptions added in v0.8.0

func (s *MachineState) StagedInstallOptions() []byte

StagedInstallOptions implements the machine state interface.

type PhaseList

type PhaseList []runtime.Phase

PhaseList represents a list of phases.

func (PhaseList) Append

func (p PhaseList) Append(name string, tasks ...runtime.TaskSetupFunc) PhaseList

Append appends a task to the phase list.

func (PhaseList) AppendList added in v0.7.0

func (p PhaseList) AppendList(list PhaseList) PhaseList

AppendList appends an additional PhaseList to the existing one.

func (PhaseList) AppendWhen

func (p PhaseList) AppendWhen(when bool, name string, tasks ...runtime.TaskSetupFunc) PhaseList

AppendWhen appends a task to the phase list when `when` is `true`.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime implements the Runtime interface.

func NewRuntime

NewRuntime initializes and returns the v1alpha1 runtime.

func (*Runtime) CanApplyImmediate added in v0.9.0

func (r *Runtime) CanApplyImmediate(b []byte) error

CanApplyImmediate implements the Runtime interface.

func (*Runtime) Config

func (r *Runtime) Config() config.Provider

Config implements the Runtime interface.

func (*Runtime) Events

func (r *Runtime) Events() runtime.EventStream

Events implements the Runtime interface.

func (*Runtime) Logging added in v0.6.0

func (r *Runtime) Logging() runtime.LoggingManager

Logging implements the Runtime interface.

func (*Runtime) NodeName added in v0.8.2

func (r *Runtime) NodeName() (string, error)

NodeName implements the Runtime interface.

func (*Runtime) SetConfig

func (r *Runtime) SetConfig(b []byte) error

SetConfig implements the Runtime interface.

func (*Runtime) State

func (r *Runtime) State() runtime.State

State implements the Runtime interface.

func (*Runtime) ValidateConfig added in v0.8.0

func (r *Runtime) ValidateConfig(b []byte) (config.Provider, error)

ValidateConfig implements the Runtime interface.

type Sequencer

type Sequencer struct{}

Sequencer implements the sequencer interface.

func NewSequencer

func NewSequencer() *Sequencer

NewSequencer intializes and returns a sequencer.

func (*Sequencer) ApplyConfiguration added in v0.7.0

ApplyConfiguration defines a sequence which applies a new machine configuration to the node, rebooting to make it active.

func (*Sequencer) Boot

func (*Sequencer) Boot(r runtime.Runtime) []runtime.Phase

Boot is the boot sequence. This primary goal if this sequence is to apply user supplied settings and start the services for the specific machine type. This sequence should never be reached if an installation is not found.

func (*Sequencer) Bootstrap

func (*Sequencer) Bootstrap(r runtime.Runtime) []runtime.Phase

Bootstrap is the bootstrap sequence. This primary goal if this sequence is to bootstrap Etcd and Kubernetes.

func (*Sequencer) Initialize

func (*Sequencer) Initialize(r runtime.Runtime) []runtime.Phase

Initialize is the initialize sequence. The primary goals of this sequence is to load the config and enforce kernel security requirements.

func (*Sequencer) Install

func (*Sequencer) Install(r runtime.Runtime) []runtime.Phase

Install is the install sequence.

func (*Sequencer) Reboot

func (*Sequencer) Reboot(r runtime.Runtime) []runtime.Phase

Reboot is the reboot sequence.

func (*Sequencer) Reset

Reset is the reset sequence.

func (*Sequencer) Shutdown

func (*Sequencer) Shutdown(r runtime.Runtime) []runtime.Phase

Shutdown is the shutdown sequence.

func (*Sequencer) StageUpgrade added in v0.8.0

StageUpgrade is the stage upgrade sequence.

func (*Sequencer) Upgrade

Upgrade is the upgrade sequence.

type State

type State struct {
	// contains filtered or unexported fields
}

State implements the state interface.

func NewState

func NewState() (s *State, err error)

NewState initializes and returns the v1alpha1 state.

func (*State) Cluster

func (s *State) Cluster() runtime.ClusterState

Cluster implements the state interface.

func (*State) Machine

func (s *State) Machine() runtime.MachineState

Machine implements the state interface.

func (*State) Platform

func (s *State) Platform() runtime.Platform

Platform implements the state interface.

func (*State) V1Alpha2 added in v0.9.0

func (s *State) V1Alpha2() runtime.V1Alpha2State

V1Alpha2 implements the state interface.

Directories

Path Synopsis
adv
Package adv provides common interfaces to access ADV data.
Package adv provides common interfaces to access ADV data.
adv/syslinux
Package syslinux provides syslinux-compatible ADV data.
Package syslinux provides syslinux-compatible ADV data.
adv/talos
Package talos implements modern ADV which supports large size for the values and tags.
Package talos implements modern ADV which supports large size for the values and tags.
aws
gcp

Jump to

Keyboard shortcuts

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