cmdreporter

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CmdReporterContainerName defines the name of the CmdReporter container which runs the
	// 'rook cmd-reporter' command.
	CmdReporterContainerName = "cmd-reporter"

	// CopyBinariesInitContainerName defines the name of the CmdReporter init container which copies
	// the 'rook' and 'tini' binaries.
	CopyBinariesInitContainerName = "init-copy-binaries"

	// CopyBinariesMountDir defines the dir into which the 'rook' and 'tini' binaries will be copied
	// in the CmdReporter job pod's containers.
	CopyBinariesMountDir = "/rook/copied-binaries"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdReporter

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

CmdReporter is a wrapper for Rook's cmd-reporter commandline utility allowing operators to use the utility without fully specifying the job, pod, and container templates manually.

func New

func New(
	clientset kubernetes.Interface,
	ownerRef *metav1.OwnerReference,
	appName, jobName, jobNamespace string,
	cmd, args []string,
	rookImage, runImage string,
) (*CmdReporter, error)

New creates a new CmdReporter.

All parameters must be set with the exception of the arg list which is allowed to be empty.

The common app label will be applied to the job and pod specs which CmdReporter creates identified by the app name specified. The job and the configmap which returns the result of the job will be identified with the job name specified. Everything will be created in the job namespace and will be owned by the owner reference given.

The Rook image defines the Rook image from which the 'rook' and 'tini' binaries will be taken in order to run the cmd and args in the run image. If the run image is the same as the Rook image, then the command will run without the binaries being copied from the same Rook image.

func (*CmdReporter) Job

func (cr *CmdReporter) Job() *batch.Job

Job returns a pointer to the basic, filled-out Kubernetes job which will run the CmdReporter. The operator may add additional information to this spec, such as labels, environment variables, volumes, volume mounts, etc. before the CmdReporter is run.

func (*CmdReporter) Run

func (cr *CmdReporter) Run(timeout time.Duration) (stdout, stderr string, retcode int, retErr error)

Run runs the Kubernetes job and waits for the output ConfigMap. It returns the stdout, stderr, and retcode of the command as long as the image ran it, even if the retcode is nonzero (failure). An error is reported only if the command was not run to completion successfully. When this returns, the ConfigMap is cleaned up (destroyed).

Jump to

Keyboard shortcuts

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