rsm2

package
v0.9.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: AGPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FeatureGateRSMReplicaProvider determines the instance provider for the RSM controller.
	// A instance provider is responsible for managing the underlying API resources required for the smooth operation of the RSM.
	// The currently supported instance providers are StatefulSet and Pod.
	// Planned supported instance providers include OpenKruise Advanced StatefulSet and KB Replica.
	FeatureGateRSMReplicaProvider = "RSM_REPLICA_PROVIDER"

	// MaxPlainRevisionCount specified max number of plain revision stored in rsm.status.updateRevisions.
	// All revisions will be compressed if exceeding this value.
	MaxPlainRevisionCount = "MAX_PLAIN_REVISION_COUNT"

	FeatureGateIgnorePodVerticalScaling = "IGNORE_POD_VERTICAL_SCALING"
)
View Source
const ControllerRevisionHashLabel = "controller.kubernetes.io/hash"

ControllerRevisionHashLabel is the label used to indicate the hash value of a ControllerRevision's Data.

Variables

Functions

func BaseSort

func BaseSort(x any, getNameNOrdinalFunc func(i int) (string, int), getRolePriorityFunc func(i int) int, reverse bool)

func ControllerRevisionName

func ControllerRevisionName(prefix string, hash string) string

ControllerRevisionName returns the Name for a ControllerRevision in the form prefix-hash. If the length of prefix is greater than 223 bytes, it is truncated to allow for a name that is no larger than 253 bytes.

func DeepHashObject

func DeepHashObject(hasher hash.Hash, objectToWrite interface{})

DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.

func GenerateInstanceNamesFromTemplate

func GenerateInstanceNamesFromTemplate(parentName, templateName string, replicas int32, offlineInstances []string) []string

func HashControllerRevision

func HashControllerRevision(revision *apps.ControllerRevision, probe *int32) string

HashControllerRevision hashes the contents of revision's Data using FNV hashing. If probe is not nil, the byte value of probe is added written to the hash as well. The returned hash will be a safe encoded string to avoid bad words.

func IsPodUpdated

func IsPodUpdated(rsm *workloads.ReplicatedStateMachine, pod *corev1.Pod) (bool, error)

IsPodUpdated tells whether the pod's spec is as expected in the rsm. This function is meant to replace the old fashion `GetPodRevision(pod) == updateRevision`, as the pod template revision has been redefined in rsm2.

func NewAssistantObjectReconciler

func NewAssistantObjectReconciler() kubebuilderx.Reconciler

func NewControllerRevision

func NewControllerRevision(parent metav1.Object,
	parentKind schema.GroupVersionKind,
	templateLabels map[string]string,
	data runtime.RawExtension,
	revision int64,
	collisionCount *int32) (*apps.ControllerRevision, error)

NewControllerRevision returns a ControllerRevision with a ControllerRef pointing to parent and indicating that parent is of parentKind. The ControllerRevision has labels matching template labels, contains Data equal to data, and has a Revision equal to revision. The collisionCount is used when creating the name of the ControllerRevision so the name is likely unique. If the returned error is nil, the returned ControllerRevision is valid. If the returned error is not nil, the returned ControllerRevision is invalid for use.

func NewDeletionReconciler

func NewDeletionReconciler() kubebuilderx.Reconciler

func NewFixMetaReconciler

func NewFixMetaReconciler() kubebuilderx.Reconciler

func NewReplicasAlignmentReconciler

func NewReplicasAlignmentReconciler() kubebuilderx.Reconciler

func NewRevisionUpdateReconciler

func NewRevisionUpdateReconciler() kubebuilderx.Reconciler

func NewStatusReconciler

func NewStatusReconciler() kubebuilderx.Reconciler

func NewTreeLoader

func NewTreeLoader() kubebuilderx.TreeLoader

func NewUpdateReconciler

func NewUpdateReconciler() kubebuilderx.Reconciler

func ParseParentNameAndOrdinal

func ParseParentNameAndOrdinal(s string) (string, int)

ParseParentNameAndOrdinal parses parent (instance template) Name and ordinal from the give instance name. -1 will be returned if no numeric suffix contained.

func ValidateDupInstanceNames

func ValidateDupInstanceNames[T any](instances []T, getNameFunc func(item T) string) error

Types

type PodUpdatePolicy

type PodUpdatePolicy string
const (
	NoOpsPolicy         PodUpdatePolicy = "NoOps"
	RecreatePolicy      PodUpdatePolicy = "Recreate"
	InPlaceUpdatePolicy PodUpdatePolicy = "InPlaceUpdate"
)

type ReplicaProvider

type ReplicaProvider string
const (
	StatefulSetProvider ReplicaProvider = "StatefulSet"
	PodProvider         ReplicaProvider = "Pod"
)

func CurrentReplicaProvider

func CurrentReplicaProvider(ctx context.Context, cli client.Reader, objectKey client.ObjectKey) (ReplicaProvider, error)

Jump to

Keyboard shortcuts

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