sonobuoy: github.com/vmware-tanzu/sonobuoy/pkg/plugin Index | Files | Directories

package plugin

import "github.com/vmware-tanzu/sonobuoy/pkg/plugin"

Index

Package Files

constants.go interface.go

Constants

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 = "timeout waiting for results"
)
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"
)

type AggregationConfig Uses

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 Uses

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 Uses

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 Uses

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
}

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

type ProgressUpdate Uses

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 Uses

func (s ProgressUpdate) Key() string

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

type Result Uses

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 Uses

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 Uses

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 Uses

func (r *Result) Key() string

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

func (*Result) Path Uses

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 Uses

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

Selection is the user specified input to load and initialize plugins

type WorkerConfig Uses

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

PathSynopsis
aggregationPackage aggregation is responsible for hosting an HTTP server which aggregates results from all of the nodes that are running sonobuoy agent.
driver
driver/daemonset
driver/job
driver/utils
loaderPackage loader is responsible for scanning for Plugin Definitions at runtime, and matching/loading them from a user's configuration.
manifest
manifest/helper

Package plugin imports 7 packages (graph) and is imported by 24 packages. Updated 2020-08-04. Refresh now. Tools for package owners.