util

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultImageTag = "latest"
)

Variables

View Source
var (
	DefaultCmdRunner = &cmdRunner{}
)
View Source
var TitleSprint = color.New(color.FgHiWhite).SprintFunc()

Functions

func ConsolePrinter

func ConsolePrinter(msg string)

func FileExists

func FileExists(filename string) (bool, error)

FileExists checks if specified file exists.

func GetImageId

func GetImageId(image string, imageId string) string

func GetNamespaceSets

func GetNamespaceSets(nsInclude string, nsExclude string) (sets.String, sets.String)

func IsNamespaceIncluded

func IsNamespaceIncluded(namespace string, nsInclude sets.String, nsExclude sets.String) bool

func ParseImageName

func ParseImageName(image string) (string, string, string, error)

ParseImageName parses a docker image string into three parts: repo, tag and digest. If both tag and digest are empty, a default image tag will be returned.

func ReadObjectList

func ReadObjectList(r io.Reader) ([]runtime.Object, error)

func ReadObjectsFromFile

func ReadObjectsFromFile(filename string) ([]runtime.Object, error)

func ReadYamlManifest

func ReadYamlManifest(r io.Reader) ([]runtime.Object, error)

func WriteFile

func WriteFile(outfile string, data string) error

Types

type CmdRunner

type CmdRunner interface {
	Environ() []string
	LookPath(string) (string, error)
	RunCmd(cmd *exec.Cmd) ([]byte, error)
	TempFile(dir, pattern string) (File, error)
	Remove(name string) error
}

CmdRunner the cmdRunner to the outside "world". Wraps methods that modify global state and hence make the code that use them very hard to test.

type File

type File interface {
	Name() string
	Read([]byte) (int, error)
}

Jump to

Keyboard shortcuts

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