utils

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIntermediateDirsForFile

func CreateIntermediateDirsForFile(ctx context.Context, filePath string)

Creates intermediate directories which don't exist for the given file path.

func ExecuteCommand

func ExecuteCommand(command string) (string, error)

Executes the given command. Doesn't panic and returns error (if occurred).

func ExecuteCommandOrDie

func ExecuteCommandOrDie(command string) string

Executes the given command. Panics if the command execution fails.

func GetClusterDir

func GetClusterDir() string

Returns path to the directory containing cluster specific config, in the KubeAid Config dir.

func GetDownloadedStorageBucketContentsDir

func GetDownloadedStorageBucketContentsDir(bucketName string) string

Returns the path to the local temp directory, where contents of the given blob storage bucket will be / is downloaded.

func GetEnv

func GetEnv(name string) string

Returns value of the given environment variable. Panics if the environment variable isn't found.

func GetKubeAidConfigDir

func GetKubeAidConfigDir() string

Returns path to the directory (in temp directory), where the customer's KubeAid Config repo is / will be cloned.

func GetKubeAidDir

func GetKubeAidDir() string

Returns path to the directory (in temp directory), where the KubeAid repo is / will be cloned.

func GetParentDirPath

func GetParentDirPath(filePath string) string

Returns path to the parent dir of the given file.

func InitTempDir

func InitTempDir()

Creates a temp dir inside /tmp, where KubeAid Bootstrap Script will clone repos. Then sets the value of constants.TempDir as the temp dir path. If the temp dir already exists, then that gets reused.

func MustSetEnv added in v0.8.0

func MustSetEnv(name, value string)

Sets value of the given environment variable. Panics on error.

func ToAbsolutePath added in v0.8.0

func ToAbsolutePath(ctx context.Context, relativePath string) string

Converts the given relative path to an absolute path.

func WithRetry added in v0.8.0

func WithRetry(delay time.Duration, attempts uint8, fn func() error) error

func WrapError

func WrapError(contextualErrorMessage string, err error) error

Returns a new error which contains some contextual error message along with the original error message.

Types

This section is empty.

Directories

Path Synopsis
k3d

Jump to

Keyboard shortcuts

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