utils

package
v0.0.0-...-0585a07 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameFormat      = "name-%s"
	NamespaceFormat = "namespace-%s"
)

Variables

View Source
var (
	ErrPortCreationFailed = errors.New("failed to get port")
)

Functions

func GetFreePort

func GetFreePort() (int, error)

GetFreePort determines a free port on the host. It does so by delegating the job to net.ListenTCP. Then providing a port of 0 to net.ListenTCP, it will automatically choose a port for us.

func GetNonEmptyLines

func GetNonEmptyLines(output string) []string

GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is.

func GetRandString

func GetRandString(length int) string

func GetRandomName

func GetRandomName() string

func GetRandomNamespaceName

func GetRandomNamespaceName() string

func InstallCertManager

func InstallCertManager() error

InstallCertManager installs the cert manager bundle.

func InstallPrometheusOperator

func InstallPrometheusOperator() error

InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics.

func LoadImageToKindClusterWithName

func LoadImageToKindClusterWithName(name string) error

LoadImageToKindClusterWithName loads a local docker image to the kind cluster.

func NewCompanionCR

func NewCompanionCR(opts ...CompanionOption) *kcmv1alpha1.Companion

func NewCompanionDeployment

func NewCompanionDeployment(name, namespace string) *kappsv1.Deployment

func NewConfigMap

func NewConfigMap(name, namespace string) *kcorev1.ConfigMap

func NewDeployment

func NewDeployment(name, namespace string, annotations map[string]string) *kappsv1.Deployment

func NewLogger

func NewLogger() (*zap.Logger, error)

func NewNamespace

func NewNamespace(name string) *kcorev1.Namespace

func NewSugaredLogger

func NewSugaredLogger() (*zap.SugaredLogger, error)

func Run

func Run(cmd *exec.Cmd) ([]byte, error)

Run executes the provided command within this context.

func UninstallCertManager

func UninstallCertManager()

UninstallCertManager uninstalls the cert manager.

func UninstallPrometheusOperator

func UninstallPrometheusOperator()

UninstallPrometheusOperator uninstalls the prometheus.

Types

type CompanionOption

type CompanionOption func(*kcmv1alpha1.Companion) error

func WithCompanionCRFinalizer

func WithCompanionCRFinalizer(finalizer string) CompanionOption

Jump to

Keyboard shortcuts

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