Documentation ¶
Index ¶
- Constants
- Variables
- func GetPodUnavailableBudgetForPod(kClient client.Client, finders *controllerfinder.ControllerFinder, ...) (*policyv1alpha1.PodUnavailableBudget, error)
- func PodUnavailableBudgetValidatePod(client client.Client, pod *corev1.Pod, control PubControl, operation Operation, ...) (allowed bool, reason string, err error)
- type Operation
- type PubControl
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 = 2000
)Variables ¶
View Source
var ConflictRetry = wait.Backoff{ Steps: 4, Duration: 500 * time.Millisecond, Factor: 1.0, Jitter: 0.1, }
Functions ¶
func GetPodUnavailableBudgetForPod ¶
func GetPodUnavailableBudgetForPod(kClient client.Client, finders *controllerfinder.ControllerFinder, pod *corev1.Pod) (*policyv1alpha1.PodUnavailableBudget, error)
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 PubControl ¶
type PubControl interface { // 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) // determine if this change to pod might cause unavailability IsPodUnavailableChanged(oldPod, newPod *corev1.Pod) bool }
func NewPubControl ¶
func NewPubControl(pub *policyv1alpha1.PodUnavailableBudget, controllerFinder *controllerfinder.ControllerFinder, client client.Client) PubControl
Click to show internal directories.
Click to hide internal directories.