devutil

package
v0.0.0-...-ac83263 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserHomeDir string
	GoPathDir   string
	GoBinDir    string
)

Functions

func CheckProcessRunning

func CheckProcessRunning(pidPath string) (found bool, pid int, err error)

func CopyAllFiles

func CopyAllFiles(srcDir, destDir string) error

CopyAllFiles copies all files from srcDir to the destDir

func CopyFile

func CopyFile(srcPath, dstPath string) error
func CopySymLink(source, dest string) error

func CreateIfNotExists

func CreateIfNotExists(dir string, perm os.FileMode) error

func CreateKubeClient

func CreateKubeClient(ctx context.Context, kubeConfigPath string) (client *kubernetes.Clientset, err error)

func CreateNamespace

func CreateNamespace(ctx context.Context, client kubernetes.Interface, name string) (err error)

func CreateUpdateDummyApp

func CreateUpdateDummyApp(ctx context.Context, client kubernetes.Interface, shootNamespace, appName string, numReplicas int) error

func DirExists

func DirExists(dirpath string) bool

func Exists

func Exists(filePath string) bool

func FileExists

func FileExists(filepath string) bool

func FindAndKillProcess

func FindAndKillProcess(ctx context.Context, name string) (pids []int, err error)

func FindAndKillProcesses

func FindAndKillProcesses(ctx context.Context, names ...string) (allPids []int, err error)

func FindPidsByName

func FindPidsByName(ctx context.Context, name string) (pids []int, err error)

func GetGoSourceDir

func GetGoSourceDir(relProjDir string) string

func GoBuild

func GoBuild(ctx context.Context, projDir, mainFile, binPath string, skipBuild bool) error

GoBuild invokes `go build -o binPath -v -buildvcs=true mainFile` within the given projDir

func GoInstall

func GoInstall(ctx context.Context, toolPathWithVersion string) error

GoInstall invokes `go install toolPathWithVersion`

func InvokeCommand

func InvokeCommand(cmd *exec.Cmd) (capturedOutput string, err error)

func InvokeCommandAndCaptureOutput

func InvokeCommandAndCaptureOutput(cmd *exec.Cmd, outPath string) (err error)

func LaunchBackgroundCommand

func LaunchBackgroundCommand(cmd *exec.Cmd, logPath string, pidPath string) error

func LaunchCommand

func LaunchCommand(cmd *exec.Cmd, logPath string, pidPath string, cancel context.CancelFunc) error

func LoadDeployemntYAML

func LoadDeployemntYAML(filepath string) (deployment appsv1.Deployment, err error)

func PKill

func PKill(ctx context.Context, names ...string) error

func Pgrep

func Pgrep(ctx context.Context, name string) (pids []string)

func ReadJson

func ReadJson[T any](jpath string) (obj T, err error)

func ReadJsonInto

func ReadJsonInto[T any](jpath string, obj *T) (err error)

func ReadPidPath

func ReadPidPath(pidPath string) (found bool, pid int, err error)

func WaitForSignalAndShutdown

func WaitForSignalAndShutdown(ctx context.Context, cancelFunc context.CancelFunc)

func WriteJson

func WriteJson(jpath string, obj any) error

Types

type ClusterCoordinate

type ClusterCoordinate struct {
	Landscape string
	Project   string
	Shoot     string
}

type ClusterInfo

type ClusterInfo struct {
	ClusterCoordinate
	ShootNamespace string
}

type GardenCtl

type GardenCtl struct {
	Coordinate ClusterCoordinate
}

func NewGardenCtl

func NewGardenCtl(coord ClusterCoordinate) *GardenCtl

func (*GardenCtl) ExecuteCommandOnPlane

func (g *GardenCtl) ExecuteCommandOnPlane(ctx context.Context, plane GardenerPlane, kubectlCommand string) (capturedOut string, err error)

func (*GardenCtl) GetKubeConfigPath

func (g *GardenCtl) GetKubeConfigPath(ctx context.Context, plane GardenerPlane) (kubeConfigPath string, err error)

func (*GardenCtl) GetShootNamespace

func (g *GardenCtl) GetShootNamespace(ctx context.Context) (shootNamespace string, err error)

type GardenerPlane

type GardenerPlane int
const (
	DataPlane    GardenerPlane = 0
	ControlPlane GardenerPlane = 1
)

Jump to

Keyboard shortcuts

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