helpers

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationEnvStatus = "env-status"
	AnnotationReserved  = "reserved"

	CompletionTime = "completion-time"

	EnvStatusCreating = "creating"
	EnvStatusDeleting = "deleting"
	EnvStatusError    = "error"
	EnvStatusReady    = "ready"

	KindNamespacePool = "NamespacePool"

	LabelOperatorNS = "operator-ns"
	LabelPool       = "pool"

	NamespaceEphemeralBase = "ephemeral-base"

	BonfireGinoreSecret         = "bonfire.ignore"
	OpenShiftVaultSecretsSecret = "openshift-vault-secrets"
	QontractIntegrationSecret   = "qontract.integration"

	TrueValue  = "true"
	FalseValue = "false"
)

Variables

View Source
var AnnotationEnvCreating = CustomAnnotation{Annotation: AnnotationEnvStatus, Value: EnvStatusCreating}
View Source
var AnnotationEnvDeleting = CustomAnnotation{Annotation: AnnotationEnvStatus, Value: EnvStatusDeleting}
View Source
var AnnotationEnvError = CustomAnnotation{Annotation: AnnotationEnvStatus, Value: EnvStatusError}
View Source
var AnnotationEnvReady = CustomAnnotation{Annotation: AnnotationEnvStatus, Value: EnvStatusReady}
View Source
var AnnotationReservedFalse = CustomAnnotation{Annotation: AnnotationReserved, Value: FalseValue}
View Source
var AnnotationReservedTrue = CustomAnnotation{Annotation: AnnotationReserved, Value: TrueValue}
View Source
var LabelOperatorNamespaceTrue = CustomLabel{Label: LabelOperatorNS, Value: TrueValue}

Functions

func CalculateNamespaceQuantityDelta

func CalculateNamespaceQuantityDelta(poolSizeLimit *int, size int, namespacesReady int, namespacesCreating int, namespacesReserved int) int

func CheckReadyStatus

func CheckReadyStatus(pool string, namespace core.Namespace, ready []core.Namespace) []core.Namespace

func CopySecrets

func CopySecrets(ctx context.Context, cl client.Client, namespaceName string) error

func CreateClowdEnv

func CreateClowdEnv(ctx context.Context, cl client.Client, spec clowder.ClowdEnvironmentSpec, namespaceName string) error

func CreateFrontendEnv

func CreateFrontendEnv(ctx context.Context, cl client.Client, namespaceName string, clowdEnv clowder.ClowdEnvironment) error

func CreateInitialAnnotations

func CreateInitialAnnotations() map[string]string

func CreateInitialLabels

func CreateInitialLabels(poolName string) map[string]string

func CreateNamespace

func CreateNamespace(ctx context.Context, cl client.Client, pool *crd.NamespacePool) (string, error)

func DeleteNamespace

func DeleteNamespace(ctx context.Context, cl client.Client, namespaceName string) error

func GetClowdEnv

func GetClowdEnv(ctx context.Context, cl client.Client, namespaceName string) (bool, *clowder.ClowdEnvironment, error)

func GetNamespace

func GetNamespace(ctx context.Context, cl client.Client, namespaceName string) (core.Namespace, error)

func GetReadyNamespaces

func GetReadyNamespaces(ctx context.Context, cl client.Client, poolName string) ([]core.Namespace, error)

func IsPoolAtLimit

func IsPoolAtLimit(currentSize int, sizeLimit int) bool

func NewReservation

func NewReservation(resName string, duration string, requester string, pool string) *crd.NamespaceReservation

NewReservation creates a mock reservation for testing

func UpdateAnnotations

func UpdateAnnotations(ctx context.Context, cl client.Client, namespaceName string, annotations map[string]string) error

func UpdateNamespaceResources added in v0.6.0

func UpdateNamespaceResources(ctx context.Context, cl client.Client, pool *crd.NamespacePool, nsName string) (core.Namespace, error)

func VerifyClowdEnvReady

func VerifyClowdEnvReady(env clowder.ClowdEnvironment) bool

Types

type CustomAnnotation

type CustomAnnotation struct {
	Annotation string
	Value      string
}

func (*CustomAnnotation) ToMap

func (a *CustomAnnotation) ToMap() map[string]string

type CustomLabel

type CustomLabel struct {
	Label string
	Value string
}

func (*CustomLabel) ToMap

func (l *CustomLabel) ToMap() map[string]string

type ErrType added in v0.5.0

type ErrType string

Jump to

Keyboard shortcuts

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