util

package
v0.0.0-...-eef0ea8 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlagBoolP

func AddFlagBoolP(cmd *cobra.Command, flagDetails []byte) *bool

AddFlag for Boolean. Receives cobra references and Json byte array This function returns the command line arguments of bool type

func AddFlagStringP

func AddFlagStringP(cmd *cobra.Command, flagDetails []byte) *string

AddFlag for String. Receives cobra references and Json byte array This function returns the command line arguments of string type

func CmdErrorHandling

func CmdErrorHandling(err error)

CmdErrorHandling receives an error value and gracefully exits in case of exitError

func GetNamespace

func GetNamespace(flags *genericclioptions.ConfigFlags) (string, error)

GetNamespace takes a set of kubectl flag values and returns the namespace we should be operating in

func InVersionRangeInclusive

func InVersionRangeInclusive(start, v string) bool

InVersionRangeInclusive checks that the middle version is between the other two versions

func Indicator

func Indicator(shutdownCh <-chan struct{})

Indicator function receives a channel and keeps printing dots every second to notify background process

func ParseVersionString

func ParseVersionString(v string) (int, int, int, error)

ParseVersionString returns the major, minor, and patch numbers of a version string

func PodInDeployment

func PodInDeployment(pod apiv1.Pod, deployment string) bool

PodInDeployment returns whether a pod is part of a deployment with the given name a pod is considered to be in {deployment} if it is owned by a replicaset with a name of format {deployment}-otherchars

func PrintError

func PrintError(e error)

PrintError receives an error value and prints it if it exists

Types

type CmdFlag

type CmdFlag struct {
	/*************************WARNING*************************
	 * Please make sure to maintain the same name for json   *
	 * elements in this struct and constant/constant.go file *
	 ********************************************************/
	CmdLName    string `json:"CmdLName,omitempty"`
	CmdSName    string `json:"CmdSName,omitempty"`
	DefValueStr string `json:"DefValueStr,omitempty"`
	DefValueB   bool   `json:"DefValueB,omitempty"`
	CmdDesc     string `json:"CmdDesc,omitempty"`
}

Struct CmdFlag for templating cobra command types

Jump to

Keyboard shortcuts

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