plugin

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: Apache-2.0 Imports: 6 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"
)
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) 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
	// GetResultType returns the type of results for this plugin, typically
	// the same as the plugin name.
	GetResultType() string
	// 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
}

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

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) ExpectedResultID

func (r *Result) ExpectedResultID() string

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

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) 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 {
	// MasterURL is the URL we talk to for submitting results
	MasterURL string `json:"masterurl,omitempty" mapstructure:"masterurl"`
	// 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"`
	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