Documentation ¶
Index ¶
- Variables
- func GetCustomClassObjectName(cdName string, componentName string) string
- func GetResourceConstraints(dynamic dynamic.Interface) (map[string]*v1alpha1.ComponentResourceConstraint, error)
- func ParseComponentClasses(classDefinition v1alpha1.ComponentClassDefinition) (map[v1alpha1.ClassDefRef]*v1alpha1.ComponentClass, error)
- type ByClassResource
- type ByResourceList
- type ByRuleList
- type ComponentClassWithRef
- type Manager
- func (r *Manager) ChooseClass(comp *v1alpha1.ClusterComponentSpec) (*ComponentClassWithRef, error)
- func (r *Manager) GetClasses() map[string][]*ComponentClassWithRef
- func (r *Manager) GetResources(clusterDefRef string, comp *v1alpha1.ClusterComponentSpec) (corev1.ResourceList, error)
- func (r *Manager) HasClass(compType string, classDefRef v1alpha1.ClassDefRef) bool
- func (r *Manager) ValidateResources(clusterDefRef string, comp *v1alpha1.ClusterComponentSpec) error
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 ¶
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 ¶
type ByRuleList []appsv1alpha1.ResourceConstraintRule
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 ¶
func GetManager ¶
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 ¶
func (r *Manager) ChooseClass(comp *v1alpha1.ClusterComponentSpec) (*ComponentClassWithRef, error)
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
Click to show internal directories.
Click to hide internal directories.