config

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNamespace is the namespace where the master and plugin workers will run (but not necessarily the pods created by the plugin workers).
	DefaultNamespace = "heptio-sonobuoy"

	// DefaultKubeConformanceImageURL is the URL of the docker image to run for the kube conformance tests.
	DefaultKubeConformanceImageURL = "gcr.io/heptio-images/kube-conformance"
	// UpstreamKubeConformanceImageURL is the URL of the docker image to run for
	// the kube conformance tests which is maintained by upstream Kubernetes.
	UpstreamKubeConformanceImageURL = "gcr.io/google-containers/conformance"
	// DefaultKubeConformanceImageTag is the default tag of the conformance image
	DefaultKubeConformanceImageTag = "latest"
	// DefaultAggregationServerBindPort is the default port for the aggregation server to bind to.
	DefaultAggregationServerBindPort = 8080
	// DefaultAggregationServerBindAddress is the default address for the aggregation server to bind to.
	DefaultAggregationServerBindAddress = "0.0.0.0"
	// DefaultAggregationServerTimeoutSeconds is the default amount of time the aggregation server will wait for all plugins to complete.
	DefaultAggregationServerTimeoutSeconds = 10800 // 180 min
	// MasterPodName is the name of the main pod that runs plugins and collects results.
	MasterPodName = "sonobuoy"
	// MasterContainerName is the name of the main container in the master pod.
	MasterContainerName = "kube-sonobuoy"
	// MasterResultsPath is the location in the main container of the master pod where results will be archived.
	MasterResultsPath = "/tmp/sonobuoy"
	// DefaultSonobuoyPullPolicy is the default pull policy used in the Sonobuoy config.
	DefaultSonobuoyPullPolicy = "IfNotPresent"
	// DefaultQueryQPS is the number of queries per second Sonobuoy will make when gathering data.
	DefaultQueryQPS = 30
	// DefaultQueryBurst is the peak number of queries per second Sonobuoy will make when gathering data.
	DefaultQueryBurst = 50
)

Variables

