plugin

package
v0.53.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

README

Sonobuoy Plugins

See the plugin reference.

Documentation

Index

Constants

View Source
const (
	// GracefulShutdownPeriod is how long plugins have to cleanly finish before they are terminated.
	GracefulShutdownPeriod = 60

	// ResultsDir is the directory where results will be available in Sonobuoy plugin containers.
	ResultsDir = "/tmp/results"

	// TimeoutErrMsg is the message used when Sonobuoy experiences a timeout while waiting for results.
	TimeoutErrMsg = "" /* 151-byte string literal not displayed */
)
View Source
const (
	// GlobalResult is used in place of a node name when the results apply
	// to the entire cluster as opposed to a single node (e.g. when running
	// a job and not a daemonset).
	GlobalResult = "global"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationConfig

type AggregationConfig struct {
	BindAddress      string `json:"bindaddress"`
	BindPort         int    `json:"bindport"`
	AdvertiseAddress string `json:"advertiseaddress"`
	TimeoutSeconds   int    `json:"timeoutseconds"`
}

AggregationConfig are the config settings for the server that aggregates plugin results

type ExpectedResult

type ExpectedResult struct {
	NodeName   string
	ResultType string
}

ExpectedResult is an expected result that a plugin will submit. This is so the aggregation server can know when it all results have been received.

func (*ExpectedResult) ID

func (er *ExpectedResult) ID() string

ID returns a unique identifier for this expected result to distinguish it from the rest of the results that may be seen by the aggregation server.

type Interface

type Interface interface {
	// Run runs a plugin, declaring all resources it needs, and then
	// returns.  It does not block and wait until the plugin has finished.
	Run(kubeClient kubernetes.Interface, hostname string, cert *tls.Certificate, ownerPod *v1.Pod, progressPort string) error

	// Cleanup cleans up all resources created by the plugin
	Cleanup(kubeClient kubernetes.Interface)

	// Monitor continually checks for problems in the resources created by a
	// plugin (either because it won't schedule, or the image won't
	// download, too many failed executions, etc) and sends the errors as
	// Result objects through the provided channel. It should return once the context
	// is cancelled.
	Monitor(ctx context.Context, kubeClient kubernetes.Interface, availableNodes []v1.Node, resultsCh chan<- *Result)

	// ExpectedResults is an array of Result objects that a plugin should
	// expect to submit.
	ExpectedResults(nodes []v1.Node) []ExpectedResult

	// GetName returns the name of this plugin
	GetName() string

	// SkipCleanup returns whether cleanup for this plugin should be skipped or not.
	SkipCleanup() bool

	// GetResultFormat states the type of results this plugin generates and facilates post-processing
	// those results.
	GetResultFormat() string

	// GetResultFiles returns the specific files to target for post-processing. If empty, each
	// result format specifies its own heuristic for determining those files.
	GetResultFiles() []string

	// GetDescription returns the human-readable description of the plugin.
	GetDescription() string

	// GetSourceURL returns the URL where the plugin came from and where updates to it will be located.
	GetSourceURL() string
}

Interface represents what all plugins must implement to be run and have results be aggregated.

type ProgressUpdate added in v0.15.4

type ProgressUpdate struct {
	PluginName string    `json:"name"`
	Node       string    `json:"node"`
	Timestamp  time.Time `json:"timestamp"`

	Message string `json:"msg"`

	Total     int64 `json:"total"`
	Completed int64 `json:"completed"`

	Errors   []string `json:"errors,omitempty"`
	Failures []string `json:"failures,omitempty"`
}

ProgressUpdate is the structure that the Sonobuoy worker sends to the aggregator to inform it of plugin progress. More TBD.

func (ProgressUpdate) Key added in v0.15.4

func (s ProgressUpdate) Key() string

Key returns a unique identifier for this ProgressUpdate to match it up against an known plugins running.

type Result

type Result struct {
	NodeName   string
	ResultType string
	MimeType   string
	Filename   string
	Body       io.Reader
	Error      string
}

Result represents a result we got from a dispatched plugin, returned to the aggregation server over HTTP. Errors running a plugin are also considered a Result, if they have an Error property set.

func (*Result) IsSuccess

func (r *Result) IsSuccess() bool

IsSuccess returns whether the Result represents a successful plugin result, versus one that was unsuccessful (for instance, from a dispatched plugin not being able to launch.)

func (*Result) IsTimeout added in v0.16.2

func (r *Result) IsTimeout() bool

IsTimeout returns whether or not the Result represents the error case when Sonobuoy experiences a timeout waiting for results.

func (*Result) Key added in v0.15.4

func (r *Result) Key() string

Key returns a unique identifier for this result to match it up against an expected result.

func (*Result) Path

func (r *Result) Path() string

Path is the path within the "plugins" section of the results tarball where this Result should be stored, not including a file extension.

type Selection

type Selection struct {
	Name string `json:"name"`
}

Selection is the user specified input to load and initialize plugins

type WorkerConfig

type WorkerConfig struct {
	// AggregatorURL is the URL we talk to the aggregator pod on for submitting results
	AggregatorURL string `json:"aggregatorurl,omitempty" mapstructure:"aggregatorurl"`

	// NodeName is the node name we should call ourselves when sending results
	NodeName string `json:"nodename,omitempty" mapstructure:"nodename"`

	// ResultsDir is the directory that's expected to contain the host's root filesystem
	ResultsDir string `json:"resultsdir,omitempty" mapstructure:"resultsdir"`

	// ResultType is the type of result (to be put in the HTTP URL's path) to be
	// sent back to sonobuoy.
	ResultType string `json:"resulttype,omitempty" mapstructure:"resulttype"`

	// ProgressUpdatesPort is the port on which the Sonobuoy worker will listen for progress
	// updates from the plugin.
	ProgressUpdatesPort string `json:"progressport"  mapstructure:"progressport"`

	CACert     string `json:"cacert,omitempty" mapstructure:"cacert"`
	ClientCert string `json:"clientcert,omitempty" mapstructure:"clientcert"`
	ClientKey  string `json:"clientkey,omitempty" mapstructure:"clientkey"`
}

WorkerConfig is the file given to the sonobuoy worker to configure it to phone home.

Directories

Path Synopsis
Package aggregation is responsible for hosting an HTTP server which aggregates results from all of the nodes that are running sonobuoy agent.
Package aggregation is responsible for hosting an HTTP server which aggregates results from all of the nodes that are running sonobuoy agent.
job
Package loader is responsible for scanning for Plugin Definitions at runtime, and matching/loading them from a user's configuration.
Package loader is responsible for scanning for Plugin Definitions at runtime, and matching/loading them from a user's configuration.

Jump to

Keyboard shortcuts

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