pubcontrol

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpdateOperation = "UPDATE"

	// Marked pods will not be pub-protected, solving the scenario of force pod deletion
	PodPubNoProtectionAnnotation = "pub.kruise.io/no-protect"
)
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 PodUnavailableBudgetValidatePod

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

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

Types

type Operation

type Operation string

type PubControl

type PubControl interface {
	// Common
	// get PodUnavailableBudget
	GetPodUnavailableBudget() *policyv1alpha1.PodUnavailableBudget
	// 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() ([]*corev1.Pod, int32, error)

	// webhook
	// determine if this change to pod might cause unavailability
	IsPodUnavailableChanged(oldPod, newPod *corev1.Pod) bool
}

Jump to

Keyboard shortcuts

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