View Source
var (
	// DefaultKubeConformanceImage is the URL and tag of the docker image to run for the kube conformance tests.
	DefaultKubeConformanceImage = DefaultKubeConformanceImageURL + ":" + DefaultKubeConformanceImageTag
	// DefaultImage is the URL of the docker image to run for the aggregator and workers
	DefaultImage = "gcr.io/heptio-images/sonobuoy:" + buildinfo.Version
	// DefaultResources is the default set of resources which are queried for after plugins run. The strings
	// are compared against the resource.Name given by the client-go discovery client. The non-standard values
	// that are included here are: podlogs, servergroups, serverversion. The value 'nodes', although a crawlable
	// API value, also is used to query against the healthz and configz endpoints on the node.
	DefaultResources = []string{
		"apiservices",
		"certificatesigningrequests",
		"clusterrolebindings",
		"clusterroles",
		"componentstatuses",
		"configmaps",
		"controllerrevisions",
		"cronjobs",
		"customresourcedefinitions",
		"daemonsets",
		"deployments",
		"endpoints",
		"ingresses",
		"jobs",
		"leases",
		"limitranges",
		"mutatingwebhookconfigurations",
		"namespaces",
		"networkpolicies",
		"nodes",
		"persistentvolumeclaims",
		"persistentvolumes",
		"poddisruptionbudgets",
		"pods",
		"podsecuritypolicies",
		"podtemplates",
		"priorityclasses",
		"replicasets",
		"replicationcontrollers",
		"resourcequotas",
		"rolebindings",
		"roles",
		"servergroups",
		"serverversion",
		"serviceaccounts",
		"services",
		"statefulsets",
		"storageclasses",
		"validatingwebhookconfigurations",
		"volumeattachments",
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {

	///////////////////////////////////////////////
	// Meta-Data collection options
	///////////////////////////////////////////////
	Description string `json:"Description" mapstructure:"Description"`
	UUID        string `json:"UUID" mapstructure:"UUID"`
	Version     string `json:"Version" mapstructure:"Version"`
	ResultsDir  string `json:"ResultsDir" mapstructure:"ResultsDir"`

	///////////////////////////////////////////////
	// Query options
	///////////////////////////////////////////////
	Resources []string      `json:"Resources" mapstructure:"Resources"`
	Filters   FilterOptions `json:"Filters" mapstructure:"Filters"`
	Limits    LimitConfig   `json:"Limits" mapstructure:"Limits"`
	QPS       float32       `json:"QPS,omitempty" mapstructure:"QPS"`
	Burst     int           `json:"Burst,omitempty" mapstructure:"Burst"`

	///////////////////////////////////////////////
	// Plugin configurations settings
	///////////////////////////////////////////////
	Aggregation      plugin.AggregationConfig `json:"Server" mapstructure:"Server"`
	PluginSelections []plugin.Selection       `json:"Plugins" mapstructure:"Plugins"`
	PluginSearchPath []string                 `json:"PluginSearchPath" mapstructure:"PluginSearchPath"`
	Namespace        string                   `json:"Namespace" mapstructure:"Namespace"`
	LoadedPlugins    []plugin.Interface       `json:"-"` // this is assigned when plugins are loaded.

	///////////////////////////////////////////////
	// Sonobuoy configuration
	///////////////////////////////////////////////
	WorkerImage       string            `json:"WorkerImage" mapstructure:"WorkerImage"`
	ImagePullPolicy   string            `json:"ImagePullPolicy" mapstructure:"ImagePullPolicy"`
	ImagePullSecrets  string            `json:"ImagePullSecrets" mapstructure:"ImagePullSecrets"`
	CustomAnnotations map[string]string `json:"CustomAnnotations,omitempty" mapstructure:"CustomAnnotations"`
}

Config is the input struct used to determine what data to collect.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig will load the current sonobuoy configuration using the filesystem and environment variables, and returns a config object

func New added in v0.11.0

func New() *Config

New returns a newly-constructed Config object with default values.

func (*Config) FilterResources

func (cfg *Config) FilterResources(filter []string) []string

FilterResources is a utility function used to parse Resources

func (*Config) OutputDir

func (cfg *Config) OutputDir() string

OutputDir returns the directory under the ResultsDir containing the UUID for this run.

func (*Config) Validate added in v0.9.0

func (cfg *Config) Validate() (errors []error)

Validate returns a list of errors for the configuration, if any are found.

type FilterOptions

type FilterOptions struct {
	Namespaces    string `json:"Namespaces"`
	LabelSelector string `json:"LabelSelector"`
}

FilterOptions allow operators to select sets to include in a report

type LimitConfig added in v0.9.0

type LimitConfig struct {
	PodLogs SizeOrTimeLimitConfig `json:"PodLogs" mapstructure:"PodLogs"`
}

LimitConfig is a configuration on the limits of sizes of various responses.

type SizeOrTimeLimitConfig added in v0.9.0

type SizeOrTimeLimitConfig struct {
	LimitSize string `json:"LimitSize" mapstructure:"LimitSize"`
	LimitTime string `json:"LimitTime" mapstructure:"LimitTime"`
}

SizeOrTimeLimitConfig represents configuration that limits the size of something either by a total disk size, or by a length of time.

func (SizeOrTimeLimitConfig) SizeLimitBytes added in v0.9.0

func (c SizeOrTimeLimitConfig) SizeLimitBytes(defaultVal int64) int64

SizeLimitBytes returns how many bytes the configuration is set to limit, returning defaultVal if not set.

func (SizeOrTimeLimitConfig) TimeLimitDuration added in v0.9.0

func (c SizeOrTimeLimitConfig) TimeLimitDuration(defaultVal time.Duration) time.Duration

TimeLimitDuration returns the duration the configuration is set to limit, returning defaultVal if not set.

Jump to

Keyboard shortcuts

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