app

package
v0.11.5-prerelease.9 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConformanceImageVersionAuto represents detecting the server's kubernetes version.
	ConformanceImageVersionAuto = "auto"
	// ConformanceImageVersionLatest represents always using the server's latest version.
	ConformanceImageVersionLatest = "latest"
)

Variables

View Source
var (
	//ErrImageVersionNoClient is the error returned when we need a client but didn't get on
	ErrImageVersionNoClient = errors.New(`can't use nil client with "auto" image version`)
)
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`)
)
View Source
var GenCommand = &cobra.Command{
	Use:   "gen",
	Short: "Generates a sonobuoy manifest for submission via kubectl",
	Run:   genManifest,
	Args:  cobra.ExactArgs(0),
}

GenCommand is exported so it can be extended.

View Source
var RootCmd = &cobra.Command{
	Use:   "sonobuoy",
	Short: "Generate reports on your kubernetes cluster",
	Long:  "Sonobuoy is an introspective kubernetes component that generates reports on cluster conformance, configuration, and more",
	Run:   rootCmd,
}

RootCmd is the root command that is executed when sonobuoy is run without any subcommands.

Functions

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 AddE2EConfigFlags added in v0.11.0

func AddE2EConfigFlags(flags *pflag.FlagSet) *pflag.FlagSet

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 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

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

AddKubeConformanceImage initialises an image url flag.

func AddKubeConformanceImageVersion added in v0.11.4

func AddKubeConformanceImageVersion(imageVersion *ConformanceImageVersion, flags *pflag.FlagSet, defaultVersion ConformanceImageVersion)

AddKubeConformanceImageVersion initialises an image version flag.

func AddKubeconfigFlag added in v0.11.0

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

AddKubeconfigFlag adds a kubeconfig flag to the provided command.

func AddModeFlag added in v0.11.0

func AddModeFlag(mode *ops.Mode, flags *pflag.FlagSet)

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

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

AddNamespaceFlag initialises a namespace flag.

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 AddSkipPreflightFlag added in v0.11.0

func AddSkipPreflightFlag(flag *bool, 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 E2EFlagSet added in v0.11.0

func E2EFlagSet(cfg *e2eFlags) *pflag.FlagSet

func GenFlagSet added in v0.11.0

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

func GetConfigWithMode added in v0.11.0

func GetConfigWithMode(sonobuoyCfg *SonobuoyConfig, mode client.Mode) *config.Config

GetConfigWithMode creates a config with the following algorithm: If no config is supplied defaults will be returned. If a config is supplied then the default values will be merged into the supplied config in order to allow users to supply a minimal config that will still work.

func GetE2EConfig added in v0.11.0

func GetE2EConfig(mode ops.Mode, flags *pflag.FlagSet) (*ops.E2EConfig, error)

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 RunFlagSet added in v0.11.0

func RunFlagSet(cfg *runFlags) *pflag.FlagSet

func ValidPullPolicies added in v0.11.0

func ValidPullPolicies() []string

Types

type ConformanceImageVersion added in v0.11.4

type ConformanceImageVersion string

ConformanceImageVersion represents the version of a conformance image, or "auto" to detect the version

func (*ConformanceImageVersion) Get added in v0.11.4

Get retrieves the preset version if there is one, or queries client if the ConformanceImageVersion is set to `auto`. kubernetes.Interface.Discovery() provides ServerVersionInterface. don't require the entire kubernetes.Interface to simplify the required test mocks

func (*ConformanceImageVersion) Set added in v0.11.4

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

Set the ImageVersion to either the string "auto" or a version string

func (*ConformanceImageVersion) String added in v0.11.4

func (c *ConformanceImageVersion) String() string

String needed for pflag.Value.

func (*ConformanceImageVersion) Type added in v0.11.4

func (c *ConformanceImageVersion) Type() string

Type needed for pflag.Value.

type GenPluginConfig added in v0.11.4

type GenPluginConfig struct {
	Paths      []string
	PluginName string
}

GenPluginConfig 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
}

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 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 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.

Jump to

Keyboard shortcuts

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