Documentation ¶
Index ¶
- type Cli
- func (c *Cli) Apply(ctx context.Context, content []byte, extraArgs ...string) error
- func (c *Cli) ApplyFile(ctx context.Context, fileName string, extraArgs ...string) error
- func (c *Cli) ApplyFilePath(ctx context.Context, filePath string, extraArgs ...string) error
- func (c *Cli) ApplyFileWithOutput(ctx context.Context, fileName string, extraArgs ...string) (string, error)
- func (c *Cli) Command(ctx context.Context, args ...string) cmdutils.Cmd
- func (c *Cli) Copy(ctx context.Context, from, to string) error
- func (c *Cli) CurlFromEphemeralPod(ctx context.Context, podMeta types.NamespacedName, options ...curl.Option) string
- func (c *Cli) CurlFromPod(ctx context.Context, podOpts PodExecOptions, options ...curl.Option) (*CurlResponse, error)
- func (c *Cli) Delete(ctx context.Context, content []byte, extraArgs ...string) error
- func (c *Cli) DeleteFile(ctx context.Context, fileName string, extraArgs ...string) error
- func (c *Cli) DeleteFileSafe(ctx context.Context, fileName string, extraArgs ...string) error
- func (c *Cli) DeleteFileWithOutput(ctx context.Context, fileName string, extraArgs ...string) (string, error)
- func (c *Cli) DeploymentRolloutStatus(ctx context.Context, deployment string, extraArgs ...string) error
- func (c *Cli) Describe(ctx context.Context, namespace string, name string) (string, error)
- func (c *Cli) Execute(ctx context.Context, args ...string) (string, string, error)
- func (c *Cli) ExecuteOn(ctx context.Context, kubeContext string, args ...string) (string, string, error)
- func (c *Cli) GetContainerLogs(ctx context.Context, namespace string, name string) (string, error)
- func (c *Cli) GetPodsInNsWithLabel(ctx context.Context, namespace string, label string) ([]string, error)
- func (c *Cli) Namespaces(ctx context.Context) ([]string, error)
- func (c *Cli) RestartDeployment(ctx context.Context, name string, extraArgs ...string) error
- func (c *Cli) RestartDeploymentAndWait(ctx context.Context, name string, extraArgs ...string) error
- func (c *Cli) RunCommand(ctx context.Context, args ...string) error
- func (c *Cli) Scale(ctx context.Context, namespace string, resource string, replicas uint) error
- func (c *Cli) StartPortForward(ctx context.Context, options ...portforward.Option) (portforward.PortForwarder, error)
- func (c *Cli) WithKubeContext(kubeContext string) *Cli
- func (c *Cli) WithReceiver(receiver io.Writer) *Cli
- type CurlResponse
- type PodExecOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cli ¶
type Cli struct {
// contains filtered or unexported fields
}
Cli is a utility for executing `kubectl` commands
func (*Cli) Apply ¶
Apply applies the resources defined in the bytes, and returns an error if one occurred
func (*Cli) ApplyFile ¶
ApplyFile applies the resources defined in a file, and returns an error if one occurred
func (*Cli) ApplyFilePath ¶
ApplyFilePath applies the resources defined at the file path, and returns an error if one occurred. If filePath is a directory, this will apply all of the files in the directory.
func (*Cli) ApplyFileWithOutput ¶
func (c *Cli) ApplyFileWithOutput(ctx context.Context, fileName string, extraArgs ...string) (string, error)
ApplyFileWithOutput applies the resources defined in a file, if an error occurred, it will be returned along with the output of the command
func (*Cli) Command ¶
Command returns a Cmd that executes kubectl command, including the --context if it is defined The Cmd sets the Stdout and Stderr to the receiver of the Cli
func (*Cli) CurlFromEphemeralPod ¶
func (c *Cli) CurlFromEphemeralPod(ctx context.Context, podMeta types.NamespacedName, options ...curl.Option) string
CurlFromEphemeralPod executes a Curl from a pod, using an ephemeral container to execute the Curl command
func (*Cli) CurlFromPod ¶
func (c *Cli) CurlFromPod(ctx context.Context, podOpts PodExecOptions, options ...curl.Option) (*CurlResponse, error)
CurlFromPod executes a Curl request from the given pod for the given options. It differs from CurlFromEphemeralPod in that it does not use an ephemeral container to execute the Curl command
func (*Cli) Delete ¶
Delete deletes the resources defined in the bytes, and returns an error if one occurred
func (*Cli) DeleteFile ¶
DeleteFile deletes the resources defined in a file, and returns an error if one occurred
func (*Cli) DeleteFileSafe ¶
DeleteFileSafe deletes the resources defined in a file, and returns an error if one occurred This differs from DeleteFile in that we always append --ignore-not-found
func (*Cli) DeleteFileWithOutput ¶
func (c *Cli) DeleteFileWithOutput(ctx context.Context, fileName string, extraArgs ...string) (string, error)
DeleteFileWithOutput deletes the resources defined in a file, if an error occurred, it will be returned along with the output of the command
func (*Cli) DeploymentRolloutStatus ¶
func (c *Cli) DeploymentRolloutStatus(ctx context.Context, deployment string, extraArgs ...string) error
DeploymentRolloutStatus waits for the deployment to complete rolling out
func (*Cli) Describe ¶ added in v1.17.16
Describe the container status (equivalent of running `kubectl describe`)
func (*Cli) GetContainerLogs ¶
GetContainerLogs retrieves the logs for the specified container
func (*Cli) GetPodsInNsWithLabel ¶
func (c *Cli) GetPodsInNsWithLabel(ctx context.Context, namespace string, label string) ([]string, error)
GetPodsInNsWithLabel returns the pods in the specified namespace with the specified label
func (*Cli) Namespaces ¶
Namespaces returns a sorted list of namespaces or an error if one occurred
func (*Cli) RestartDeployment ¶ added in v1.17.5
RestartDeployment restarts a deployment. It does not wait for the deployment to be ready.
func (*Cli) RestartDeploymentAndWait ¶ added in v1.17.5
RestartDeploymentAndWait restarts a deployment and waits for it to become healthy.
func (*Cli) RunCommand ¶
RunCommand creates a Cmd and then runs it
func (*Cli) StartPortForward ¶
func (c *Cli) StartPortForward(ctx context.Context, options ...portforward.Option) (portforward.PortForwarder, error)
StartPortForward creates a PortForwarder based on the provides options, starts it, and returns the PortForwarder If an error was encountered while starting the PortForwarder, it is returned as well NOTE: It is the callers responsibility to close this port-forward
func (*Cli) WithKubeContext ¶
WithKubeContext sets the --context for the kubectl command invoked by the Cli
type CurlResponse ¶
CurlResponse stores the output from a curl, with separate fields for StdErr, which typically contains headers and connection information, and SteOut, which typically contains the response body
type PodExecOptions ¶
PodExecOptions describes the options used to execute a command in a pod