Documentation
¶
Overview ¶
Package kubectl executes various kubectl sub-commands in a forked shell
Package kubectl executes various kubectl sub-commands in a forked shell
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyCommand ¶
type ApplyCommand struct {
// contains filtered or unexported fields
}
ApplyCommand is a Kubectl sub-command that recursively applies all the YAML files it finds in a directory.
func (*ApplyCommand) Build ¶
func (c *ApplyCommand) Build() (buildDir string)
Build executes the Kustomize command with all its arguments and returns the output.
func (*ApplyCommand) DryRun ¶
DryRun executes the Kubectl command as a dry run and returns the output without making any changes to the cluster.
func (*ApplyCommand) Run ¶
Run executes the Kubectl command with all its arguments and returns the output.
func (*ApplyCommand) WithLogger ¶
WithLogger sets the Logger the command should use to log actions if passed a Logger that is not nil.
type BuildCommand ¶
type BuildCommand struct {
// contains filtered or unexported fields
}
BuildCommand is a kustomize sub-command that processes a kustomization.yaml file.
func (*BuildCommand) Build ¶
func (c *BuildCommand) Build() (buildDir string)
Build executes the Kustomize command with all its arguments and returns the output.
func (*BuildCommand) DryRun ¶
DryRun executes the Kubectl command as a dry run and returns the output without making any changes to the cluster.
func (*BuildCommand) Run ¶
Run executes the Kubectl command with all its arguments and returns the output.
func (*BuildCommand) WithLogger ¶
WithLogger sets the Logger the command should use to log actions if passed a Logger that is not nil.
type Command ¶
type Command interface {
Run() (output []byte, err error)
Build() (buildDir string)
DryRun() (output []byte, err error)
WithLogger(logger logr.Logger) (self Command)
// contains filtered or unexported methods
}
Command defines an interface for commands created by the Kubectl factory type.
type CommandFactory ¶
type CommandFactory struct {
// contains filtered or unexported fields
}
CommandFactory is a concrete Factory implementation of the Kubectl interface's API.
func (*CommandFactory) Apply ¶
func (f *CommandFactory) Apply(path string) (c Command)
Apply instantiates an ApplyCommand instance using the provided directory path.
func (*CommandFactory) Build ¶
func (f *CommandFactory) Build(path string) (c Command)
Build instantiates an BuildCommand instance using the provided directory path.
func (*CommandFactory) Delete ¶
func (f *CommandFactory) Delete(args ...string) (c Command)
Delete instantiates a DeleteCommand instance for the described Kubernetes resource.
func (*CommandFactory) Get ¶
func (f *CommandFactory) Get(args ...string) (c Command)
Get instantiates a GetCommand instance for the described Kubernetes resource
type DeleteCommand ¶
type DeleteCommand struct {
// contains filtered or unexported fields
}
DeleteCommand implements the Command interface to delete resources from the KubeAPI service.
func (*DeleteCommand) Build ¶
func (c *DeleteCommand) Build() (buildDir string)
Build executes the Kustomize command with all its arguments and returns the output.
func (*DeleteCommand) DryRun ¶
DryRun executes the Kubectl command as a dry run and returns the output without making any changes to the cluster.
func (*DeleteCommand) Run ¶
Run executes the Kubectl command with all its arguments and returns the output.
func (*DeleteCommand) WithLogger ¶
WithLogger sets the Logger the command should use to log actions if passed a Logger that is not nil.
type ExecProvider ¶
type ExecProvider interface {
FileExists(filePath string) bool
FindOnPath(file string) (string, error)
ExecCmd(name string, arg ...string) ([]byte, error)
}
ExecProvider interface defines functions Kubectl uses to verify and execute a local command.
type GetCommand ¶
type GetCommand struct {
// contains filtered or unexported fields
}
GetCommand implements the Command interface to delete resources from the KubeAPI service
func (*GetCommand) Build ¶
func (c *GetCommand) Build() (buildDir string)
Build executes the Kustomize command with all its arguments and returns the output.
func (*GetCommand) DryRun ¶
DryRun executes the Kubectl command as a dry run and returns the output without making any changes to the cluster.
func (*GetCommand) Run ¶
Run executes the Kubectl command with all its arguments and returns the output.
func (*GetCommand) WithLogger ¶
WithLogger sets the Logger the command should use to log actions if passed a Logger that is not nil.
type Kubectl ¶
type Kubectl interface {
Apply(path string) (c Command)
Delete(args ...string) (c Command)
Get(args ...string) (c Command)
}
Kubectl is a Factory interface that returns concrete Command implementations from named constructors.