app

package
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 67 Imported by: 3

Documentation

Index

Examples

Constants

View Source
const (
	// E2eModeQuick runs a single E2E test and the systemd log tests.
	E2eModeQuick string = "quick"

	// E2eModeNonDisruptiveConformance runs all of the `Conformance` E2E tests which are not marked as disuprtive and the systemd log tests.
	E2eModeNonDisruptiveConformance string = "non-disruptive-conformance"

	// E2eModeCertifiedConformance runs all of the `Conformance` E2E tests and the systemd log tests.
	E2eModeCertifiedConformance string = "certified-conformance"

	E2eModeConformanceLite = "conformance-lite"
)
View Source
const (
	SonobuoyDirEnvKey = "SONOBUOY_DIR"
)

Variables

View Source
var (
	//ErrRBACNoClient is the error returned when we need a client but didn't get on
	ErrRBACNoClient = errors.New(`can't use nil client with "detect" RBAC mode`)
)

Functions

func AddAggregatorPermissionsFlag added in v0.55.1

func AddAggregatorPermissionsFlag(mode *string, flags *pflag.FlagSet)

func AddCustomRegistryFlag added in v0.17.1

func AddCustomRegistryFlag(cfg *string, flags *pflag.FlagSet)

AddCustomRepoFlag adds a custom registry flag to the provided command.

func AddDNSNamespaceFlag added in v0.16.4

func AddDNSNamespaceFlag(str *string, flags *pflag.FlagSet)

AddDNSNamespaceFlag initialises the dns-namespace flag. The value of this flag is used during preflight checks to determine which namespace to use when looking for the DNS pods.

func AddDNSPodLabelsFlag added in v0.16.4

func AddDNSPodLabelsFlag(str *[]string, flags *pflag.FlagSet)

AddDNSPodLabelsFlag initialises the dns-pod-labels flag. The value of this flag is used during preflight checks to determine which labels to use when looking for the DNS pods.

func AddDeleteAllFlag added in v0.11.0

func AddDeleteAllFlag(flag *bool, flags *pflag.FlagSet)

AddDeleteAllFlag adds a boolean flag for deleting everything (including E2E tests).

func AddDeleteWaitFlag added in v0.14.0

func AddDeleteWaitFlag(flag *int, flags *pflag.FlagSet)

AddDeleteWaitFlag adds a boolean flag for waiting for the delete process to complete.

func AddDryRunFlag added in v0.17.1

func AddDryRunFlag(flag *bool, flags *pflag.FlagSet)

AddDryRunFlag adds a boolean flag to perform a dry-run of image operations.

func AddE2ERegistryConfigFlag added in v0.14.0

func AddE2ERegistryConfigFlag(cfg *string, flags *pflag.FlagSet)

AddE2ERegistryConfigFlag adds a e2eRegistryConfigFlag flag to the provided command.

func AddE2ERegistryFlag added in v0.56.0

func AddE2ERegistryFlag(cfg *string, flags *pflag.FlagSet)

AddE2ERegistryFlag adds a e2eRegistryFlag flag to the provided command.

func AddExistingServiceAccountFlag added in v0.56.8

func AddExistingServiceAccountFlag(flag *bool, flags *pflag.FlagSet)

AddExistingServiceAccountFlag adds a boolean flag which disables service account creation.

func AddExtractFlag added in v0.51.0

func AddExtractFlag(flag *bool, flags *pflag.FlagSet)

AddExtractFlag adds a boolean flag to extract results instead of just downloading the tarball.

func AddFilenameFlag added in v0.53.1

func AddFilenameFlag(str *string, flags *pflag.FlagSet)

AddFilename initialises a namespace flag.

func AddForceImagePullPolicyFlag added in v0.56.6

func AddForceImagePullPolicyFlag(apply *bool, flags *pflag.FlagSet)

AddForceImagePullPolicyFlag adds a boolean flag for applying the ImagePullPolicy to all plugins even if set in their plugin specification.

