class

package
v0.6.0-beta.16 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 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 added in v0.6.0

type ByClassResource []*ComponentClassWithRef

func (ByClassResource) Len added in v0.6.0

func (b ByClassResource) Len() int

func (ByClassResource) Less added in v0.6.0

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

func (ByClassResource) Swap added in v0.6.0

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

type ByResourceList added in v0.6.0

type ByResourceList []corev1.ResourceList

func (ByResourceList) Len added in v0.6.0

func (b ByResourceList) Len() int

func (ByResourceList) Less added in v0.6.0

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

func (ByResourceList) Swap added in v0.6.0

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

type ByRuleList added in v0.6.0

func (ByRuleList) Len added in v0.6.0

func (m ByRuleList) Len() int

func (ByRuleList) Less added in v0.6.0

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

func (ByRuleList) Swap added in v0.6.0

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

type ComponentClassWithRef added in v0.6.0

type ComponentClassWithRef struct {
	appsv1alpha1.ComponentClass

	ClassDefRef appsv1alpha1.ClassDefRef
}

type Manager added in v0.6.0

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

func GetManager added in v0.6.0

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

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

func NewManager added in v0.6.0

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

func (*Manager) ChooseClass added in v0.6.0

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

func (*Manager) GetClasses added in v0.6.0

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

func (*Manager) GetResources added in v0.6.0

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

func (*Manager) HasClass added in v0.6.0

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

HasClass returns true if the component has the specified class

func (*Manager) ValidateResources added in v0.6.0

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