Documentation ¶
Index ¶
- Variables
- func AddDeleteAllFlag(flag *bool, flags *pflag.FlagSet)
- func AddDeleteWaitFlag(flag *int, flags *pflag.FlagSet)
- func AddE2EConfigFlags(flags *pflag.FlagSet) *pflag.FlagSet
- func AddE2ERegistryConfigFlag(cfg *string, flags *pflag.FlagSet)
- func AddImagePullPolicyFlag(policy *ImagePullPolicy, flags *pflag.FlagSet)
- func AddKubeConformanceImage(image *string, flags *pflag.FlagSet)
- func AddKubeConformanceImageVersion(imageVersion *image.ConformanceImageVersion, flags *pflag.FlagSet)
- func AddKubeconfigFlag(cfg *Kubeconfig, flags *pflag.FlagSet)
- func AddModeFlag(mode *ops.Mode, flags *pflag.FlagSet)
- func AddNamespaceFlag(str *string, flags *pflag.FlagSet)
- func AddPluginEnvFlag(p *PluginEnvVars, flags *pflag.FlagSet)
- func AddPluginFlag(cfg *string, flags *pflag.FlagSet)
- func AddPluginSetFlag(p *pluginList, flags *pflag.FlagSet)
- func AddRBACModeFlags(mode *RBACMode, flags *pflag.FlagSet, defaultMode RBACMode)
- func AddRunWaitFlag(flag *int, flags *pflag.FlagSet)
- func AddSSHKeyPathFlag(path *string, flags *pflag.FlagSet)
- func AddSSHUserFlag(user *string, flags *pflag.FlagSet)
- func AddShortFlag(flag *bool, flags *pflag.FlagSet)
- func AddShowDefaultPodSpecFlag(flag *bool, flags *pflag.FlagSet)
- func AddSkipPreflightFlag(flag *bool, flags *pflag.FlagSet)
- func AddSonobuoyConfigFlag(cfg *SonobuoyConfig, flags *pflag.FlagSet)
- func AddSonobuoyImage(image *string, flags *pflag.FlagSet)
- func AddTimeoutFlag(flag *int, flags *pflag.FlagSet)
- func AddWaitOutputFlag(mode *WaitOutputMode, flags *pflag.FlagSet, defaultMode WaitOutputMode)
- func E2EFlagSet(cfg *e2eFlags) *pflag.FlagSet
- func GenFlagSet(cfg *genFlags, rbac RBACMode) *pflag.FlagSet
- func GetE2EConfig(mode ops.Mode, flags *pflag.FlagSet) (*ops.E2EConfig, error)
- func NewCmdAggregator() *cobra.Command
- func NewCmdDelete() *cobra.Command
- func NewCmdE2E() *cobra.Command
- func NewCmdGen() *cobra.Command
- func NewCmdGenConfig() *cobra.Command
- func NewCmdGenPluginDef() *cobra.Command
- func NewCmdImages() *cobra.Command
- func NewCmdLogs() *cobra.Command
- func NewCmdResults() *cobra.Command
- func NewCmdRetrieve() *cobra.Command
- func NewCmdRun() *cobra.Command
- func NewCmdStatus() *cobra.Command
- func NewCmdVersion() *cobra.Command
- func NewCmdWorker() *cobra.Command
- func NewSonobuoyCommand() *cobra.Command
- func RunFlagSet(cfg *runFlags) *pflag.FlagSet
- func ValidPullPolicies() []string
- type EnvVars
- type GenPluginDefConfig
- type ImagePullPolicy
- type Kubeconfig
- type PluginEnvVars
- type RBACMode
- type SonobuoyConfig
- type WaitOutputMode
Examples ¶
Constants ¶
This section is empty.
Variables ¶
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 AddDeleteAllFlag ¶ added in v0.11.0
AddDeleteAllFlag adds a boolean flag for deleting everything (including E2E tests).
func AddDeleteWaitFlag ¶ added in v0.14.0
AddDeleteWaitFlag adds a boolean flag for waiting for the delete process to complete.
func AddE2EConfigFlags ¶ added in v0.11.0
AddE2EConfigFlags adds three arguments: --e2e-focus, --e2e-skip and --e2e-parallel. These are not taken as pointers, as they are only used by GetE2EConfig. Instead, they are returned as a Flagset which should be passed to GetE2EConfig. The returned flagset will be added to the passed in flag set.
e2e-parallel is added as a hidden flag that should only be used by "power" users. Using e2e-parallel incorrectly has the potential to destroy clusters!
func AddE2ERegistryConfigFlag ¶ added in v0.14.0
AddE2ERegistryConfigFlag adds a e2eRegistryConfigFlag flag to the provided command.
func AddImagePullPolicyFlag ¶ added in v0.11.0
func AddImagePullPolicyFlag(policy *ImagePullPolicy, flags *pflag.FlagSet)
AddImagePullPolicyFlag adds a boolean flag for deleting everything (including E2E tests).
func AddKubeConformanceImage ¶ added in v0.11.0
AddKubeConformanceImage initialises an image url flag.
func AddKubeConformanceImageVersion ¶ added in v0.11.4
func AddKubeConformanceImageVersion(imageVersion *image.ConformanceImageVersion, 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 AddModeFlag ¶ added in v0.11.0
AddModeFlag initialises a mode flag. The mode is a preset configuration of sonobuoy configuration and e2e configuration variables. Mode can be partially or fully overridden by specifying config, e2e-focus, and e2e-skip. The variables specified by those flags will overlay the defaults provided by the given mode.
func AddNamespaceFlag ¶ added in v0.11.0
AddNamespaceFlag initialises a namespace flag.
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 AddPluginFlag ¶ added in v0.14.0
AddPluginFlag describes which plugin's images to interact with
func AddPluginSetFlag ¶ added in v0.14.2
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
AddRBACModeFlags adds an E2E Argument with the provided default.
func AddRunWaitFlag ¶ added in v0.14.0
AddRunWaitFlag adds an int flag for waiting for the entire run to finish.
func AddSSHKeyPathFlag ¶ added in v0.12.0
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 AddSSHUserFlag ¶ added in v0.12.0
AddSSHUserFlag initialises an SSH user flag. Used by the container when enabling E2E tests which require SSH.
func AddShortFlag ¶ added in v0.14.0
AddShortFlag adds a boolean flag to just print the Sonobuoy version and nothing else. Useful in scripts.
func AddShowDefaultPodSpecFlag ¶ added in v0.15.2
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
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
AddSonobuoyImage initialises an image url flag.
func AddTimeoutFlag ¶ added in v0.14.2
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 E2EFlagSet ¶ added in v0.11.0
func GenFlagSet ¶ added in v0.11.0
func GetE2EConfig ¶ added in v0.11.0
GetE2EConfig gets the E2EConfig from the mode, then overrides them with e2e-focus, e2e-skip and e2e-parallel if they are provided. We can't rely on the zero value of the flags, as "" is a valid focus, skip or parallel value.
func NewCmdAggregator ¶ added in v0.15.3
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 NewCmdGenConfig ¶ added in v0.14.2
NewCmdGenConfig creates the `config` command which will print out the default sonobuoy config in a json format.
func NewCmdGenPluginDef ¶ added in v0.14.2
NewCmdGenPluginDef ...
func NewCmdImages ¶ added in v0.14.0
func NewCmdLogs ¶ added in v0.14.0
func NewCmdResults ¶ added in v0.15.1
Example ¶
cmd := NewCmdResults() cmd.SetArgs([]string{filepath.Join("testdata", "testResultsOutput.tar.gz")}) 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 (Detailed) ¶
cmd := NewCmdResults() cmd.SetArgs([]string{ filepath.Join("testdata", "testResultsOutput.tar.gz"), "--mode", "detailed", }) 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 (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 NewCmdStatus ¶ added in v0.14.0
func NewCmdVersion ¶ added in v0.14.0
func NewCmdWorker ¶ added in v0.14.0
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 RunFlagSet ¶ added in v0.11.0
func ValidPullPolicies ¶ added in v0.11.0
func ValidPullPolicies() []string
Types ¶
type EnvVars ¶ added in v0.14.2
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 PluginEnvVars ¶ added in v0.14.3
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
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
Set the RBACMode to the given string, or error if it's not a known RBAC mode.
type SonobuoyConfig ¶ added in v0.11.0
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 if one is available, otherwise nil.
func (*SonobuoyConfig) Set ¶ added in v0.11.0
func (c *SonobuoyConfig) Set(str string) error
Set attempts to read a file, then deserialise 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" )
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.