func AddImagePullPolicyFlag added in v0.11.0

func AddImagePullPolicyFlag(policy *string, flags *pflag.FlagSet)

AddImagePullPolicyFlag adds a string flag for the image pull policy for the aggregator/worker. If ForceImagePullPolicy is set, it will also apply to the plugins.

func AddKubeConformanceImage added in v0.11.0

func AddKubeConformanceImage(pluginTransforms *map[string][]func(*manifest.Manifest) error, fs *pflag.FlagSet)

AddKubeConformanceImage initialises the kube-conformance-image flag. Really just a legacy wrapper for --plugin-image=e2e:imageName

func AddKubeConformanceImageVersion added in v0.11.4

func AddKubeConformanceImageVersion(imageVersion *image.ConformanceImageVersion, pluginTransforms *map[string][]func(*manifest.Manifest) error, flags *pflag.FlagSet)

AddKubeConformanceImageVersion initialises an image version flag.

func AddKubeconfigFlag added in v0.11.0

func AddKubeconfigFlag(cfg *Kubeconfig, flags *pflag.FlagSet)

AddKubeconfigFlag adds a kubeconfig and context flags to the provided command.

func AddKubernetesVersionFlag added in v0.18.0

func AddKubernetesVersionFlag(imageVersion *image.ConformanceImageVersion, pluginTransforms *map[string][]func(*manifest.Manifest) error, flags *pflag.FlagSet)

AddKubernetesVersionFlag initialises an image version flag.

func AddLegacyE2EFlags added in v0.53.1

func AddLegacyE2EFlags(cfg *SonobuoyConfig, env *PluginEnvVars, pluginTransforms *map[string][]func(*manifest.Manifest) error, fs *pflag.FlagSet)

AddLegacyE2EFlags is a way to add flags which target the e2e plugin specifically by leveraging the existing flags. They typically wrap other fields (like the env var overrides) and modify those.

func AddNamespaceFlag added in v0.11.0

func AddNamespaceFlag(str *string, flags *pflag.FlagSet)

AddNamespaceFlag initialises a namespace flag.

func AddNamespacePSAEnforceLevelFlag added in v0.56.16

func AddNamespacePSAEnforceLevelFlag(str *string, flags *pflag.FlagSet)

AddNamespacePSAEnforceLevelFlag adds a flag for labelling the namespace

func AddNodeSelectorsFlag added in v0.18.0

func AddNodeSelectorsFlag(p *NodeSelectors, flags *pflag.FlagSet)

AddNodeSelectorFlag adds the flag for gen/run which keeps track of node selectors to add to the aggregator. Allows running of the aggregator on Windows nodes.

func AddPluginEnvFlag added in v0.14.3

func AddPluginEnvFlag(p *PluginEnvVars, flags *pflag.FlagSet)

AddPluginEnvFlag adds the flag for gen/run which keeps track of which plugins to run and loads them from local files if necessary.

func AddPluginImage added in v0.53.1

func AddPluginImage(pluginTransforms *map[string][]func(*manifest.Manifest) error, fs *pflag.FlagSet)

func AddPluginListFlag added in v0.17.1

func AddPluginListFlag(p *[]string, flags *pflag.FlagSet)

AddPluginListFlag adds the flag to keep track of which built-in plugins to use.

func AddPluginSetFlag added in v0.14.2

func AddPluginSetFlag(p *pluginList, flags *pflag.FlagSet)

AddPluginSetFlag adds the flag for gen/run which keeps track of which plugins to run and loads them from local files if necessary.

func AddRBACModeFlags added in v0.11.0

func AddRBACModeFlags(mode *RBACMode, flags *pflag.FlagSet, defaultMode RBACMode)

AddRBACModeFlags adds an E2E Argument with the provided default.

func AddRetrievePathFlag added in v0.55.0

func AddRetrievePathFlag(str *string, flags *pflag.FlagSet)

AddRetrievePathFlag initialises a namespace flag.

func AddRunWaitFlag added in v0.14.0

