labelpatch

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterPodsForOrderedUpdate

func FilterPodsForOrderedUpdate(pods []*corev1.Pod, ctx *batchcontext.BatchContext) []*corev1.Pod

FilterPodsForOrderedUpdate can filter pods before patch pod batch label when rolling back in batches. for example: * There are 20 replicas: 10 updated replicas (version 2), 10 replicas (version 1), and the release plan is

  • batch 0: 20%
  • batch 1: 50%
  • batch 2: 100% Currently, if we decide to roll back to version 1, if you use this function, can help you just rollback the pods that are really need to be rolled back according to release plan, but patch batch label according original release plan, and will patch the pods that are really rolled back in priority.
  • in batch 0: really roll back (20 - 10) * 20% = 2 pods, but 20 * 20% = 4 pod will be patched batch label;
  • in batch 0: really roll back (20 - 10) * 50% = 5 pods, but 20 * 50% = 10 pod will be patched batch label;
  • in batch 0: really roll back (20 - 10) * 100% = 10 pods, but 20 * 100% = 20 pod will be patched batch label;

Mainly for PaaS platform display pod list in conveniently.

This function only works for such unordered update strategy, such as Native StatefulSet, and Advanced StatefulSet with ordered update strategy. TODO: support advanced statefulSet reserveOrdinal feature

func FilterPodsForUnorderedUpdate

func FilterPodsForUnorderedUpdate(pods []*corev1.Pod, ctx *batchcontext.BatchContext) []*corev1.Pod

FilterPodsForUnorderedUpdate can filter pods before patch pod batch label when rolling back in batches. for example: * There are 20 replicas: 10 updated replicas (version 2), 10 replicas (version 1), and the release plan is

  • batch 0: 20%
  • batch 1: 50%
  • batch 2: 100% Currently, if we decide to roll back to version 1, if you use this function, can help you just rollback the pods that are really need to be rolled back according to release plan, but patch batch label according original release plan, and will patch the pods that are really rolled back in priority.
  • in batch 0: really roll back (20 - 10) * 20% = 2 pods, but 20 * 20% = 4 pod will be patched batch label;
  • in batch 0: really roll back (20 - 10) * 50% = 5 pods, but 20 * 50% = 10 pod will be patched batch label;
  • in batch 0: really roll back (20 - 10) * 100% = 10 pods, but 20 * 100% = 20 pod will be patched batch label;

Mainly for PaaS platform display pod list in conveniently.

This function only works for such unordered update strategy, such as CloneSet, Deployment, or Advanced StatefulSet with unordered update strategy.

func NewLabelPatcher

func NewLabelPatcher(cli client.Client, logKey klog.ObjectRef) *realPatcher

Types

type LabelPatcher

type LabelPatcher interface {
	PatchPodBatchLabel(ctx *batchcontext.BatchContext) error
}

Jump to

Keyboard shortcuts

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