Documentation ¶
Index ¶
- func BuildReleaseControlInfo(release *v1beta1.BatchRelease) string
- func CalculateBatchReplicas(release *v1beta1.BatchRelease, workloadReplicas, currentBatch int) int
- func GenerateNotFoundError(name, resource string) error
- func IsControlledByBatchRelease(release *v1beta1.BatchRelease, object client.Object) bool
- func IsCurrentMoreThanOrEqualToDesired(current, desired intstr.IntOrString) bool
- func ParseIntegerAsPercentageIfPossible(stableReplicas, allReplicas int32, canaryReplicas *intstr.IntOrString) intstr.IntOrString
- func ShouldWaitResume(release *v1beta1.BatchRelease) bool
- type Interface
- type WorkloadEventType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildReleaseControlInfo ¶
func BuildReleaseControlInfo(release *v1beta1.BatchRelease) string
BuildReleaseControlInfo return a NewControllerRef of release with escaped `"`.
func CalculateBatchReplicas ¶
func CalculateBatchReplicas(release *v1beta1.BatchRelease, workloadReplicas, currentBatch int) int
CalculateBatchReplicas return the planned updated replicas of current batch.
func GenerateNotFoundError ¶
GenerateNotFoundError return a not found error
func IsControlledByBatchRelease ¶
func IsControlledByBatchRelease(release *v1beta1.BatchRelease, object client.Object) bool
IsControlledByBatchRelease return true if * object ownerReference has referred release; * object has batchRelease control info annotation about release.
func IsCurrentMoreThanOrEqualToDesired ¶
func IsCurrentMoreThanOrEqualToDesired(current, desired intstr.IntOrString) bool
IsCurrentMoreThanOrEqualToDesired return true if current >= desired
func ParseIntegerAsPercentageIfPossible ¶
func ParseIntegerAsPercentageIfPossible(stableReplicas, allReplicas int32, canaryReplicas *intstr.IntOrString) intstr.IntOrString
ParseIntegerAsPercentageIfPossible will return a percentage type IntOrString, such as "20%", "33%", but "33.3%" is illegal. Given A, B, return P that should try best to satisfy ⌈P * B⌉ == A, and we ensure that the error is less than 1%. For examples: * Given stableReplicas 1, allReplicas 3, return "33%"; * Given stableReplicas 98, allReplicas 99, return "97%"; * Given stableReplicas 1, allReplicas 101, return "1%";
func ShouldWaitResume ¶
func ShouldWaitResume(release *v1beta1.BatchRelease) bool
ShouldWaitResume return true if FinalizingPolicy is "waitResume".
Types ¶
type Interface ¶
type Interface interface { // Initialize make sure that the resource is ready to be progressed. // this function is tasked to do any initialization work on the resources. // it returns nil if the preparation is succeeded, else the preparation should retry. Initialize() error // UpgradeBatch tries to upgrade old replicas according to the release plan. // it will upgrade the old replicas as the release plan allows in the current batch. // this function is tasked to do any initialization work on the resources. // it returns nil if the preparation is succeeded, else the preparation should retry. UpgradeBatch() error // CheckBatchReady checks how many replicas are ready to serve requests in the current batch. // this function is tasked to do any initialization work on the resources. // it returns nil if the preparation is succeeded, else the preparation should retry. CheckBatchReady() error // Finalize makes sure the resources are in a good final state. // this function is tasked to do any initialization work on the resources. // it returns nil if the preparation is succeeded, else the preparation should retry. Finalize() error // SyncWorkloadInformation will watch and compare the status recorded in Status of BatchRelease // and the real-time workload information. If workload status is inconsistent with that recorded // in BatchRelease, it will return the corresponding WorkloadEventType and info. SyncWorkloadInformation() (WorkloadEventType, *util.WorkloadInfo, error) }
Interface is the interface that all type of control plane implements for rollout.
type WorkloadEventType ¶
type WorkloadEventType string
const ( // WorkloadNormalState means workload is normal and event should be ignored. WorkloadNormalState WorkloadEventType = "workload-is-at-normal-state" // WorkloadUnknownState means workload state is unknown and should retry. WorkloadUnknownState WorkloadEventType = "workload-is-at-unknown-state" // WorkloadPodTemplateChanged means workload revision changed, should be stopped to execute batch release plan. WorkloadPodTemplateChanged WorkloadEventType = "workload-pod-template-changed" // WorkloadReplicasChanged means workload is scaling during rollout, should recalculate upgraded pods in current batch. WorkloadReplicasChanged WorkloadEventType = "workload-replicas-changed" // WorkloadStillReconciling means workload status is untrusted Untrustworthy, we should wait workload controller to reconcile. WorkloadStillReconciling WorkloadEventType = "workload-is-reconciling" // WorkloadHasGone means workload is deleted during rollout, we should do something finalizing works if this event occurs. WorkloadHasGone WorkloadEventType = "workload-has-gone" // WorkloadRollbackInBatch means workload is rollback according to BatchRelease batch plan. WorkloadRollbackInBatch WorkloadEventType = "workload-rollback-in-batch" )