preflights

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package preflights manages running host preflights on remote hosts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SerializeSpec

func SerializeSpec(spec *v1beta2.HostPreflightSpec) ([]byte, error)

SerializeSpec serialize the provided spec inside a HostPreflight object and returns the byte slice.

func UnserializeSpec

func UnserializeSpec(data []byte) (*v1beta2.HostPreflightSpec, error)

UnserializeSpec unserializes an HostPreflightSpec from a raw slice of bytes.

Types

type Output

type Output struct {
	Warn []Record `json:"warn"`
	Pass []Record `json:"pass"`
	Fail []Record `json:"fail"`
}

Output is the output of a troubleshoot preflight check as returned by `preflight --format=json`. It just wraps a list of results, aka records, classified by status.

func OutputFromReader

func OutputFromReader(from io.Reader) (*Output, error)

OutputFromReader reads the provided reader and returns a Output object. Expects the reader to contain a valid JSON object.

func Run

func Run(ctx context.Context, host *cluster.Host, spec *v1beta2.HostPreflightSpec) (*Output, error)

Run runs the provided host preflight spec on the provided host.

func RunLocal

func RunLocal(ctx context.Context, spec *v1beta2.HostPreflightSpec) (*Output, error)

RunLocal runs the provided host preflight spec locally. This function is meant to be used when upgrading a local node.

func (Output) HasFail

func (o Output) HasFail() bool

HasFail returns true if any of the preflight checks failed.

func (Output) HasWarn

func (o Output) HasWarn() bool

HasWarn returns true if any of the preflight checks returned a warning.

func (Output) PrintTable

func (o Output) PrintTable()

PrintTable prints the preflight output in a table format.

type Outputs

type Outputs map[string]*Output

Outputs holds a list of Output objects indexed by host address.

func NewOutputs

func NewOutputs() Outputs

NewOutputs creates a new Outputs object.

func (Outputs) HaveFails

func (o Outputs) HaveFails() bool

HaveFails returns true if any of the host preflight checks failed.

func (Outputs) HaveWarns

func (o Outputs) HaveWarns() bool

HaveWarns returns true if any of the host preflight checks returned a warning.

func (Outputs) PrintTable

func (o Outputs) PrintTable()

PrintTable prints the preflight output in a table format.

type Record

type Record struct {
	Title   string `json:"title"`
	Message string `json:"message"`
}

Record is a single record of a troubleshoot preflight check.

Jump to

Keyboard shortcuts

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