From 33199cf82cf4de9b867401d53c14f76771de6b05 Mon Sep 17 00:00:00 2001 From: berg Date: Mon, 21 Feb 2022 10:51:35 +0800 Subject: [PATCH] rollout apis (#5) --- api/v1alpha1/batchrelease_plan_types.go | 67 +++++------ api/v1alpha1/batchrelease_types.go | 25 ++-- api/v1alpha1/groupversion_info.go | 2 +- api/v1alpha1/rollout_types.go | 144 ++++++++++++++---------- api/v1alpha1/zz_generated.deepcopy.go | 125 +++++++++----------- hack/boilerplate.go.txt | 4 +- 6 files changed, 194 insertions(+), 173 deletions(-) diff --git a/api/v1alpha1/batchrelease_plan_types.go b/api/v1alpha1/batchrelease_plan_types.go index 0af604e..b7af5ad 100644 --- a/api/v1alpha1/batchrelease_plan_types.go +++ b/api/v1alpha1/batchrelease_plan_types.go @@ -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"); you may not use this file except in compliance with the License. @@ -24,43 +24,32 @@ import ( // ReleaseStrategyType defines strategies for pods rollout type ReleaseStrategyType string -type ReleasingBatchStateType string - -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 +// ReleasePlan fines the details of the rollout plan 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"` // All pods in the batches up to the batchPartition (included) will have - // the target updated specification while the rest still have the stable resource - // This is designed for the operators to manually release plan - // Default is nil, which means no partition. + // the target resource specification while the rest still have the source resource + // This is designed for the operators to manually rollout + // Default is the the number of batches which will rollout all the batches // +optional BatchPartition *int32 `json:"batchPartition,omitempty"` - // Paused the release plan executor, default is false + // Paused the rollout, default is false // +optional 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 { - // Replicas is the number of expected canary pods in this batch - // it can be an absolute number (ex: 5) or a percentage of total pods. + // 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 + // we will ignore the percentage of the last batch to just fill the gap + // +optional // it is mutually exclusive with the PodList field CanaryReplicas intstr.IntOrString `json:"canaryReplicas"` // 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 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"` - // Canary describes the status of the canary + // Canary describes the state of the canary rollout CanaryStatus BatchReleaseCanaryStatus `json:"canaryStatus,omitempty"` // StableRevision is the pod-template-hash of stable revision pod. 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 // and does not change until the rollout is restarted. 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 string `json:"observedReleasePlanHash,omitempty"` // Phase is the release phase. @@ -92,8 +86,8 @@ type BatchReleaseStatus struct { } type BatchReleaseCanaryStatus struct { - // State indicates the state of the current batch. - State ReleasingBatchStateType `json:"state,omitempty"` + // ReleasingBatchState indicates the state of the current batch. + ReleasingBatchState ReleasingBatchStateType `json:"batchState,omitempty"` // The current batch the rollout is working on/blocked, it starts from 0 CurrentBatch int32 `json:"currentBatch"` // 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. UpdatedReadyReplicas int32 `json:"updatedReadyReplicas,omitempty"` } + +type ReleasingBatchStateType string + +const ( + InitializeBatchState ReleasingBatchStateType = "InitializeInBatch" + DoCanaryBatchState ReleasingBatchStateType = "DoCanaryInBatch" + VerifyBatchState ReleasingBatchStateType = "VerifyInBatch" + ReadyBatchState ReleasingBatchStateType = "ReadyInBatch" +) diff --git a/api/v1alpha1/batchrelease_types.go b/api/v1alpha1/batchrelease_types.go index c0fba2a..83ecebb 100644 --- a/api/v1alpha1/batchrelease_types.go +++ b/api/v1alpha1/batchrelease_types.go @@ -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"); you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import ( // +k8s:openapi-gen=true // +kubebuilder:object:root=true // +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="BATCH",type=integer,JSONPath=`.status.canaryStatus.currentBatch` // +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.canaryStatus.batchState` @@ -38,17 +38,28 @@ type BatchRelease struct { 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 { - // Cancelled is true indicates this batch release plan is cancelled. - // All resources about canary will be cleaned up. + Strategy ReleaseStrategy `json:"strategy,omitempty"` + // Cancel is true indicates this batch release plan is cancelled. 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"` - // 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"` } +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 // +kubebuilder:object:root=true type BatchReleaseList struct { diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 3f4b5cb..d670d1b 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -16,7 +16,7 @@ limitations under the License. // Package v1alpha1 contains API Schema definitions for the apps v1alpha1 API group //+kubebuilder:object:generate=true -//+groupName=apps.rollouts.io +//+groupName=rollouts.kruise.io package v1alpha1 import ( diff --git a/api/v1alpha1/rollout_types.go b/api/v1alpha1/rollout_types.go index 3a3138e..e752240 100644 --- a/api/v1alpha1/rollout_types.go +++ b/api/v1alpha1/rollout_types.go @@ -19,6 +19,7 @@ package v1alpha1 import ( corev1 "k8s.io/api/core/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! @@ -28,16 +29,34 @@ import ( type RolloutSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file - - // TargetRef contains enough information to let you identify a workload for Rollout - TargetRef ObjectRef `json:"targetRef"` - - // The deployment strategy to use to replace existing pods with new ones. + // ObjectRef indicates workload + ObjectRef ObjectRef `json:"objectRef"` + // rollout strategy Strategy RolloutStrategy `json:"strategy"` } -// ObjectRef holds a references to the Kubernetes object 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 APIVersion string `json:"apiVersion"` // Kind of the referent @@ -46,41 +65,51 @@ type ObjectRef struct { Name string `json:"name"` } +/*type ControllerRevisionRef struct { + TargetRevisionName string `json:"targetRevisionName"` + SourceRevisionName string `json:"sourceRevisionName"` +}*/ + // RolloutStrategy defines strategy to apply during next rollout type RolloutStrategy struct { - // +optional - // BlueGreen *BlueGreenStrategy `json:"blueGreen,omitempty" protobuf:"bytes,1,opt,name=blueGreen"` + // Paused indicates that the Rollout is paused. + // Default value is false + Paused bool `json:"paused,omitempty"` + // canary, BlueGreenPlan + // Default value is canary + Type RolloutStrategyType `json:"type,omitempty"` // +optional 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 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. - // +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 + // Steps define the order of phases to execute release in batches(20%, 40%, 60%, 80%, 100%) // +optional Steps []CanaryStep `json:"steps,omitempty"` // TrafficRouting hosts all the supported service meshes supported to enable more fine-grained traffic routing 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"` } // CanaryStep defines a step of a canary workload. type CanaryStep struct { // SetWeight sets what percentage of the canary pods should receive - SetWeight *int32 `json:"setWeight,omitempty"` - // Pause freezes the rollout by setting spec.Paused to true. - // A Rollout will resume when spec.Paused is reset to false. + Weight int32 `json:"weight,omitempty"` + // Replicas is the number of expected canary pods in this batch + // 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 - Pause *RolloutPause `json:"pause,omitempty"` - // MetricsAnalysis defines the AnalysisRun that will run for a step + Pause RolloutPause `json:"pause,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 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 *NginxTrafficRouting `json:"nginx,omitempty"` - // - Alb *AlbTrafficRouting `json:"alb,omitempty"` } type TrafficRoutingType string const ( TrafficRoutingNginx TrafficRoutingType = "nginx" - TrafficRoutingAlb TrafficRoutingType = "alb" ) // NginxTrafficRouting configuration for Nginx ingress controller to control traffic routing type NginxTrafficRouting 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"` -} - -// 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 @@ -135,12 +148,11 @@ type RolloutStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file - // observedGeneration is the most recent generation observed for this SidecarSet. It corresponds to the - // SidecarSet's generation, which is updated on mutation by the API Server. + // observedGeneration is the most recent generation observed for this Rollout. ObservedGeneration int64 `json:"observedGeneration,omitempty"` - // UpdateRevision the hash of the current pod template + // CanaryRevision the hash of the canary pod template // +optional - UpdateRevision string `json:"updateRevision,omitempty"` + CanaryRevision string `json:"canaryRevision,omitempty"` // StableRevision indicates the revision pods that has successfully rolled out StableRevision string `json:"stableRevision,omitempty"` // Conditions a list of conditions a rollout can have. @@ -149,7 +161,9 @@ type RolloutStatus struct { // Canary describes the state of the canary rollout // +optional 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"` // Message provides details on why the rollout is in its current phase Message string `json:"message,omitempty"` @@ -157,7 +171,7 @@ type RolloutStatus struct { // RolloutCondition describes the state of a rollout at a certain point. type RolloutCondition struct { - // Type of deployment condition. + // Type of rollout condition. Type RolloutConditionType `json:"type"` // Phase of the condition, one of True, False, Unknown. 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 // for paused rollouts. RolloutConditionProgressing RolloutConditionType = "Progressing" - // reason + // Progressing Reason ProgressingReasonInitializing = "Initializing" ProgressingReasonInRolling = "InRolling" ProgressingReasonFinalising = "Finalising" - ProgressingReasonFailed = "Failed" ProgressingReasonSucceeded = "Succeeded" + ProgressingReasonCancelling = "Cancelling" + ProgressingReasonCanceled = "Canceled" + ProgressingReasonPaused = "Paused" - RolloutConditionTerminating RolloutConditionType = "Terminating" - //reason - TerminatingReasonInTerminating = "InTerminating" - TerminatingReasonCompleted = "Completed" + // Terminating condition + RolloutConditionTerminating RolloutConditionType = "Terminating" + // Terminating Reason + TerminatingReasonInTerminating = "InTerminating" + TerminatingReasonCompleted = "Completed" ) // CanaryStatus status fields that only pertain to the canary rollout 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 string `json:"canaryService"` // CanaryRevision the hash of the current pod template @@ -203,6 +222,7 @@ type CanaryStatus struct { CanaryRevision string `json:"canaryRevision"` // CanaryReplicas the numbers of canary revision pods CanaryReplicas int32 `json:"canaryReplicas"` + // CanaryReadyReplicas the numbers of ready canary revision pods CanaryReadyReplicas int32 `json:"canaryReadyReplicas"` // CurrentStepIndex defines the current step of the rollout is on. If the current step index is null, the // controller will execute the rollout. @@ -211,7 +231,7 @@ type CanaryStatus struct { CurrentStepState CanaryStepState `json:"currentStepState"` Message string `json:"message,omitempty"` // The last time this step pods is ready. - LastReadyTime *metav1.Time `json:"lastReadyTime,omitempty"` + LastUpdateTime *metav1.Time `json:"lastReadyTime,omitempty"` } type CanaryStepState string @@ -232,12 +252,20 @@ const ( RolloutPhaseInitial RolloutPhase = "Initial" // RolloutPhaseHealthy indicates a rollout is 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 RolloutPhase = "Progressing" - // RolloutPhasePaused indicates a rollout is not yet healthy and will not make progress until paused=false - RolloutPhasePaused RolloutPhase = "Paused" + // RolloutPhaseFinalizing indicates a rollout is finalizing + RolloutPhaseFinalizing RolloutPhase = "Finalizing" // RolloutPhaseTerminating indicates a rollout is terminated 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 diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index d3c6f06..98ff3a3 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2022. +Copyright 2022 The Kruise Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,28 +22,9 @@ package v1alpha1 import ( 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. func (in *BatchRelease) DeepCopyInto(out *BatchRelease) { *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. func (in *BatchReleaseSpec) DeepCopyInto(out *BatchReleaseSpec) { *out = *in - out.TargetRef = in.TargetRef + out.Strategy = in.Strategy + in.TargetRef.DeepCopyInto(&out.TargetRef) in.ReleasePlan.DeepCopyInto(&out.ReleasePlan) } @@ -147,6 +129,11 @@ func (in *BatchReleaseStatus) DeepCopyInto(out *BatchReleaseStatus) { } } 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. @@ -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. func (in *CanaryStatus) DeepCopyInto(out *CanaryStatus) { *out = *in - if in.LastReadyTime != nil { - in, out := &in.LastReadyTime, &out.LastReadyTime + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime *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. func (in *CanaryStep) DeepCopyInto(out *CanaryStep) { *out = *in - if in.SetWeight != nil { - in, out := &in.SetWeight, &out.SetWeight - *out = new(int32) + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(intstr.IntOrString) **out = **in } - if in.Pause != nil { - in, out := &in.Pause, &out.Pause - *out = new(RolloutPause) - (*in).DeepCopyInto(*out) - } + in.Pause.DeepCopyInto(&out.Pause) } // 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. func (in *NginxTrafficRouting) DeepCopyInto(out *NginxTrafficRouting) { *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. @@ -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. func (in *ObjectRef) DeepCopyInto(out *ObjectRef) { *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. @@ -306,6 +289,21 @@ func (in *ReleasePlan) DeepCopy() *ReleasePlan { 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. func (in *Rollout) DeepCopyInto(out *Rollout) { *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. func (in *RolloutSpec) DeepCopyInto(out *RolloutSpec) { *out = *in - out.TargetRef = in.TargetRef + in.ObjectRef.DeepCopyInto(&out.ObjectRef) in.Strategy.DeepCopyInto(&out.Strategy) } @@ -466,47 +464,13 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { 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. func (in *TrafficRouting) DeepCopyInto(out *TrafficRouting) { *out = *in if in.Nginx != nil { in, out := &in.Nginx, &out.Nginx *out = new(NginxTrafficRouting) - (*in).DeepCopyInto(*out) - } - if in.Alb != nil { - in, out := &in.Alb, &out.Alb - *out = new(AlbTrafficRouting) - (*in).DeepCopyInto(*out) + **out = **in } } @@ -519,3 +483,18 @@ func (in *TrafficRouting) DeepCopy() *TrafficRouting { in.DeepCopyInto(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 +} diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index 29c55ec..95a55cf 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* -Copyright 2022. +Copyright 2022 The Kruise Authors. Licensed under the Apache License, Version 2.0 (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. See the License for the specific language governing permissions and limitations under the License. -*/ \ No newline at end of file +*/