func AddRunWaitFlag(flag *int, flags *pflag.FlagSet)

AddRunWaitFlag adds an int flag for waiting for the entire run to finish.

func AddSSHKeyPathFlag added in v0.12.0

func AddSSHKeyPathFlag(path *string, pluginTransforms *map[string][]func(*manifest.Manifest) error, flags *pflag.FlagSet)

AddSSHKeyPathFlag initialises an SSH key path flag. The SSH key is uploaded as a secret and used in the containers to enable running of E2E tests which require SSH keys to be present.

func AddSecurityContextMode added in v0.54.0

func AddSecurityContextMode(mode *string, flags *pflag.FlagSet)

func AddServiceAccountNameFlag added in v0.56.8

func AddServiceAccountNameFlag(name *string, flags *pflag.FlagSet)

func AddShortFlag added in v0.14.0

func AddShortFlag(flag *bool, flags *pflag.FlagSet)

AddShortFlag adds a boolean flag to just print the Sonobuoy version and nothing else. Useful in scripts.

func AddShowDefaultPodSpecFlag added in v0.15.2

func AddShowDefaultPodSpecFlag(flag *bool, flags *pflag.FlagSet)

AddShowDefaultPodSpecFlag adds an bool flag for determining whether or not to include the default pod spec used by Sonobuoy in the output

func AddSkipPreflightFlag added in v0.11.0

func AddSkipPreflightFlag(flag *[]string, flags *pflag.FlagSet)

AddSkipPreflightFlag adds a boolean flag to skip preflight checks.

func AddSonobuoyConfigFlag added in v0.11.0

func AddSonobuoyConfigFlag(cfg *SonobuoyConfig, flags *pflag.FlagSet)

AddSonobuoyConfigFlag adds a SonobuoyConfig flag to the provided command.

func AddSonobuoyImage added in v0.11.0

func AddSonobuoyImage(image *string, flags *pflag.FlagSet)

AddSonobuoyImage initialises an image url flag.

func AddSystemdLogsImage added in v0.17.1

func AddSystemdLogsImage(pluginTransforms *map[string][]func(*manifest.Manifest) error, fs *pflag.FlagSet)

AddSystemdLogsImage initialises the systemd-logs-image flag. Really just a legacy wrapper for --plugin-image=systemd-logs:imageName

func AddTimeoutFlag added in v0.14.2

func AddTimeoutFlag(flag *int, flags *pflag.FlagSet)

AddTimeoutFlag adds an int flag for waiting for the entire run to finish.

func AddWaitOutputFlag added in v0.15.1

func AddWaitOutputFlag(mode *WaitOutputMode, flags *pflag.FlagSet, defaultMode WaitOutputMode)

AddWaitOutputFlag adds a flag for spinner when wait flag is set for Sonobuoy operations.

func GenFlagSet added in v0.11.0

func GenFlagSet(cfg *genFlags, rbac RBACMode) *pflag.FlagSet

func NewCmdAggregator added in v0.15.3

func NewCmdAggregator() *cobra.Command

NewCmdAggregator returns the command that runs Sonobuoy as an aggregator. It will load the config, launch plugins, gather results, and query the cluster for data.

func NewCmdDelete added in v0.14.0

func NewCmdDelete() *cobra.Command

func NewCmdE2E added in v0.14.0

func NewCmdE2E() *cobra.Command

func NewCmdGen added in v0.14.0

func NewCmdGen() *cobra.Command

func NewCmdGenCLIDocs added in v0.56.7

func NewCmdGenCLIDocs() *cobra.Command

func NewCmdGenConfig added in v0.14.2

func NewCmdGenConfig() *cobra.Command

NewCmdGenConfig creates the `config` command which will print out the default sonobuoy config in a json format.

func NewCmdGenE2E added in v0.17.1

func NewCmdGenE2E() *cobra.Command

func NewCmdGenImageRepoConfig added in v0.16.5

func NewCmdGenImageRepoConfig() *cobra.Command

