rollout apis (#5)

This commit is contained in:
berg 2022-02-21 10:51:35 +08:00 committed by GitHub
parent f0d5fb9422
commit 33199cf82c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 194 additions and 173 deletions

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2022 The Kruise & KubeVela Authors. Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,43 +24,32 @@ import (
// ReleaseStrategyType defines strategies for pods rollout // ReleaseStrategyType defines strategies for pods rollout
type ReleaseStrategyType string type ReleaseStrategyType string
type ReleasingBatchStateType string // ReleasePlan fines the details of the rollout plan
const (
InitializeBatchState ReleasingBatchStateType = "InitializeInBatch"
DoCanaryBatchState ReleasingBatchStateType = "DoCanaryInBatch"
VerifyBatchState ReleasingBatchStateType = "VerifyInBatch"
ReadyBatchState ReleasingBatchStateType = "ReadyInBatch"
)
const (
// RolloutPhaseVerify indicates the phase of verifying workload health.
RolloutPhaseVerify RolloutPhase = "Verifying"
// RolloutPhaseFinalizing indicates the phase, where controller will do some operation after all batch ready.
RolloutPhaseFinalizing RolloutPhase = "Finalizing"
// RolloutPhaseCompleted indicates the release plan was executed successfully.
RolloutPhaseCompleted RolloutPhase = "Completed"
)
// ReleasePlan fines the details of the release plan
type ReleasePlan struct { type ReleasePlan struct {
// Batches describe the plan for each batch in detail, including canary replicas and paused seconds. // The exact distribution among batches.
// its size has to be exactly the same as the NumBatches (if set)
// The total number cannot exceed the targetSize or the size of the source resource
// We will IGNORE the last batch's replica field if it's a percentage since round errors can lead to inaccurate sum
// We highly recommend to leave the last batch's replica field empty
// +optional
Batches []ReleaseBatch `json:"batches"` Batches []ReleaseBatch `json:"batches"`
// All pods in the batches up to the batchPartition (included) will have // All pods in the batches up to the batchPartition (included) will have
// the target updated specification while the rest still have the stable resource // the target resource specification while the rest still have the source resource
// This is designed for the operators to manually release plan // This is designed for the operators to manually rollout
// Default is nil, which means no partition. // Default is the the number of batches which will rollout all the batches
// +optional // +optional
BatchPartition *int32 `json:"batchPartition,omitempty"` BatchPartition *int32 `json:"batchPartition,omitempty"`
// Paused the release plan executor, default is false // Paused the rollout, default is false
// +optional // +optional
Paused bool `json:"paused,omitempty"` Paused bool `json:"paused,omitempty"`
} }
// ReleaseBatch is used to describe how each release batch should be // ReleaseBatch is used to describe how the each batch rollout should be
type ReleaseBatch struct { type ReleaseBatch struct {
// Replicas is the number of expected canary pods in this batch // Replicas is the number of pods to upgrade in this batch
// it can be an absolute number (ex: 5) or a percentage of total pods. // it can be an absolute number (ex: 5) or a percentage of total pods
// we will ignore the percentage of the last batch to just fill the gap
// +optional
// it is mutually exclusive with the PodList field // it is mutually exclusive with the PodList field
CanaryReplicas intstr.IntOrString `json:"canaryReplicas"` CanaryReplicas intstr.IntOrString `json:"canaryReplicas"`
// The wait time, in seconds, between instances upgrades, default = 0 // The wait time, in seconds, between instances upgrades, default = 0
@ -70,9 +59,9 @@ type ReleaseBatch struct {
// BatchReleaseStatus defines the observed state of a rollout plan // BatchReleaseStatus defines the observed state of a rollout plan
type BatchReleaseStatus struct { type BatchReleaseStatus struct {
// Conditions records some important message at each Phase. // Conditions represents the latest available observations of a CloneSet's current state.
Conditions []RolloutCondition `json:"conditions,omitempty"` Conditions []RolloutCondition `json:"conditions,omitempty"`
// Canary describes the status of the canary // Canary describes the state of the canary rollout
CanaryStatus BatchReleaseCanaryStatus `json:"canaryStatus,omitempty"` CanaryStatus BatchReleaseCanaryStatus `json:"canaryStatus,omitempty"`
// StableRevision is the pod-template-hash of stable revision pod. // StableRevision is the pod-template-hash of stable revision pod.
StableRevision string `json:"stableRevision,omitempty"` StableRevision string `json:"stableRevision,omitempty"`
@ -84,6 +73,11 @@ type BatchReleaseStatus struct {
// ObservedWorkloadReplicas is the size of the target resources. This is determined once the initial spec verification // ObservedWorkloadReplicas is the size of the target resources. This is determined once the initial spec verification
// and does not change until the rollout is restarted. // and does not change until the rollout is restarted.
ObservedWorkloadReplicas int32 `json:"observedWorkloadReplicas,omitempty"` ObservedWorkloadReplicas int32 `json:"observedWorkloadReplicas,omitempty"`
// Count of hash collisions for creating canary Deployment. The controller uses this
// field as a collision avoidance mechanism when it needs to create the name for the
// newest canary Deployment.
// +optional
CollisionCount *int32 `json:"collisionCount,omitempty"`
// ObservedReleasePlanHash is a hash code of observed itself releasePlan.Batches. // ObservedReleasePlanHash is a hash code of observed itself releasePlan.Batches.
ObservedReleasePlanHash string `json:"observedReleasePlanHash,omitempty"` ObservedReleasePlanHash string `json:"observedReleasePlanHash,omitempty"`
// Phase is the release phase. // Phase is the release phase.
@ -92,8 +86,8 @@ type BatchReleaseStatus struct {
} }
type BatchReleaseCanaryStatus struct { type BatchReleaseCanaryStatus struct {
// State indicates the state of the current batch. // ReleasingBatchState indicates the state of the current batch.
State ReleasingBatchStateType `json:"state,omitempty"` ReleasingBatchState ReleasingBatchStateType `json:"batchState,omitempty"`
// The current batch the rollout is working on/blocked, it starts from 0 // The current batch the rollout is working on/blocked, it starts from 0
CurrentBatch int32 `json:"currentBatch"` CurrentBatch int32 `json:"currentBatch"`
// LastBatchFinalizedTime is the timestamp of // LastBatchFinalizedTime is the timestamp of
@ -103,3 +97,12 @@ type BatchReleaseCanaryStatus struct {
// UpgradedReadyReplicas is the number of Pods upgraded by the rollout controller that have a Ready Condition. // UpgradedReadyReplicas is the number of Pods upgraded by the rollout controller that have a Ready Condition.
UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"` UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"`
} }
type ReleasingBatchStateType string
const (
InitializeBatchState ReleasingBatchStateType = "InitializeInBatch"
DoCanaryBatchState ReleasingBatchStateType = "DoCanaryInBatch"
VerifyBatchState ReleasingBatchStateType = "VerifyInBatch"
ReadyBatchState ReleasingBatchStateType = "ReadyInBatch"
)

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2022 The Kruise & KubeVela Authors. Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import (
// +k8s:openapi-gen=true // +k8s:openapi-gen=true
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
// +kubebuilder:subresource:status // +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="KIND",type=string,JSONPath=`.spec.targetReference.kind` // +kubebuilder:printcolumn:name="KIND",type=string,JSONPath=`.spec.targetReference.workloadRef.kind`
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase` // +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="BATCH",type=integer,JSONPath=`.status.canaryStatus.currentBatch` // +kubebuilder:printcolumn:name="BATCH",type=integer,JSONPath=`.status.canaryStatus.currentBatch`
// +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.canaryStatus.batchState` // +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.canaryStatus.batchState`
@ -38,17 +38,28 @@ type BatchRelease struct {
Status BatchReleaseStatus `json:"status,omitempty"` Status BatchReleaseStatus `json:"status,omitempty"`
} }
// BatchReleaseSpec defines how to describe a batch release plan. // BatchReleaseSpec defines how to describe an update between different compRevision
type BatchReleaseSpec struct { type BatchReleaseSpec struct {
// Cancelled is true indicates this batch release plan is cancelled. Strategy ReleaseStrategy `json:"strategy,omitempty"`
// All resources about canary will be cleaned up. // Cancel is true indicates this batch release plan is cancelled.
Cancelled bool `json:"cancelled,omitempty"` Cancelled bool `json:"cancelled,omitempty"`
// TargetRef contains the name of the workload that we need to upgrade to. // TargetRevisionName contains the name of the componentRevisionName that we need to upgrade to.
TargetRef ObjectRef `json:"targetReference"` TargetRef ObjectRef `json:"targetReference"`
// ReleasePlan is the details on how to release the updated revision. // RolloutPlan is the details on how to rollout the resources
ReleasePlan ReleasePlan `json:"releasePlan"` ReleasePlan ReleasePlan `json:"releasePlan"`
} }
type ReleaseStrategy struct {
// +optional
CloneSetStrategy CloneSetReleaseStrategyType `json:"cloneSetStrategy,omitempty"`
// +optional
DeploymentStrategy DeploymentReleaseStrategyType `json:"deploymentStrategy,omitempty"`
}
type CloneSetReleaseStrategyType string
type DeploymentReleaseStrategyType string
// BatchReleaseList contains a list of BatchRelease // BatchReleaseList contains a list of BatchRelease
// +kubebuilder:object:root=true // +kubebuilder:object:root=true
type BatchReleaseList struct { type BatchReleaseList struct {

View File

@ -16,7 +16,7 @@ limitations under the License.
// Package v1alpha1 contains API Schema definitions for the apps v1alpha1 API group // Package v1alpha1 contains API Schema definitions for the apps v1alpha1 API group
//+kubebuilder:object:generate=true //+kubebuilder:object:generate=true
//+groupName=apps.rollouts.io //+groupName=rollouts.kruise.io
package v1alpha1 package v1alpha1
import ( import (

View File

@ -19,6 +19,7 @@ package v1alpha1
import ( import (
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
) )
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
@ -28,16 +29,34 @@ import (
type RolloutSpec struct { type RolloutSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
// ObjectRef indicates workload
// TargetRef contains enough information to let you identify a workload for Rollout ObjectRef ObjectRef `json:"objectRef"`
TargetRef ObjectRef `json:"targetRef"` // rollout strategy
// The deployment strategy to use to replace existing pods with new ones.
Strategy RolloutStrategy `json:"strategy"` Strategy RolloutStrategy `json:"strategy"`
} }
// ObjectRef holds a references to the Kubernetes object
type ObjectRef struct { type ObjectRef struct {
// workloadRef, revisionRef
// default is workloadRef
Type ObjectRefType `json:"type,omitempty"`
// WorkloadRef contains enough information to let you identify a workload for Rollout
// Batch release of the bypass
WorkloadRef *WorkloadRef `json:"workloadRef,omitempty"`
// revisionRef
// Fully managed batch publishing capability
//RevisionRef *ControllerRevisionRef `json:"revisionRef,omitempty"`
}
type ObjectRefType string
const (
WorkloadRefType = "workloadRef"
RevisionRefType = "revisionRef"
)
// WorkloadRef holds a references to the Kubernetes object
type WorkloadRef struct {
// API Version of the referent // API Version of the referent
APIVersion string `json:"apiVersion"` APIVersion string `json:"apiVersion"`
// Kind of the referent // Kind of the referent
@ -46,41 +65,51 @@ type ObjectRef struct {
Name string `json:"name"` Name string `json:"name"`
} }
/*type ControllerRevisionRef struct {
TargetRevisionName string `json:"targetRevisionName"`
SourceRevisionName string `json:"sourceRevisionName"`
}*/
// RolloutStrategy defines strategy to apply during next rollout // RolloutStrategy defines strategy to apply during next rollout
type RolloutStrategy struct { type RolloutStrategy struct {
// +optional // Paused indicates that the Rollout is paused.
// BlueGreen *BlueGreenStrategy `json:"blueGreen,omitempty" protobuf:"bytes,1,opt,name=blueGreen"` // Default value is false
Paused bool `json:"paused,omitempty"`
// canary, BlueGreenPlan
// Default value is canary
Type RolloutStrategyType `json:"type,omitempty"`
// +optional // +optional
Canary *CanaryStrategy `json:"canary,omitempty"` Canary *CanaryStrategy `json:"canary,omitempty"`
// +optional
// BlueGreen *BlueGreenStrategy `json:"blueGreen,omitempty"`
} }
type RolloutStrategyType string
const (
RolloutStrategyCanary RolloutStrategyType = "canary"
)
// CanaryStrategy defines parameters for a Replica Based Canary // CanaryStrategy defines parameters for a Replica Based Canary
type CanaryStrategy struct { type CanaryStrategy struct {
// CanaryService holds the name of a service which selects pods with canary version and don't select any pods with stable version. // Steps define the order of phases to execute release in batches(20%, 40%, 60%, 80%, 100%)
// +optional
//CanaryService string `json:"canaryService,omitempty"`
// StableService holds the name of a service which selects pods with stable version and don't select any pods with canary version.
// +optional
StableService string `json:"stableService,omitempty"`
// Steps define the order of phases to execute the canary deployment
// +optional // +optional
Steps []CanaryStep `json:"steps,omitempty"` Steps []CanaryStep `json:"steps,omitempty"`
// TrafficRouting hosts all the supported service meshes supported to enable more fine-grained traffic routing // TrafficRouting hosts all the supported service meshes supported to enable more fine-grained traffic routing
TrafficRouting *TrafficRouting `json:"trafficRouting,omitempty"` TrafficRouting *TrafficRouting `json:"trafficRouting,omitempty"`
// MetricsAnalysis runs a separate analysisRun while all the steps execute. This is intended to be a continuous validation of the new ReplicaSet
// MetricsAnalysis *MetricsAnalysisBackground `json:"metricsAnalysis,omitempty"` // MetricsAnalysis *MetricsAnalysisBackground `json:"metricsAnalysis,omitempty"`
} }
// CanaryStep defines a step of a canary workload. // CanaryStep defines a step of a canary workload.
type CanaryStep struct { type CanaryStep struct {
// SetWeight sets what percentage of the canary pods should receive // SetWeight sets what percentage of the canary pods should receive
SetWeight *int32 `json:"setWeight,omitempty"` Weight int32 `json:"weight,omitempty"`
// Pause freezes the rollout by setting spec.Paused to true. // Replicas is the number of expected canary pods in this batch
// A Rollout will resume when spec.Paused is reset to false. // it can be an absolute number (ex: 5) or a percentage of total pods.
Replicas *intstr.IntOrString `json:"replicas,omitempty"`
// Pause defines a pause stage for a rollout, manual or auto
// +optional // +optional
Pause *RolloutPause `json:"pause,omitempty"` Pause RolloutPause `json:"pause,omitempty"`
// MetricsAnalysis defines the AnalysisRun that will run for a step
// MetricsAnalysis *RolloutAnalysis `json:"metricsAnalysis,omitempty"` // MetricsAnalysis *RolloutAnalysis `json:"metricsAnalysis,omitempty"`
} }
@ -93,41 +122,25 @@ type RolloutPause struct {
// TrafficRouting hosts all the different configuration for supported service meshes to enable more fine-grained traffic routing // TrafficRouting hosts all the different configuration for supported service meshes to enable more fine-grained traffic routing
type TrafficRouting struct { type TrafficRouting struct {
Type TrafficRoutingType `json:"type,omitempty"` // Service holds the name of a service which selects pods with stable version and don't select any pods with canary version.
// +optional
Service string `json:"service"`
// Nginx, Alb, Istio etc.
Type TrafficRoutingType `json:"type"`
// Nginx holds Nginx Ingress specific configuration to route traffic // Nginx holds Nginx Ingress specific configuration to route traffic
Nginx *NginxTrafficRouting `json:"nginx,omitempty"` Nginx *NginxTrafficRouting `json:"nginx,omitempty"`
//
Alb *AlbTrafficRouting `json:"alb,omitempty"`
} }
type TrafficRoutingType string type TrafficRoutingType string
const ( const (
TrafficRoutingNginx TrafficRoutingType = "nginx" TrafficRoutingNginx TrafficRoutingType = "nginx"
TrafficRoutingAlb TrafficRoutingType = "alb"
) )
// NginxTrafficRouting configuration for Nginx ingress controller to control traffic routing // NginxTrafficRouting configuration for Nginx ingress controller to control traffic routing
type NginxTrafficRouting struct { type NginxTrafficRouting struct {
// Ingress refers to the name of an `Ingress` resource in the same namespace as the `Rollout` // Ingress refers to the name of an `Ingress` resource in the same namespace as the `Rollout`
Ingress string `json:"ingress"` Ingress string `json:"ingress"`
// A/B Testing
Tickets *Tickets `json:"tickets,omitempty"`
}
// AlbTrafficRouting configuration for Nginx ingress controller to control traffic routing
type AlbTrafficRouting struct {
// Ingress refers to the name of an `Ingress` resource in the same namespace as the `Rollout`
Ingress string `json:"ingress"`
// A/B Testing
Tickets *Tickets `json:"tickets,omitempty"`
}
type Tickets struct {
// +optional
Header map[string]string `json:"header,omitempty"`
// +optional
Cookie map[string]string `json:"cookie,omitempty"`
} }
// RolloutStatus defines the observed state of Rollout // RolloutStatus defines the observed state of Rollout
@ -135,12 +148,11 @@ type RolloutStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file // Important: Run "make" to regenerate code after modifying this file
// observedGeneration is the most recent generation observed for this SidecarSet. It corresponds to the // observedGeneration is the most recent generation observed for this Rollout.
// SidecarSet's generation, which is updated on mutation by the API Server.
ObservedGeneration int64 `json:"observedGeneration,omitempty"` ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// UpdateRevision the hash of the current pod template // CanaryRevision the hash of the canary pod template
// +optional // +optional
UpdateRevision string `json:"updateRevision,omitempty"` CanaryRevision string `json:"canaryRevision,omitempty"`
// StableRevision indicates the revision pods that has successfully rolled out // StableRevision indicates the revision pods that has successfully rolled out
StableRevision string `json:"stableRevision,omitempty"` StableRevision string `json:"stableRevision,omitempty"`
// Conditions a list of conditions a rollout can have. // Conditions a list of conditions a rollout can have.
@ -149,7 +161,9 @@ type RolloutStatus struct {
// Canary describes the state of the canary rollout // Canary describes the state of the canary rollout
// +optional // +optional
CanaryStatus *CanaryStatus `json:"canaryStatus,omitempty"` CanaryStatus *CanaryStatus `json:"canaryStatus,omitempty"`
// Phase is the rollout phase. Clients should only rely on the value if status.observedGeneration equals metadata.generation // +optional
//BlueGreenStatus *BlueGreenStatus `json:"blueGreenStatus,omitempty"`
// Phase is the rollout phase.
Phase RolloutPhase `json:"phase,omitempty"` Phase RolloutPhase `json:"phase,omitempty"`
// Message provides details on why the rollout is in its current phase // Message provides details on why the rollout is in its current phase
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
@ -157,7 +171,7 @@ type RolloutStatus struct {
// RolloutCondition describes the state of a rollout at a certain point. // RolloutCondition describes the state of a rollout at a certain point.
type RolloutCondition struct { type RolloutCondition struct {
// Type of deployment condition. // Type of rollout condition.
Type RolloutConditionType `json:"type"` Type RolloutConditionType `json:"type"`
// Phase of the condition, one of True, False, Unknown. // Phase of the condition, one of True, False, Unknown.
Status corev1.ConditionStatus `json:"status"` Status corev1.ConditionStatus `json:"status"`
@ -181,21 +195,26 @@ const (
// up or old pods scale down, or when the services are updated. Progress is not estimated // up or old pods scale down, or when the services are updated. Progress is not estimated
// for paused rollouts. // for paused rollouts.
RolloutConditionProgressing RolloutConditionType = "Progressing" RolloutConditionProgressing RolloutConditionType = "Progressing"
// reason // Progressing Reason
ProgressingReasonInitializing = "Initializing" ProgressingReasonInitializing = "Initializing"
ProgressingReasonInRolling = "InRolling" ProgressingReasonInRolling = "InRolling"
ProgressingReasonFinalising = "Finalising" ProgressingReasonFinalising = "Finalising"
ProgressingReasonFailed = "Failed"
ProgressingReasonSucceeded = "Succeeded" ProgressingReasonSucceeded = "Succeeded"
ProgressingReasonCancelling = "Cancelling"
ProgressingReasonCanceled = "Canceled"
ProgressingReasonPaused = "Paused"
RolloutConditionTerminating RolloutConditionType = "Terminating" // Terminating condition
//reason RolloutConditionTerminating RolloutConditionType = "Terminating"
TerminatingReasonInTerminating = "InTerminating" // Terminating Reason
TerminatingReasonCompleted = "Completed" TerminatingReasonInTerminating = "InTerminating"
TerminatingReasonCompleted = "Completed"
) )
// CanaryStatus status fields that only pertain to the canary rollout // CanaryStatus status fields that only pertain to the canary rollout
type CanaryStatus struct { type CanaryStatus struct {
// observedWorkloadGeneration is the most recent generation observed for this Rollout ref workload generation.
ObservedWorkloadGeneration int64 `json:"observedWorkloadGeneration,omitempty"`
// CanaryService holds the name of a service which selects pods with canary version and don't select any pods with stable version. // CanaryService holds the name of a service which selects pods with canary version and don't select any pods with stable version.
CanaryService string `json:"canaryService"` CanaryService string `json:"canaryService"`
// CanaryRevision the hash of the current pod template // CanaryRevision the hash of the current pod template
@ -203,6 +222,7 @@ type CanaryStatus struct {
CanaryRevision string `json:"canaryRevision"` CanaryRevision string `json:"canaryRevision"`
// CanaryReplicas the numbers of canary revision pods // CanaryReplicas the numbers of canary revision pods
CanaryReplicas int32 `json:"canaryReplicas"` CanaryReplicas int32 `json:"canaryReplicas"`
// CanaryReadyReplicas the numbers of ready canary revision pods
CanaryReadyReplicas int32 `json:"canaryReadyReplicas"` CanaryReadyReplicas int32 `json:"canaryReadyReplicas"`
// CurrentStepIndex defines the current step of the rollout is on. If the current step index is null, the // CurrentStepIndex defines the current step of the rollout is on. If the current step index is null, the
// controller will execute the rollout. // controller will execute the rollout.
@ -211,7 +231,7 @@ type CanaryStatus struct {
CurrentStepState CanaryStepState `json:"currentStepState"` CurrentStepState CanaryStepState `json:"currentStepState"`
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
// The last time this step pods is ready. // The last time this step pods is ready.
LastReadyTime *metav1.Time `json:"lastReadyTime,omitempty"` LastUpdateTime *metav1.Time `json:"lastReadyTime,omitempty"`
} }
type CanaryStepState string type CanaryStepState string
@ -232,12 +252,20 @@ const (
RolloutPhaseInitial RolloutPhase = "Initial" RolloutPhaseInitial RolloutPhase = "Initial"
// RolloutPhaseHealthy indicates a rollout is healthy // RolloutPhaseHealthy indicates a rollout is healthy
RolloutPhaseHealthy RolloutPhase = "Healthy" RolloutPhaseHealthy RolloutPhase = "Healthy"
// RolloutPhasePreparing indicates a rollout is preparing for next progress.
RolloutPhasePreparing RolloutPhase = "Preparing"
// RolloutPhaseProgressing indicates a rollout is not yet healthy but still making progress towards a healthy state // RolloutPhaseProgressing indicates a rollout is not yet healthy but still making progress towards a healthy state
RolloutPhaseProgressing RolloutPhase = "Progressing" RolloutPhaseProgressing RolloutPhase = "Progressing"
// RolloutPhasePaused indicates a rollout is not yet healthy and will not make progress until paused=false // RolloutPhaseFinalizing indicates a rollout is finalizing
RolloutPhasePaused RolloutPhase = "Paused" RolloutPhaseFinalizing RolloutPhase = "Finalizing"
// RolloutPhaseTerminating indicates a rollout is terminated // RolloutPhaseTerminating indicates a rollout is terminated
RolloutPhaseTerminating RolloutPhase = "Terminating" RolloutPhaseTerminating RolloutPhase = "Terminating"
// RolloutPhaseCompleted indicates a rollout is completed
RolloutPhaseCompleted RolloutPhase = "Completed"
// RolloutPhaseCancelled indicates a rollout is cancelled
RolloutPhaseCancelled RolloutPhase = "Cancelled"
// RolloutPhaseRollback indicates workload has been rollback
RolloutPhaseRollback RolloutPhase = "Rollback"
) )
// +genclient // +genclient

View File

@ -1,7 +1,7 @@
// +build !ignore_autogenerated // +build !ignore_autogenerated
/* /*
Copyright 2022. Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -22,28 +22,9 @@ package v1alpha1
import ( import (
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
) )
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AlbTrafficRouting) DeepCopyInto(out *AlbTrafficRouting) {
*out = *in
if in.Tickets != nil {
in, out := &in.Tickets, &out.Tickets
*out = new(Tickets)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlbTrafficRouting.
func (in *AlbTrafficRouting) DeepCopy() *AlbTrafficRouting {
if in == nil {
return nil
}
out := new(AlbTrafficRouting)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BatchRelease) DeepCopyInto(out *BatchRelease) { func (in *BatchRelease) DeepCopyInto(out *BatchRelease) {
*out = *in *out = *in
@ -122,7 +103,8 @@ func (in *BatchReleaseList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BatchReleaseSpec) DeepCopyInto(out *BatchReleaseSpec) { func (in *BatchReleaseSpec) DeepCopyInto(out *BatchReleaseSpec) {
*out = *in *out = *in
out.TargetRef = in.TargetRef out.Strategy = in.Strategy
in.TargetRef.DeepCopyInto(&out.TargetRef)
in.ReleasePlan.DeepCopyInto(&out.ReleasePlan) in.ReleasePlan.DeepCopyInto(&out.ReleasePlan)
} }
@ -147,6 +129,11 @@ func (in *BatchReleaseStatus) DeepCopyInto(out *BatchReleaseStatus) {
} }
} }
in.CanaryStatus.DeepCopyInto(&out.CanaryStatus) in.CanaryStatus.DeepCopyInto(&out.CanaryStatus)
if in.CollisionCount != nil {
in, out := &in.CollisionCount, &out.CollisionCount
*out = new(int32)
**out = **in
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseStatus. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BatchReleaseStatus.
@ -162,8 +149,8 @@ func (in *BatchReleaseStatus) DeepCopy() *BatchReleaseStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CanaryStatus) DeepCopyInto(out *CanaryStatus) { func (in *CanaryStatus) DeepCopyInto(out *CanaryStatus) {
*out = *in *out = *in
if in.LastReadyTime != nil { if in.LastUpdateTime != nil {
in, out := &in.LastReadyTime, &out.LastReadyTime in, out := &in.LastUpdateTime, &out.LastUpdateTime
*out = (*in).DeepCopy() *out = (*in).DeepCopy()
} }
} }
@ -181,16 +168,12 @@ func (in *CanaryStatus) DeepCopy() *CanaryStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CanaryStep) DeepCopyInto(out *CanaryStep) { func (in *CanaryStep) DeepCopyInto(out *CanaryStep) {
*out = *in *out = *in
if in.SetWeight != nil { if in.Replicas != nil {
in, out := &in.SetWeight, &out.SetWeight in, out := &in.Replicas, &out.Replicas
*out = new(int32) *out = new(intstr.IntOrString)
**out = **in **out = **in
} }
if in.Pause != nil { in.Pause.DeepCopyInto(&out.Pause)
in, out := &in.Pause, &out.Pause
*out = new(RolloutPause)
(*in).DeepCopyInto(*out)
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryStep. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryStep.
@ -233,11 +216,6 @@ func (in *CanaryStrategy) DeepCopy() *CanaryStrategy {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NginxTrafficRouting) DeepCopyInto(out *NginxTrafficRouting) { func (in *NginxTrafficRouting) DeepCopyInto(out *NginxTrafficRouting) {
*out = *in *out = *in
if in.Tickets != nil {
in, out := &in.Tickets, &out.Tickets
*out = new(Tickets)
(*in).DeepCopyInto(*out)
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NginxTrafficRouting. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NginxTrafficRouting.
@ -253,6 +231,11 @@ func (in *NginxTrafficRouting) DeepCopy() *NginxTrafficRouting {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ObjectRef) DeepCopyInto(out *ObjectRef) { func (in *ObjectRef) DeepCopyInto(out *ObjectRef) {
*out = *in *out = *in
if in.WorkloadRef != nil {
in, out := &in.WorkloadRef, &out.WorkloadRef
*out = new(WorkloadRef)
**out = **in
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectRef. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectRef.
@ -306,6 +289,21 @@ func (in *ReleasePlan) DeepCopy() *ReleasePlan {
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ReleaseStrategy) DeepCopyInto(out *ReleaseStrategy) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReleaseStrategy.
func (in *ReleaseStrategy) DeepCopy() *ReleaseStrategy {
if in == nil {
return nil
}
out := new(ReleaseStrategy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Rollout) DeepCopyInto(out *Rollout) { func (in *Rollout) DeepCopyInto(out *Rollout) {
*out = *in *out = *in
@ -405,7 +403,7 @@ func (in *RolloutPause) DeepCopy() *RolloutPause {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RolloutSpec) DeepCopyInto(out *RolloutSpec) { func (in *RolloutSpec) DeepCopyInto(out *RolloutSpec) {
*out = *in *out = *in
out.TargetRef = in.TargetRef in.ObjectRef.DeepCopyInto(&out.ObjectRef)
in.Strategy.DeepCopyInto(&out.Strategy) in.Strategy.DeepCopyInto(&out.Strategy)
} }
@ -466,47 +464,13 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy {
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Tickets) DeepCopyInto(out *Tickets) {
*out = *in
if in.Header != nil {
in, out := &in.Header, &out.Header
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Cookie != nil {
in, out := &in.Cookie, &out.Cookie
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tickets.
func (in *Tickets) DeepCopy() *Tickets {
if in == nil {
return nil
}
out := new(Tickets)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TrafficRouting) DeepCopyInto(out *TrafficRouting) { func (in *TrafficRouting) DeepCopyInto(out *TrafficRouting) {
*out = *in *out = *in
if in.Nginx != nil { if in.Nginx != nil {
in, out := &in.Nginx, &out.Nginx in, out := &in.Nginx, &out.Nginx
*out = new(NginxTrafficRouting) *out = new(NginxTrafficRouting)
(*in).DeepCopyInto(*out) **out = **in
}
if in.Alb != nil {
in, out := &in.Alb, &out.Alb
*out = new(AlbTrafficRouting)
(*in).DeepCopyInto(*out)
} }
} }
@ -519,3 +483,18 @@ func (in *TrafficRouting) DeepCopy() *TrafficRouting {
in.DeepCopyInto(out) in.DeepCopyInto(out)
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkloadRef) DeepCopyInto(out *WorkloadRef) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadRef.
func (in *WorkloadRef) DeepCopy() *WorkloadRef {
if in == nil {
return nil
}
out := new(WorkloadRef)
in.DeepCopyInto(out)
return out
}

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2022. Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -12,4 +12,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */