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 ¶ 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
type ByRuleList []appsv1alpha1.ResourceConstraintRule
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
func GetManager ¶ added in v0.6.0
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
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 ¶ 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
Click to show internal directories.
Click to hide internal directories.