pubcontrol

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Marked pods will not be pub-protected, solving the scenario of force pod deletion
	PodPubNoProtectionAnnotation = "pub.kruise.io/no-protect"
	// related-pub annotation in pod
	PodRelatedPubAnnotation = "kruise.io/related-pub"
)
View Source
const (
	// MaxUnavailablePodSize is the max size of PUB.DisruptedPods + PUB.UnavailablePods.
	MaxUnavailablePodSize = 2000
)

Variables

View Source
var ConflictRetry = wait.Backoff{
	Steps:    4,
	Duration: 500 * time.Millisecond,
	Factor:   1.0,
	Jitter:   0.1,
}

Functions

func IsReferenceEqual added in v1.2.0

func IsReferenceEqual(ref1, ref2 *policyv1alpha1.TargetReference) bool

check APIVersion, Kind, Name

func PodUnavailableBudgetValidatePod

func PodUnavailableBudgetValidatePod(client client.Client, control PubControl, pod *corev1.Pod, operation policyv1alpha1.PubOperation, dryRun bool) (allowed bool, reason string, err error)

parameters: 1. allowed(bool) indicates whether to allow this update operation 2. err(error)

Types

type PubControl

type PubControl interface {
	// IsPodReady indicates whether pod is fully ready
	// 1. pod.Status.Phase == v1.PodRunning
	// 2. pod.condition PodReady == true
	IsPodReady(pod *corev1.Pod) bool
	// IsPodStateConsistent indicates whether pod.spec and pod.status are consistent after updating containers
	IsPodStateConsistent(pod *corev1.Pod) bool
	// GetPodsForPub returns Pods protected by the pub object.
	// return two parameters
	// 1. podList
	// 2. expectedCount, the default is workload.Replicas
	GetPodsForPub(pub *policyv1alpha1.PodUnavailableBudget) ([]*corev1.Pod, int32, error)

	// webhook
	// determine if this change to pod might cause unavailability
	IsPodUnavailableChanged(oldPod, newPod *corev1.Pod) bool
	// get pub for pod
	GetPubForPod(pod *corev1.Pod) (*policyv1alpha1.PodUnavailableBudget, error)
}

func NewPubControl

func NewPubControl(client client.Client) PubControl

Jump to

Keyboard shortcuts

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