class

package
v0.7.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClassNotFound   = fmt.Errorf("class not found")
	ErrInvalidResource = fmt.Errorf("resource is not conform to the constraints, please check the ComponentResourceConstraint API")
)
View Source
var (
	Any = v1alpha1.ClassDefRef{}
)

Functions

func GetCustomClassObjectName

func GetCustomClassObjectName(cdName string, componentName string) string

GetCustomClassObjectName returns the name of the ComponentClassDefinition object containing the custom classes

func GetResourceConstraints

func GetResourceConstraints(dynamic dynamic.Interface) (map[string]*v1alpha1.ComponentResourceConstraint, error)

GetResourceConstraints gets all resource constraints

func ParseComponentClasses

func ParseComponentClasses(classDefinition v1alpha1.ComponentClassDefinition) (map[v1alpha1.ClassDefRef]*v1alpha1.ComponentClass, error)

ParseComponentClasses parses ComponentClassDefinition to component classes

Types

type ByClassResource

type ByClassResource []*ComponentClassWithRef

func (ByClassResource) Len

func (b ByClassResource) Len() int

func (ByClassResource) Less

func (b ByClassResource) Less(i, j int) bool

func (ByClassResource) Swap

func (b ByClassResource) Swap(i, j int)

type ByResourceList

type ByResourceList []corev1.ResourceList

func (ByResourceList) Len

func (b ByResourceList) Len() int

func (ByResourceList) Less

func (b ByResourceList) Less(i, j int) bool

func (ByResourceList) Swap

func (b ByResourceList) Swap(i, j int)

type ByRuleList

func (ByRuleList) Len

func (m ByRuleList) Len() int

func (ByRuleList) Less

func (m ByRuleList) Less(i, j int) bool

func (ByRuleList) Swap

func (m ByRuleList) Swap(i, j int)

type ComponentClassWithRef

type ComponentClassWithRef struct {
	appsv1alpha1.ComponentClass

	ClassDefRef appsv1alpha1.ClassDefRef
}

type Manager

type Manager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func GetManager

func GetManager(client dynamic.Interface, cdName string) (*Manager, error)

GetManager gets a class manager which manages default classes and user custom classes

func NewManager

func NewManager(classDefinitionList v1alpha1.ComponentClassDefinitionList, constraintList v1alpha1.ComponentResourceConstraintList) (*Manager, error)

func (*Manager) ChooseClass

ChooseClass chooses the classes to be used for a given component with constraints

func (*Manager) GetClasses

func (r *Manager) GetClasses() map[string][]*ComponentClassWithRef

func (*Manager) GetResources

func (r *Manager) GetResources(clusterDefRef string, comp *v1alpha1.ClusterComponentSpec) (corev1.ResourceList, error)

func (*Manager) HasClass

func (r *Manager) HasClass(compType string, classDefRef v1alpha1.ClassDefRef) bool

HasClass returns true if the component has the specified class

func (*Manager) ValidateResources

func (r *Manager) ValidateResources(clusterDefRef string, comp *v1alpha1.ClusterComponentSpec) error

ValidateResources validates if the resources of the component is invalid

Jump to

Keyboard shortcuts

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