NewCmdGenImageRepoConfig creates the `default-image-config` subcommand for `gen` which will print out the default image registry config for the E2E tests which is used with the `images` and `run` command.

func NewCmdGenPluginDef added in v0.14.2

func NewCmdGenPluginDef() *cobra.Command

NewCmdGenPluginDef ...

func NewCmdGenSystemdLogs added in v0.17.1

func NewCmdGenSystemdLogs() *cobra.Command

func NewCmdGet added in v0.56.8

func NewCmdGet() *cobra.Command

func NewCmdImages added in v0.14.0

func NewCmdImages() *cobra.Command

func NewCmdLogs added in v0.14.0

func NewCmdLogs() *cobra.Command

func NewCmdModes added in v0.56.0

func NewCmdModes() *cobra.Command

func NewCmdPlugin added in v0.53.1

func NewCmdPlugin() *cobra.Command

func NewCmdQuery added in v0.56.0

func NewCmdQuery() *cobra.Command

func NewCmdResults added in v0.15.1

func NewCmdResults() *cobra.Command
Example
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--plugin=e2e",
})
cmd.Execute()
Output:

Plugin: e2e
Status: failed
Total: 3
Passed: 1
Failed: 1
Skipped: 1

Failed tests:
[sig-storage] CSI Volumes CSI Topology test using GCE PD driver [Serial] should fail to schedule a pod with a zone missing from AllowedTopologies; PD is provisioned with immediate volume binding
Example (Custom)
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--plugin=custom-status",
})
cmd.Execute()
Output:

Plugin: custom-status
Status: custom-overall-status
Total: 7
Passed: 1
Failed: 1
Skipped: 1
complete: 2
custom: 2

Failed tests:
[sig-storage] CSI Volumes CSI Topology test using GCE PD driver [Serial] should fail to schedule a pod with a zone missing from AllowedTopologies; PD is provisioned with immediate volume binding
Example (Detailed)
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--mode", "detailed", "--plugin=e2e",
})
cmd.Execute()
Output:

{"name":"[sig-storage] CSI Volumes CSI Topology test using GCE PD driver [Serial] should fail to schedule a pod with a zone missing from AllowedTopologies; PD is provisioned with immediate volume binding","status":"failed","meta":{"path":"e2e|junit_01.xml"}}
{"name":"[sig-storage] Subpath Atomic writer volumes should support subpaths with projected pod [LinuxOnly] [Conformance]","status":"passed","meta":{"path":"e2e|junit_01.xml"}}
{"name":"[sig-storage] In-tree Volumes [Driver: hostPath] [Testpattern: Inline-volume (default fs)] subPath should fail if non-existent subpath is outside the volume [Slow]","status":"skipped","meta":{"path":"e2e|junit_01.xml"}}
Example (Plugin)
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--plugin", "tarresultsds",
})
cmd.Execute()
Output:

Plugin: tarresultsds
Status: passed
Total: 2
Passed: 2
Failed: 0
Skipped: 0
Example (PluginDetailed)
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--plugin", "tarresultsds",
	"--mode", "detailed",
})
cmd.Execute()
Output:

tarresultsds|kind-control-plane|out0 hello world
tarresultsds|kind-control-plane|out1 hello world pt2
Example (PluginDetailedArbitraryDetails)
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--plugin", "arbitrary-details",
	"--mode", "detailed",
})
cmd.Execute()
Output:

{"name":"Item with arbitrary details","status":"complete","meta":{"path":"arbitrary-details|output-file"},"details":{"nested-details":{"key1":"value1","key2":"value2"},"string-array":["string 1","string 2","string 3"]}}
{"name":"Another item with arbitrary details","status":"complete","meta":{"path":"arbitrary-details|output-file"},"details":{"integer-array":[1,2,3],"nested-details":{"key1":"value1","key2":"value2","key3":{"nested-key1":"nested-value1","nested-key2":"nested-value2","nested-key3":{"another-nested-key":"another-nested-value"}}}}}
Example (PluginDetailedNode)
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--plugin", "tarresultsds",
	"--mode", "detailed",
	"--node", "out1",
})
cmd.Execute()
Output:

