utils

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: AGPL-3.0 Imports: 17 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 EnsureRuntimeDependenciesInstalled added in v0.12.0

func EnsureRuntimeDependenciesInstalled(ctx context.Context)

Determines the runtime dependencies required by KubeAid Bootstrap Script, based on the cloud-provider being used. Panics if any of them are not found in PATH.

func EnsureRuntimeDependencyInstalled added in v0.12.2

func EnsureRuntimeDependencyInstalled(ctx context.Context, name string)

Panics if the given runtime dependency / executable isn't found in PATH.

func ExecuteCommand

func ExecuteCommand(command string) (string, error)

Executes the given command. The command output is streamed to the standard output.

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 GetParentDirPath

func GetParentDirPath(filePath string) string

Returns path to the parent dir of the given file.

func InitKnownHostsDir added in v0.15.2

func InitKnownHostsDir(ctx context.Context)

func InitTempDir

func InitTempDir(ctx context.Context)

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 MustGetEnv added in v0.12.0

func MustGetEnv(name string) string

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

func MustMoveFile added in v0.12.1

func MustMoveFile(ctx context.Context, sourceFilePath, destinationFilePath string)

Moves the source file to the destination file.

But unlike os.Rename( ), it doesn't error out when the source and destination files are present on different drives.

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