workloadspread

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MatchedWorkloadSpreadSubsetAnnotations matched pod workloadSpread
	MatchedWorkloadSpreadSubsetAnnotations = "apps.kruise.io/matched-workloadspread"

	PodDeletionCostAnnotation = "controller.kubernetes.io/pod-deletion-cost"

	PodDeletionCostPositive = 100
	PodDeletionCostNegative = -100

	// VersionIgnored means all Pods should be regard as a universal version,
	// i.e., ignore the Pod/Workload version.
	VersionIgnored = "versionIgnored"
)

Variables

View Source
var (
	EnabledWorkloadSetForVersionedStatus sets.String

	GenerateNotFoundError = func(object client.Object, msg string) error {
		objectGroupKind := object.GetObjectKind().GroupVersionKind().GroupKind()
		return errors.NewNotFound(schema.GroupResource{Group: objectGroupKind.Group, Resource: objectGroupKind.Kind}, msg)
	}
)

Functions

func GenerateEmptyWorkloadObject added in v1.5.2

func GenerateEmptyWorkloadObject(gvk schema.GroupVersionKind, key types.NamespacedName) (object client.Object)

func GetPodVersion added in v1.5.2

func GetPodVersion(pod *corev1.Pod) string

func GetReplicasFromCustomWorkload added in v1.5.2

func GetReplicasFromCustomWorkload(reader client.Reader, object *unstructured.Unstructured) int32

func GetWorkloadVersion added in v1.5.2

func GetWorkloadVersion(reader client.Reader, object client.Object) (string, error)

func VerifyGroupKind

func VerifyGroupKind(ref interface{}, expectedKind string, expectedGroups []string) (bool, error)

Types

type Handler

type Handler struct {
	client.Client
}

func NewWorkloadSpreadHandler

func NewWorkloadSpreadHandler(c client.Client) *Handler

func (*Handler) HandlePodCreation

func (h *Handler) HandlePodCreation(pod *corev1.Pod) (skip bool, err error)

func (*Handler) HandlePodDeletion

func (h *Handler) HandlePodDeletion(pod *corev1.Pod, operation Operation) error

type InjectWorkloadSpread

type InjectWorkloadSpread struct {
	// matched WorkloadSpread.Name
	Name string `json:"name"`
	// Subset.Name
	Subset string `json:"subset"`
	// generate id if the Pod's name is nil.
	UID string `json:"uid,omitempty"`
}

type Operation

type Operation string
const (
	CreateOperation   Operation = "Create"
	DeleteOperation   Operation = "Delete"
	EvictionOperation Operation = "Eviction"
)

Jump to

Keyboard shortcuts

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