out1 hello world pt2
Example (SkipPrefix)
cmd := NewCmdResults()
cmd.SetArgs([]string{
	filepath.Join("testdata", "testResultsOutput.tar.gz"),
	"--plugin", "tarresultsds",
	"--skip-prefix",
	"--mode=detailed",
	"--node", "out1",
})
cmd.Execute()
Output:

hello world pt2

func NewCmdRetrieve added in v0.14.0

func NewCmdRetrieve() *cobra.Command

func NewCmdRun added in v0.14.0

func NewCmdRun() *cobra.Command

func NewCmdSplat added in v0.50.0

func NewCmdSplat() *cobra.Command

func NewCmdStatus added in v0.14.0

func NewCmdStatus() *cobra.Command

func NewCmdVersion added in v0.14.0

func NewCmdVersion() *cobra.Command

func NewCmdWait added in v0.55.0

func NewCmdWait() *cobra.Command

func NewCmdWorker added in v0.14.0

func NewCmdWorker() *cobra.Command

NewCmdWorker is the cobra command that acts as the entrypoint for Sonobuoy when running as a sidecar with a plugin. It will wait for a 'done' file then transmit the results to the aggregator pod.

func NewSonobuoyCommand added in v0.14.0

func NewSonobuoyCommand() *cobra.Command

func ValidPullPolicies added in v0.11.0

func ValidPullPolicies() []string

Types

type EnvVars added in v0.14.2

type EnvVars map[string]string

func (*EnvVars) Map added in v0.14.2

func (i *EnvVars) Map() map[string]string

Map just casts the EnvVars to its underlying map type.

func (*EnvVars) Set added in v0.14.2

func (i *EnvVars) Set(str string) error

func (*EnvVars) String added in v0.14.2

func (i *EnvVars) String() string

func (*EnvVars) Type added in v0.14.2

func (i *EnvVars) Type() string

type GenPluginDefConfig added in v0.14.2

type GenPluginDefConfig struct {
	// contains filtered or unexported fields
}

GenPluginDefConfig are the input options for running

type ImagePullPolicy added in v0.11.0

type ImagePullPolicy v1.PullPolicy

func (*ImagePullPolicy) Set added in v0.11.0

func (i *ImagePullPolicy) Set(str string) error

func (*ImagePullPolicy) String added in v0.11.0

func (i *ImagePullPolicy) String() string

func (*ImagePullPolicy) Type added in v0.11.0

func (i *ImagePullPolicy) Type() string

type Kubeconfig added in v0.11.0

type Kubeconfig struct {
	*clientcmd.ClientConfigLoadingRules
	Context string
}

Kubeconfig represents an explict or implict kubeconfig

func (*Kubeconfig) Get added in v0.11.0

func (c *Kubeconfig) Get() (*rest.Config, error)

Get returns a rest Config, possibly based on a provided config

func (*Kubeconfig) Set added in v0.11.0

func (c *Kubeconfig) Set(str string) error

Set sets the explicit path of the loader to the provided config file

func (*Kubeconfig) String added in v0.11.0

func (c *Kubeconfig) String() string

String needed for pflag.Value

func (*Kubeconfig) Type added in v0.11.0

func (c *Kubeconfig) Type() string

Type needed for pflag.Value

type Mode added in v0.53.1

type Mode struct {
	// contains filtered or unexported fields
}

Mode represents the sonobuoy configuration for a given mode.

func (*Mode) Set added in v0.53.1

func (m *Mode) Set(str string) error

func (*Mode) String added in v0.53.1

func (m *Mode) String() string

func (*Mode) Type added in v0.53.1

func (m *Mode) Type() string

type NodeSelectors added in v0.18.0

type NodeSelectors map[string]string

NodeSelectors are k-v pairs that will be added to the aggregator.

func (*NodeSelectors) Set added in v0.18.0

