instancetemplate

package
v1.1.0-beta.11 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemplateNameLabelKey = "workloads.kubeblocks.io/template-name"

	DefaultTemplateName = ""
)

Variables

View Source
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.

View Source
var ErrOrdinalsNotEnough = errors.New("available ordinals are not enough")

ErrOrdinalsNotEnough is considered temporary, e.g. some old ordinals are being deleted

Functions

func GetTemplateNameAndOrdinal

func GetTemplateNameAndOrdinal(workloadName, podName string) (string, int32, error)

GetTemplateNameAndOrdinal parses the instance template name and ordinal from a Pod name that belongs to the specified workload.

func IsAssignmentIncomplete

func IsAssignmentIncomplete(err error) bool

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

func TemplateNameFromLabels(labels map[string]string) (string, bool)

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

type Assignment struct {
	InstanceName string
	TemplateName string
}

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
}

Jump to

Keyboard shortcuts

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