daemon

package
v0.0.1-0...-53b3a21 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidPath

func ValidPath(path string) bool

ValidPath attempts to see if the path provided is indeed an acceptable filesystem path. This function does not check if the path exists.

Types

type Daemon

type Daemon struct {

	// OperatingSystem the operating system the MCD is running on
	OperatingSystem string

	// NodeUpdaterClient an instance of the client which interfaces with host content deployments
	NodeUpdaterClient NodeUpdaterClient
	// contains filtered or unexported fields
}

Daemon is the dispatch point for the functions of the agent on the machine. it keeps track of connections and the current state of the update process.

func New

func New(
	nodeUpdaterClient NodeUpdaterClient,
	exitCh chan<- error,
) (*Daemon, error)

New sets up the systemd and kubernetes connections needed to update the machine.

func (*Daemon) Close

func (dn *Daemon) Close()

Close closes all the connections the node agent has open for it's lifetime

func (*Daemon) ClusterConnect

func (dn *Daemon) ClusterConnect(
	name string,
	kubeClient kubernetes.Interface,
	mcInformer mcfginformersv1.MachineConfigInformer,
	nodeInformer coreinformersv1.NodeInformer,
	kubeletHealthzEnabled bool,
	kubeletHealthzEndpoint string,
)

ClusterConnect sets up the systemd and kubernetes connections needed to update the machine.

func (*Daemon) InstallSignalHandler

func (dn *Daemon) InstallSignalHandler(signaled chan struct{})

InstallSignalHandler installs the handler for the signals the daemon should act on

func (*Daemon) LogSystemData

func (dn *Daemon) LogSystemData()

LogSystemData gathers data from the OS and adds it to our stdout; should only be called once on MCD startup to log things which generally shouldn't change dynamically after a reboot.

func (*Daemon) Run

func (dn *Daemon) Run(stopCh <-chan struct{}, exitCh <-chan error) error

Run finishes informer setup and then blocks, and the informer will be responsible for triggering callbacks to handle updates. Successful updates shouldn't return, and should just reboot the node.

func (*Daemon) RunOnceFrom

func (dn *Daemon) RunOnceFrom(onceFrom string, skipReboot bool) error

RunOnceFrom is the primary entrypoint for the non-cluster case

type MachineConfigDiff

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

MachineConfigDiff represents an ad-hoc difference between two MachineConfig objects. At some point this may change into holding just the files/units that changed and the MCO would just operate on that. For now we're just doing this to get improved logging.

func Reconcilable

func Reconcilable(oldConfig, newConfig *mcfgv1.MachineConfig) (*MachineConfigDiff, error)

Reconcilable checks the configs to make sure that the only changes requested are ones we know how to do in-place. If we can reconcile, (nil, nil) is returned. Otherwise, if we can't do it in place, the node is marked as degraded; the returned string value includes the rationale.

we can only update machine configs that have changes to the files, directories, links, and systemd units sections of the included ignition config currently.

type NodeUpdaterClient

type NodeUpdaterClient interface {
	GetStatus() (string, error)
	GetBootedOSImageURL() (string, string, error)
	PullAndRebase(string, bool) (string, bool, error)
	RunPivot(string) error
}

NodeUpdaterClient is an interface describing how to interact with the host around content deployment

func NewNodeUpdaterClient

func NewNodeUpdaterClient() NodeUpdaterClient

NewNodeUpdaterClient returns a new instance of the default DeploymentClient (RpmOstreeClient)

type NodeWriter

type NodeWriter interface {
	Run(stop <-chan struct{})
	SetDone(client corev1client.NodeInterface, lister corev1lister.NodeLister, node string, dcAnnotation string) error
	SetWorking(client corev1client.NodeInterface, lister corev1lister.NodeLister, node string) error
	SetUnreconcilable(err error, client corev1client.NodeInterface, lister corev1lister.NodeLister, node string) error
	SetDegraded(err error, client corev1client.NodeInterface, lister corev1lister.NodeLister, node string) error
	SetSSHAccessed(client corev1client.NodeInterface, lister corev1lister.NodeLister, node string) error
}

NodeWriter is the interface to implement a single writer to Kubernetes to prevent race conditions

type RpmOstreeClient

type RpmOstreeClient struct{}

TODO(runcom): make this private to pkg/daemon!!!

RpmOstreeClient provides all RpmOstree related methods in one structure. This structure implements DeploymentClient

func (*RpmOstreeClient) GetBootedOSImageURL

func (r *RpmOstreeClient) GetBootedOSImageURL() (string, string, error)

GetBootedOSImageURL returns the image URL as well as the OSTree version (for logging)

func (*RpmOstreeClient) GetStatus

func (r *RpmOstreeClient) GetStatus() (string, error)

GetStatus returns multi-line human-readable text describing system status

func (*RpmOstreeClient) PullAndRebase

func (r *RpmOstreeClient) PullAndRebase(container string, keep bool) (imgid string, changed bool, err error)

pullAndRebase potentially rebases system if not already rebased.

func (*RpmOstreeClient) RunPivot

func (r *RpmOstreeClient) RunPivot(osImageURL string) error

RunPivot executes a pivot from one deployment to another as found in the referenced osImageURL. This was originally https://github.com/openshift/pivot but it's now imported into the MCD itself. The reason we execute on the host is due to SELinux; see https://github.com/openshift/pivot/pull/31 and https://github.com/openshift/machine-config-operator/issues/314 Basically rpm_ostree_t has mac_admin, container_t doesn't.

Directories

Path Synopsis
pivot

Jump to

Keyboard shortcuts

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