util

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckExistingContext

func CheckExistingContext(contextName, kubeconfig string) bool

func ContextWithCancelOnSignals

func ContextWithCancelOnSignals(ctx context.Context, sigs ...os.Signal) context.Context

ContextWithCancelOnSignals returns a context that is canceled when one of the specified signals are received

func CurrentAccount

func CurrentAccount(user *v1.User) (string, error)

func Die

func Die(err error, cause ...string)

Die panics it the error is not nil. If a cause string is provided it will be displayed in the error message.

func Doc

func Doc(doc string) string

Doc returns a string where all the '<BIN>' are replaced with the binary name and all the '\t' are replaced with a uniformed indentation using space.

func JoinManifests

func JoinManifests(manifests ...[]byte) []byte

JoinManifests concats all of the provided yaml manifests with a yaml separator.

func KubeContexts

func KubeContexts(kubeconfig string) []kubeContext

func KubeCurrentContextName

func KubeCurrentContextName(kubeconfig string) string

func KubeServerByContextName

func KubeServerByContextName(contextName, kubeconfig string) (string, error)

func MustParseDuration

func MustParseDuration(dur string) time.Duration

MustParseDuration parses the given string as "time.Duration", or panic.

func OpenBrowserForGitLogin

func OpenBrowserForGitLogin(ingressHost string, user string, account string) error

func ReverseMap

func ReverseMap[K, V comparable](gitProviders map[K]V) map[V]K

func SplitManifests

func SplitManifests(manifests []byte) [][]byte

func StringIndexOf

func StringIndexOf(slice []string, val string) int

Types

type AsyncRunner

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

func NewAsyncRunner

func NewAsyncRunner(n int) *AsyncRunner

NewAsyncRunner initializes a new AsyncRunner that can run up to n async operations.

func (*AsyncRunner) Run

func (ar *AsyncRunner) Run(f func() error)

Run runs another async operation

func (*AsyncRunner) Wait

func (ar *AsyncRunner) Wait() error

Wait waits for all async operations to finish and returns an error if one of the async operations returned an error, otherwise, returns nil.

type RetryOptions

type RetryOptions struct {
	Func    func() error
	Retries int
	Sleep   time.Duration
}

Directories

Path Synopsis
mocks
Package helm is a generated GoMock package.
Package helm is a generated GoMock package.

Jump to

Keyboard shortcuts

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