Documentation
¶
Index ¶
- Constants
- Variables
- func IsAssignmentIncomplete(err error) bool
- func ResolveHistoricalTemplate(its *workloads.InstanceSet, instanceName string, knownTemplateNames []string) (string, bool, error)
- func TemplateNameFromLabels(labels map[string]string) (string, bool)
- func ValidateInstanceTemplates(its *workloads.InstanceSet, tree *kubebuilderx.ObjectTree) error
- type Assignment
- type InstanceSetExt
- type InstanceTemplateExt
- type PodNameBuilder
- type PodNameBuilderOpts
Constants ¶
const ( TemplateNameLabelKey = "workloads.kubeblocks.io/template-name" DefaultTemplateName = "" )
Variables ¶
var ErrAssignmentIncomplete = errors.New("instance assignment is incomplete")
ErrAssignmentIncomplete indicates a temporary partial view while workload reconciliation is releasing or moving instance names. Callers must not publish the partial view.
var ErrOrdinalsNotEnough = errors.New("available ordinals are not enough")
ErrOrdinalsNotEnough is considered temporary, e.g. some old ordinals are being deleted
Functions ¶
func IsAssignmentIncomplete ¶
IsAssignmentIncomplete reports whether err represents a temporary partial assignment.
func ResolveHistoricalTemplate ¶
func ResolveHistoricalTemplate(its *workloads.InstanceSet, instanceName string, knownTemplateNames []string) (string, bool, error)
ResolveHistoricalTemplate resolves an old retained instance only from explicit allocation state or unambiguous non-flat naming.
func TemplateNameFromLabels ¶
TemplateNameFromLabels returns an explicitly published template label, preserving the empty default template value.
func ValidateInstanceTemplates ¶
func ValidateInstanceTemplates(its *workloads.InstanceSet, tree *kubebuilderx.ObjectTree) error
Types ¶
type Assignment ¶
Assignment associates an instance identity with its authoritative template.
func BuildAssignments ¶
func BuildAssignments(tree *kubebuilderx.ObjectTree, its *workloads.InstanceSet) ([]Assignment, []string, error)
BuildAssignments obtains the authoritative name-to-template assignments for identities that should have Pods.
type InstanceSetExt ¶
type InstanceSetExt struct {
InstanceSet *workloads.InstanceSet
InstanceTemplates map[string]*workloads.InstanceTemplate // key is template name
}
InstanceSetExt has a complete list of instance templates. i.e. it has a pseudo template (which equals to `.spec.template`) to the end of the list, to fill up the replica count.
func BuildInstanceSetExt ¶
func BuildInstanceSetExt(its *workloads.InstanceSet, tree *kubebuilderx.ObjectTree) (*InstanceSetExt, error)
type InstanceTemplateExt ¶
type InstanceTemplateExt struct {
Name string
Replicas int32
corev1.PodTemplateSpec
VolumeClaimTemplates []corev1.PersistentVolumeClaim
}
InstanceTemplateExt merges the default podSpec with overrides in the template
func BuildInstanceTemplateExt ¶
func BuildInstanceTemplateExt(itsExt *InstanceSetExt) []*InstanceTemplateExt
type PodNameBuilder ¶
type PodNameBuilder interface {
Validate() error
GenerateAllInstanceNames() ([]string, error)
BuildInstanceName2TemplateMap() (map[string]*InstanceTemplateExt, error)
}
func NewPodNameBuilder ¶
func NewPodNameBuilder(itsExt *InstanceSetExt, opts *PodNameBuilderOpts) (PodNameBuilder, error)
type PodNameBuilderOpts ¶
type PodNameBuilderOpts struct {
EventLogger record.EventRecorder
}