worker

package
v0.56.16 Latest Latest
Warning

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

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

Documentation

Overview

Package worker is responsible for the logic behind submitting results data back to a Sonobuoy aggregator. This is intended for plugins to leverage, to avoid uploading data manually.

Index

Constants

View Source
const (
	SonobuoyNSEnvKey              = "SONOBUOY_NS"
	SonobuoyPluginPodEnvKey       = "SONOBUOY_PLUGIN_POD"
	SonobuoyWorkerContainerEnvKey = "SONOBUOY_WORKER_CONTAINER"

	// SonobuoyDoneFileDelayKey is the env key specifying where this value may be overwritten. Adding this in as a mitigation for problems
	// caused by adding the delay. I anticipate we will not have a problem though since the default delay is reasonably short.
	SonobuoyDoneFileDelayKey = "SONOBUOY_DONE_FILE_DELAY"
)

Variables

This section is empty.

Functions

func DoRequest

func DoRequest(url string, client *http.Client, callback func() (io.Reader, string, string, error)) error

DoRequest calls the given callback which returns an io.Reader, and submits the results, with error handling, and falls back on uploading JSON with the error message if the callback fails. (This way, problems gathering data don't result in the server waiting forever for results that will never come.)

func GatherResults

func GatherResults(waitfile string, url string, client *http.Client, stopc <-chan struct{}) error

GatherResults is the consumer of a co-scheduled container that agrees on the following contract:

1. Output data will be placed into an agreed upon results directory. 2. The Job will wait for a done file 3. The done file contains a single string of the results to be sent to the aggregator

func LoadConfig

func LoadConfig() (*plugin.WorkerConfig, error)

LoadConfig loads the configuration for the sonobuoy worker from environment variables, returning a plugin.WorkerConfig struct with defaults applied

func RelayProgressUpdates added in v0.15.4

func RelayProgressUpdates(port string, aggregatorURL string, client *http.Client)

RelayProgressUpdates start listening to the given port and will use the client to post progressUpdates to the aggregatorURL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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