scalable

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetResource = map[string]getResourceFunc{
	"deployments":              getDeployments,
	"statefulsets":             getStatefulSets,
	"cronjobs":                 getCronJobs,
	"jobs":                     getJobs,
	"daemonsets":               getDaemonSets,
	"poddisruptionbudgets":     getPodDisruptionBudgets,
	"horizontalpodautoscalers": getHorizontalPodAutoscalers,
	"scaledobjects":            getScaledObjects,
}

GetResource maps the resource name to an implementation specific getResourceFunc

Functions

This section is empty.

Types

type Clientsets

type Clientsets struct {
	Kubernetes *kubernetes.Clientset
	Keda       *keda.Clientset
}

type Workload

type Workload interface {
	// GetAnnotations gets the annotations of the resource
	GetAnnotations() map[string]string
	// GetNamespace gets the namespace of the resource
	GetNamespace() string
	// GetName gets the name of the resource
	GetName() string
	// GetUID gets the uid of the workload
	GetUID() types.UID
	// GetObjectKind gets the ObjectKind of the workload
	GetObjectKind() schema.ObjectKind
	// GetLabels gets the labels of the workload
	GetLabels() map[string]string
	// GetCreationTimestamp gets the creation timestamp of the workload
	GetCreationTimestamp() metav1.Time
	// SetAnnotations sets the annotations on the resource. Changes won't be made on kubernetes until update() is called
	SetAnnotations(annotations map[string]string)
	// Update updates the resource with all changes made to it. It should only be called once on a resource
	Update(clientsets *Clientsets, ctx context.Context) error
	// ScaleUp scales up the workload
	ScaleUp() error
	// ScaleDown scales down the workload
	ScaleDown(downscaleReplicas int) error
}

Workload is an interface for a scalable resource. It holds shared resource specific functions

func FilterExcluded

func FilterExcluded(workloads []Workload, includeLabels values.RegexList, excludedNamespaces values.RegexList, excludedWorkloads values.RegexList) []Workload

FilterExcluded filters the workloads to match the includeLabels, excludedNamespaces and excludedWorkloads

Jump to

Keyboard shortcuts

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