helper

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 24 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

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

Byte marshals input to YAML and returns YAML byte slice.

func ContextGetLifecycleType

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

func ContextGetReleaseUniq

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

func ContextWithLifecycleType

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

func ContextWithReleaseUniq

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

func CopyFile

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 Dotenv

func Dotenv()

func Download

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

Download downloads uri to file.

func GetKubernetesVersion

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

GetKubernetesVersion returns kubernetes server version.

func IsExists

func IsExists(s string) bool

IsExists return true if file exists.

func IsURL

func IsURL(str string) bool

IsURL reports whether provided string is a valid URL.

func KubeInit

func KubeInit(kubecontext string) (err error)

KubeInit init kubeconfig for kubedog.

func MoveFile

func MoveFile(src, dst string) error

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

func NewCfg

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

NewCfg creates helm internal configuration for provided namespace and kubecontext.

func NewHelm

func NewHelm(ns string) *helm.EnvSettings

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

func NewRegistryClient added in v1.1.0

func NewRegistryClient(plainHTTP, insecureSkipTLSVerify bool) (*registry.Client, error)

NewRegistryClient builds a registry client for a single release whose chart needs a non-default OCI transport (plain HTTP or a skipped TLS verification).

The package-global HelmRegistryClient is TLS-only, and helm v4's OCI getter uses an injected registry client verbatim -- it only honors plain_http / insecure when it builds its own client (see pkg/getter/ocigetter.go). So the shared client can never reach a plain-HTTP or insecure registry; a per-release client carrying these options is the only way the per-chart flags reach the OCI transport. Mirrors helm's own cmd.newRegistryClient.

func SaveInterface

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

SaveInterface encodes input to YAML and saves to file.

func SlicesMap

func SlicesMap[T any, S interface{ ~[]T }, R any](s S, f func(T) R) []R

Types

type SlogHandler

type SlogHandler struct {
	// contains filtered or unexported fields
}

SlogHandler is a slog.Handler that forwards records to logrus.

Helm v4 dropped the `func(format string, args ...any)` debug callback that v3 accepted and logs through log/slog instead. This handler keeps helm's output inside helmtide's single log stream, so `--log-level` and `--log-format` still control it.

func NewSlogHandler

func NewSlogHandler() *SlogHandler

NewSlogHandler returns a slog.Handler writing to the standard logrus logger.

func (*SlogHandler) Enabled

func (h *SlogHandler) Enabled(_ context.Context, level slog.Level) bool

Enabled implements slog.Handler.

func (*SlogHandler) Handle

func (h *SlogHandler) Handle(_ context.Context, r slog.Record) error

Handle implements slog.Handler.

slog.Handler says so; neither signature is ours to change.

func (*SlogHandler) WithAttrs

func (h *SlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs implements slog.Handler. cheaper than the map write that follows it.

func (*SlogHandler) WithGroup

func (h *SlogHandler) WithGroup(name string) slog.Handler

WithGroup implements slog.Handler.

Jump to

Keyboard shortcuts

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