helper

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTPTimeout is a timeout for HTTP requests.
	HTTPTimeout = 30 * time.Second
)
View Source
const (
	// RootAnnoName is prefix for all kubedog annotations.
	RootAnnoName = "helmwave.app/"
)

Variables

View Source
var (
	// Helm is an instance of helm CLI.
	Helm = helm.New()

	// HelmRegistryClient  is an instance of helm registry client.
	HelmRegistryClient *registry.Client
)

Functions

func Byte added in v0.12.0

func Byte(_ context.Context, in any) []byte

Byte marshals input to YAML and returns YAML byte slice.

func Contains

func Contains(t string, a []string) bool

Contains checks whether string exists in string slice.

func ContextGetLifecycleType added in v0.29.0

func ContextGetLifecycleType(ctx context.Context) (string, bool)

func ContextGetReleaseUniq added in v0.29.0

func ContextGetReleaseUniq(ctx context.Context) (uniqname.UniqName, bool)

func ContextWithLifecycleType added in v0.29.0

func ContextWithLifecycleType(ctx context.Context, typ string) context.Context

func ContextWithReleaseUniq added in v0.29.0

func ContextWithReleaseUniq(ctx context.Context, name uniqname.UniqName) context.Context

func CopyFile added in v0.25.0

func CopyFile(src, dest string) error

CopyFile copy file to dest. Destination is either file or dir.

func CreateFile

func CreateFile(p string) (*os.File, error)

CreateFile creates recursively basedir of file and returns created file object.

func Download added in v0.12.0

func Download(ctx context.Context, file, uri string) error

Download downloads uri to file.

func GetKubernetesVersion added in v0.30.1

func GetKubernetesVersion(cfg *action.Configuration) (*version.Info, error)

GetKubernetesVersion returns kubernetes server version.

func In added in v0.20.0

func In[T any, C EqualChecker[T]](search C, target []T) bool

In returns whether `search` appears in `target` slice.

func IsExists added in v0.12.0

func IsExists(s string) bool

IsExists return true if file exists.

func IsURL added in v0.12.0

func IsURL(str string) bool

IsURL reports whether provided string is a valid URL.

func KubeInit added in v0.17.0

func KubeInit(kubecontext string) (err error)

KubeInit init kubeconfig for kubedog.

func MoveFile added in v0.24.0

func MoveFile(src, dst string) error

MoveFile moves files or directories. It also handles move between different mounts (copy + rm).

func NewCfg added in v0.12.2

func NewCfg(ns, kubecontext string) (*action.Configuration, error)

NewCfg creates helm internal configuration for provided namespace and kubecontext.

func NewHelm added in v0.12.2

func NewHelm(ns string) (*helm.EnvSettings, error)

NewHelm is a hack to create an instance of helm CLI and specifying namespace without environment variables.

func SaveInterface added in v0.12.0

func SaveInterface(ctx context.Context, file string, in any) error

SaveInterface encodes input to YAML and saves to file.

Types

type EqualChecker added in v0.20.0

type EqualChecker[T any] interface {
	Equal(T) bool
}

EqualChecker is an interface that allows to check interface for equality.

Jump to

Keyboard shortcuts

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