util

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 18 Imported by: 2 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfig

func BuildConfig(master, kubeconfig string) (*rest.Config, error)

BuildConfig builds the configuration file for command lines.

func CaptureOutput added in v1.10.0

func CaptureOutput(r *os.File, oldStdout *os.File) string

CaptureOutput reads from r until EOF and returns the result as a string.

func CreateJobCommand

func CreateJobCommand(ctx context.Context, config *rest.Config, ns, name string, action vcbus.Action) error

CreateJobCommand executes a command such as resume/suspend.

func CreateQueueCommand added in v1.0.0

func CreateQueueCommand(vcClient *versioned.Clientset, ns, name string, action vcbus.Action) error

CreateQueueCommand executes a command such as open/close

func CreateTestServer added in v1.10.0

func CreateTestServer(response interface{}) *httptest.Server

CreateTestServer creates an HTTP server that responds with the given response.

func CreateTestServerWithStatus added in v1.16.0

func CreateTestServerWithStatus(response interface{}, statusCode int) *httptest.Server

CreateTestServerWithStatus creates an HTTP server that responds with the given status code and response.

func HumanDuration

func HumanDuration(d time.Duration) string

HumanDuration translate time.Duration to human readable time string.

func InitFlags

func InitFlags(cmd *cobra.Command, cf *CommonFlags)

InitFlags initializes the common flags for most command lines.

func PopulateResourceListV1

func PopulateResourceListV1(spec string) (v1.ResourceList, error)

PopulateResourceListV1 takes strings of form <resourceName1>=<value1>,<resourceName2>=<value2> and returns ResourceList.

func RedirectStdout added in v1.10.0

func RedirectStdout() (*os.File, *os.File)

RedirectStdout redirects os.Stdout to a pipe and returns the read and write ends of the pipe.

func TranslateTimestampSince

func TranslateTimestampSince(timestamp metav1.Time) string

TranslateTimestampSince translates the time stamp.

Types

type CommonFlags

type CommonFlags struct {
	Master     string
	Kubeconfig string
}

CommonFlags are the flags that most command lines have.

Jump to

Keyboard shortcuts

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