func (i *NodeSelectors) Set(str string) error

Set parses the value from the CLI and places it into the internal map. Expected form is key:value. If no `:` is found or it is the last character ("x" or "x:") then the value will be set as the empty string.

func (*NodeSelectors) String added in v0.18.0

func (i *NodeSelectors) String() string

func (*NodeSelectors) Type added in v0.18.0

func (i *NodeSelectors) Type() string

type PluginEnvVars added in v0.14.3

type PluginEnvVars map[string]map[string]string

PluginEnvVars is a map of plugin (by name) mapped to a k-v map of env var name/values.

func (*PluginEnvVars) Set added in v0.14.3

func (i *PluginEnvVars) Set(str string) error

Set parses the value from the CLI and places it into the internal map. Expected form is pluginName.envName=envValue. If no equals is found or it is the last character ("x.y" or "x.y=") then the env var will be saved internally as the empty string with the meaning that it will be removed from the plugins env vars.

func (*PluginEnvVars) String added in v0.14.3

func (i *PluginEnvVars) String() string

func (*PluginEnvVars) Type added in v0.14.3

func (i *PluginEnvVars) Type() string

type RBACMode added in v0.11.0

type RBACMode string

RBACMode determines whether to enable or disable RBAC for a Sonobuoy run

const (
	// DisableRBACMode means rbac is always disable
	DisableRBACMode RBACMode = "Disable"
	// EnabledRBACMode means rbac is always enabled
	EnabledRBACMode RBACMode = "Enable"
	// DetectRBACMode means "query the server to see if RBAC is enabled"
	DetectRBACMode RBACMode = "Detect"
)

func (*RBACMode) Enabled added in v0.11.0

func (r *RBACMode) Enabled(client kubernetes.Interface) (bool, error)

Enabled retrieves whether to enable or disable rbac. If the mode is disable or enabled, the client is unused. If the mode is "detect", the client will be used to query the server's API groups and detect whether an RBAC api group exists.

func (*RBACMode) Set added in v0.11.0

func (r *RBACMode) Set(str string) error

Set the RBACMode to the given string, or error if it's not a known RBAC mode.

func (*RBACMode) String added in v0.11.0

func (r *RBACMode) String() string

String needed for pflag.Value.

func (*RBACMode) Type added in v0.11.0

func (r *RBACMode) Type() string

Type needed for pflag.Value.

type SonobuoyConfig added in v0.11.0

type SonobuoyConfig struct {
	config.Config
	// contains filtered or unexported fields
}

SonobuoyConfig is a config.Config that implements pflag.Value from a file path

func (*SonobuoyConfig) Get added in v0.11.0

func (c *SonobuoyConfig) Get() *config.Config

Get will return the config.Config.

func (*SonobuoyConfig) Set added in v0.11.0

func (c *SonobuoyConfig) Set(str string) error

Set attempts to read a file, then deserialize the json into a config.Config struct.

func (*SonobuoyConfig) String added in v0.11.0

func (c *SonobuoyConfig) String() string

String is needed for pflag.Value.

func (*SonobuoyConfig) Type added in v0.11.0

func (c *SonobuoyConfig) Type() string

Type is needed for pflag.Value.

type WaitOutputMode added in v0.15.1

type WaitOutputMode string
const (
	SilentOutputMode   WaitOutputMode = "Silent"
	SpinnerOutputMode  WaitOutputMode = "Spinner"
	ProgressOutputMode WaitOutputMode = "Progress"
)

func (*WaitOutputMode) Set added in v0.15.1

func (w *WaitOutputMode) Set(str string) error

Set the WaitOutputMode to the given string, or error if it's not a known WaitOutputMode mode.

func (*WaitOutputMode) String added in v0.15.1

func (w *WaitOutputMode) String() string

String needed for pflag.Value.

func (*WaitOutputMode) Type added in v0.15.1

func (w *WaitOutputMode) Type() string

Type needed for pflag.Value.

Jump to

Keyboard shortcuts

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