add rolloutID and observedRolloutID fields

Signed-off-by: mingzhou.swx <mingzhou.swx@alibaba-inc.com>
This commit is contained in:
mingzhou.swx 2022-06-08 13:38:13 +08:00
parent dc5b0cb954
commit b2802874b7
4 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,9 @@ type RolloutSpec struct {
ObjectRef ObjectRef `json:"objectRef"`
// rollout strategy
Strategy RolloutStrategy `json:"strategy"`
// RolloutID should be changed before each workload revision publication.
// It is to distinguish consecutive multiple workload publications and rollout progress.
RolloutID string `json:"rolloutID,omitempty"`
}
type ObjectRef struct {
@ -206,6 +209,8 @@ const (
type CanaryStatus struct {
// observedWorkloadGeneration is the most recent generation observed for this Rollout ref workload generation.
ObservedWorkloadGeneration int64 `json:"observedWorkloadGeneration,omitempty"`
// ObservedRolloutID will record the newest spec.RolloutID if status.canaryRevision equals to workload.updateRevision
ObservedRolloutID string `json:"observedRolloutID,omitempty"`
// RolloutHash from rollout.spec object
RolloutHash string `json:"rolloutHash,omitempty"`
// CanaryService holds the name of a service which selects pods with canary version and don't select any pods with stable version.

View File

@ -80,6 +80,11 @@ spec:
- name
type: object
type: object
rolloutID:
description: RolloutID should be changed before each workload revision
publication. It is to distinguish consecutive multiple workload
publications and rollout progress.
type: string
strategy:
description: rollout strategy
properties:
@ -207,6 +212,10 @@ spec:
type: string
message:
type: string
observedRolloutID:
description: ObservedRolloutID will record the newest spec.RolloutID
if status.canaryRevision equals to workload.updateRevision
type: string
observedWorkloadGeneration:
description: observedWorkloadGeneration is the most recent generation
observed for this Rollout ref workload generation.

View File

@ -130,6 +130,7 @@ func (r *RolloutReconciler) reconcileRolloutProgressing(rollout *rolloutv1alpha1
}
}
}
// after the normal completion of rollout, enter into the Finalising process
case rolloutv1alpha1.ProgressingReasonFinalising:
klog.Infof("rollout(%s/%s) is Progressing, and in reason(%s)", rollout.Namespace, rollout.Name, cond.Reason)

View File

@ -83,6 +83,7 @@ func (r *RolloutReconciler) updateRolloutStatus(rollout *rolloutv1alpha1.Rollout
// which version of deployment is targeted, ObservedWorkloadGeneration that is to compare with the workload generation
if newStatus.CanaryStatus != nil && newStatus.CanaryStatus.CanaryRevision != "" &&
newStatus.CanaryStatus.CanaryRevision == workload.CanaryRevision {
newStatus.CanaryStatus.ObservedRolloutID = rollout.Spec.RolloutID
newStatus.CanaryStatus.ObservedWorkloadGeneration = workload.Generation
}