cmd

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Sensitive = []string{
	"HOME",
}

Sensitive is a list of sensitive environment variable to replace into the help outputs.

Functions

func NewCompletionCmd

func NewCompletionCmd(_ *ConfigOptions, _ *RootOptions, _ *pflag.FlagSet) *cobra.Command

NewCompletionCmd ...

func NewDockerCmd

func NewDockerCmd(configOpts *ConfigOptions, rootOpts *RootOptions, rootFlags *pflag.FlagSet) *cobra.Command

NewDockerCmd creates the `driverkit docker` command.

func NewImagesCmd added in v0.12.0

func NewImagesCmd(configOpts *ConfigOptions, rootOpts *RootOptions, rootFlags *pflag.FlagSet) *cobra.Command

NewImagesCmd creates the `driverkit images` command.

func NewKubernetesCmd

func NewKubernetesCmd(configOpts *ConfigOptions, rootOpts *RootOptions, rootFlags *pflag.FlagSet) *cobra.Command

NewKubernetesCmd creates the `driverkit kubernetes` command.

func NewKubernetesInClusterCmd added in v0.9.7

func NewKubernetesInClusterCmd(configOpts *ConfigOptions, rootOpts *RootOptions, rootFlags *pflag.FlagSet) *cobra.Command

NewKubernetesInClusterCmd creates the `driverkit kubernetes` command.

func NewLocalCmd added in v0.16.0

func NewLocalCmd(configOpts *ConfigOptions, rootOpts *RootOptions, rootFlags *pflag.FlagSet) *cobra.Command

NewLocalCmd creates the `driverkit local` command.

func RootOptionsLevelValidation

func RootOptionsLevelValidation(level validator.StructLevel)

RootOptionsLevelValidation validates KernelConfigData and Target at the same time.

It reports an error when `KernelConfigData` is empty and `Target` is `vanilla`.

func Start

func Start()

Start creates the root command and runs it.

Types

type ConfigOptions

type ConfigOptions struct {
	Timeout  int    `validate:"number,min=30" default:"120" name:"timeout"`
	ProxyURL string `validate:"omitempty,proxy" name:"proxy url"`

	// Printer used by all commands to output messages.
	Printer *output.Printer
	// contains filtered or unexported fields
}

ConfigOptions represent the persistent configuration flags of driverkit.

func NewConfigOptions

func NewConfigOptions() (*ConfigOptions, error)

NewConfigOptions creates an instance of ConfigOptions.

func (*ConfigOptions) AddFlags added in v0.19.0

func (co *ConfigOptions) AddFlags(flags *pflag.FlagSet)

AddFlags registers the common flags.

func (*ConfigOptions) Init added in v0.19.0

func (co *ConfigOptions) Init() bool

Init reads in config file and ENV variables if set.

type KubeOptions added in v0.9.7

type KubeOptions struct {
	RunAsUser       int64  `json:"runAsUser,omitempty" protobuf:"varint,2,opt,name=runAsUser" default:"0"`
	Namespace       string `validate:"required" name:"namespace" default:"default"`
	ImagePullSecret string `validate:"omitempty" name:"image-pull-secret" default:""`
}

type OutputOptions

type OutputOptions struct {
	Module string `validate:"required_without=Probe,filepath,omitempty,endswith=.ko" name:"output module path"`
	Probe  string `validate:"required_without=Module,filepath,omitempty,endswith=.o" name:"output probe path"`
}

OutputOptions wraps the two drivers that driverkit builds.

func (*OutputOptions) HasOutputs added in v0.19.0

func (oo *OutputOptions) HasOutputs() bool

type Registry added in v0.14.0

type Registry struct {
	Name      string `validate:"required_with=Username Password" name:"registry name"`
	Username  string `validate:"required_with=Registry Password" name:"registry username"`
	Password  string `validate:"required_with=Username Registry" name:"registry password"`
	PlainHTTP bool   `default:"false" name:"registry plain http"`
}

type RepoOptions added in v0.10.0

type RepoOptions struct {
	Org  string `default:"falcosecurity" name:"organization name"`
	Name string `default:"libs" name:"repo name"`
}

type RootCmd

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

RootCmd wraps the main cobra.Command.

func NewRootCmd

func NewRootCmd(configOpts *ConfigOptions, rootOpts *RootOptions) *RootCmd

NewRootCmd instantiates the root command.

func (*RootCmd) Command

func (r *RootCmd) Command() *cobra.Command

Command returns the underlying cobra.Command.

func (*RootCmd) Execute

func (r *RootCmd) Execute() error

Execute proxies the cobra.Command execution.

func (*RootCmd) SetArgs

func (r *RootCmd) SetArgs(args []string)

SetArgs proxies the arguments to the underlying cobra.Command.

func (*RootCmd) SetOutput

func (r *RootCmd) SetOutput(w io.Writer)

SetOutput sets the main command output writer.

func (*RootCmd) StripSensitive

func (r *RootCmd) StripSensitive()

StripSensitive removes sensistive info from default values printed into the help messages.

type RootOptions

type RootOptions struct {
	Architecture     string   `validate:"required,architecture" name:"architecture"`
	DriverVersion    string   `default:"master" validate:"eq=master|sha1|semver" name:"driver version"`
	KernelVersion    string   `default:"1" validate:"omitempty" name:"kernel version"`
	ModuleDriverName string   `default:"falco" validate:"max=60" name:"kernel module driver name"`
	ModuleDeviceName string   `default:"falco" validate:"excludes=/,max=255" name:"kernel module device name"`
	KernelRelease    string   `validate:"required,ascii" name:"kernel release"`
	Target           string   `validate:"required,target" name:"target"`
	KernelConfigData string   `validate:"omitempty,base64" name:"kernel config data"` // fixme > tag "name" does not seem to work when used at struct level, but works when used at inner level
	BuilderImage     string   `validate:"omitempty,imagename" name:"builder image"`
	BuilderRepos     []string `` /* 205-byte string literal not displayed */
	GCCVersion       string   `validate:"omitempty,semvertolerant" name:"gcc version"`
	KernelUrls       []string `name:"kernel header urls"`
	Repo             RepoOptions
	Output           OutputOptions
	Registry         Registry
}

RootOptions ...

func NewRootOptions

func NewRootOptions() (*RootOptions, error)

NewRootOptions ...

func (*RootOptions) AddFlags added in v0.19.0

func (ro *RootOptions) AddFlags(flags *pflag.FlagSet, targets []string)

func (*RootOptions) Log

func (ro *RootOptions) Log(printer *output.Printer)

Log emits a log line containing the receiving RootOptions for debugging purposes.

Call it only after validation.

func (*RootOptions) ToBuild added in v0.15.0

func (ro *RootOptions) ToBuild(printer *output.Printer) *builder.Build

func (*RootOptions) Validate

func (ro *RootOptions) Validate() []error

Validate validates the RootOptions fields.

Jump to

Keyboard shortcuts

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