utils

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIntermediateDirsForFile

func CreateIntermediateDirsForFile(filePath string) error

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

func EnsureRuntimeDependencyInstalled added in v0.12.2

func EnsureRuntimeDependencyInstalled(_ context.Context, name string) error

Returns an error if the given runtime dependency / executable isn't found in PATH.

func FetchJSON added in v0.23.0

func FetchJSON(url string, dest any) error

FetchJSON performs an HTTP GET and decodes the JSON response into the provided destination.

func FetchURLBytes added in v0.23.0

func FetchURLBytes(url string) ([]byte, error)

fetchURLBytes performs an HTTP GET and returns the raw response body bytes.

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 GetKubeAidConfigDir

func GetKubeAidConfigDir() string

Returns path to the directory where the KubeAid Config repository is cloned.

func GetKubeAidDir

func GetKubeAidDir() string

Returns path to the directory where the KubeAid repository is cloned.

func GetParentDirPath

func GetParentDirPath(filePath string) string

Returns path to the parent dir of the given file.

func InitTempDir

func InitTempDir(ctx context.Context) error

InitTempDir creates the temp dir where KubeAid Bootstrap Script will clone repos. If the dir already exists it is reused.

func IsCGroupV2 added in v0.21.0

func IsCGroupV2() bool

Returns whether the CGroup version on the host machine is 2.

func MoveFile added in v0.23.0

func MoveFile(src, dst string) (err error)

MoveFile moves the source file to the destination file. It first tries os.Rename (atomic on the same filesystem); on failure it falls back to copy + delete, which works across filesystems too.

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 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(p string) (string, error)

ToAbsolutePath returns the canonical version of the given path. A bare "~" or a "~/" prefix is expanded to the user's home directory. REFER : https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html.

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
Package giturl is a tiny, dependency-free predicate package for classifying Git remote URL forms (HTTP(s) vs SSH).
Package giturl is a tiny, dependency-free predicate package for classifying Git remote URL forms (HTTP(s) vs SSH).
k3d
Package randval generates random secret values used across kubeaid-cli — alphanumeric passwords for OIDC client secrets and Keycloak admin credentials, plus base64-encoded byte keys for symmetric crypto (e.g.
Package randval generates random secret values used across kubeaid-cli — alphanumeric passwords for OIDC client secrets and Keycloak admin credentials, plus base64-encoded byte keys for symmetric crypto (e.g.

Jump to

Keyboard shortcuts

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