Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change v1beta1 apis #183

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 103 additions & 55 deletions api/v1beta1/rollout_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,51 +38,21 @@ const (
// Only when RolloutIDLabel is set, RolloutBatchIDLabel will be patched.
// Users can use RolloutIDLabel and RolloutBatchIDLabel to select the pods that are upgraded in some certain batch and release.
RolloutBatchIDLabel = "rollouts.kruise.io/rollout-batch-id"

// RollbackInBatchAnnotation is set to rollout annotations.
// RollbackInBatchAnnotation allow use disable quick rollback, and will roll back in batch style.
RollbackInBatchAnnotation = "rollouts.kruise.io/rollback-in-batch"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this label removed?


// RolloutStyleAnnotation define the rolling behavior for Deployment.
// must be "partition" or "canary":
// * "partition" means rolling in batches just like CloneSet, and will NOT create any extra Workload;
// * "canary" means rolling in canary way, and will create a canary Workload.
// Currently, only Deployment support both "partition" and "canary" rolling styles.
// For other workload types, they only support "partition" styles.
// Defaults to "canary" to Deployment.
// Defaults to "partition" to the others.
RolloutStyleAnnotation = "rollouts.kruise.io/rolling-style"

// TrafficRoutingAnnotation is the TrafficRouting Name, and it is the Rollout's TrafficRouting.
// The Rollout release will trigger the TrafficRouting release. For example:
// A microservice consists of three applications, and the invocation relationship is as follows: a -> b -> c,
// and application(a, b, c)'s gateway is trafficRouting. Any application(a, b or b) release will trigger TrafficRouting release.
TrafficRoutingAnnotation = "rollouts.kruise.io/trafficrouting"
)

// RolloutSpec defines the desired state of Rollout
type RolloutSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// ObjectRef indicates workload
ObjectRef ObjectRef `json:"objectRef"`
// WorkloadRef contains enough information to let you identify a workload for Rollout
// Batch release of the bypass
WorkloadRef *WorkloadRef `json:"workloadRef"`
// rollout strategy
Strategy RolloutStrategy `json:"strategy"`
// DeprecatedRolloutID is the deprecated field.
// It is recommended that configure RolloutId in workload.annotations[rollouts.kruise.io/rollout-id].
// RolloutID should be changed before each workload revision publication.
// It is to distinguish consecutive multiple workload publications and rollout progress.
DeprecatedRolloutID string `json:"rolloutID,omitempty"`
// if a rollout disabled, then the rollout would not watch changes of workload
//+kubebuilder:validation:Optional
//+kubebuilder:default=false
Disabled bool `json:"disabled"`
}

type ObjectRef struct {
// WorkloadRef contains enough information to let you identify a workload for Rollout
// Batch release of the bypass
WorkloadRef *WorkloadRef `json:"workloadRef,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}

// WorkloadRef holds a references to the Kubernetes object
Expand All @@ -100,46 +70,124 @@ type RolloutStrategy struct {
// Paused indicates that the Rollout is paused.
// Default value is false
Paused bool `json:"paused,omitempty"`
// +optional
// Canary is Canary Release or A/B Testing Release
// (Scenario 1) A/B Testing, header[user-agent] of request http will be routing to canary version.
// canary:
// replicas: 1
// matches:
// - headers:
// - name: user-agent
// type: Exact
// value: pc
// trafficRoutings:
// - service: service-demo
// ingress:
// classType: nginx
// name: ingress-demo
// (Scenario 2) canary release, 10 percent of request http will be routing to canary version.
// canary:
// replicas: 1
// weight: 10
// trafficRoutings:
// - service: service-demo
// ingress:
// classType: nginx
// name: ingress-demo
// Traffic Graying, include canary release, A/B Testing release
Canary *CanaryStrategy `json:"canary,omitempty"`
}

// CanaryStrategy defines parameters for a Replica Based Canary
type CanaryStrategy struct {
// Steps define the order of phases to execute release in batches(20%, 40%, 60%, 80%, 100%)
// Batches is batch release capacity,
// (Scenario 1) Users can only instance replicas:
// batches:
// steps:
// - replicas: 1 # batches 0
// - replicas: 2 # batches 1
// - replicas: 5 # batches 2
// (Scenario 2) Users can a/b testing combined with batch release:
// batches:
// steps:
// - replicas: 1
// matches:
// - headers:
// - name: user-agent
// type: Exact
// value: pc
// - replicas: 20%
// - replicas: 40%
// - replicas: 80%
// - replicas: 100%
// trafficRoutings:
// - service: service-demo
// ingress:
// classType: nginx
// name: ingress-demo
// (Scenario 3) Users can traffic weight combined with batch release:
// batches:
// steps:
// - replicas: 1
// weight: 10
// - replicas: 20%
// - replicas: 40%
// - replicas: 80%
// - replicas: 100%
// trafficRoutings:
// - service: service-demo
// ingress:
// classType: nginx
// name: ingress-demo
// Not that these replicas should be a non-decreasing sequence.
// +optional
Steps []CanaryStep `json:"steps,omitempty"`
// TrafficRoutings hosts all the supported service meshes supported to enable more fine-grained traffic routing
// and current only support one TrafficRouting
TrafficRoutings []v1alpha1.TrafficRoutingRef `json:"trafficRoutings,omitempty"`
Batches *BatchStrategy `json:"batches,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

batches -> Batch ?

// FailureThreshold indicates how many failed pods can be tolerated in all upgraded pods.
// Only when FailureThreshold are satisfied, Rollout can enter ready state.
// If FailureThreshold is nil, Rollout will use the MaxUnavailable of workload as its
// FailureThreshold.
// Defaults to nil.
FailureThreshold *intstr.IntOrString `json:"failureThreshold,omitempty"`
// PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata
// only support for canary deployment
// +optional
PatchPodTemplateMetadata *PatchPodTemplateMetadata `json:"patchPodTemplateMetadata,omitempty"`
}

type PatchPodTemplateMetadata struct {
// annotations
Annotations map[string]string `json:"annotations,omitempty"`
// labels
Labels map[string]string `json:"labels,omitempty"`
type BatchStrategy struct {
BatchStep []BatchStep `json:"steps"`
// TrafficRoutings hosts all the supported service meshes supported to enable more fine-grained traffic routing
// and current only support one TrafficRouting
TrafficRoutings []v1alpha1.TrafficRoutingRef `json:"trafficRoutings"`
}

type BatchStep struct {
v1alpha1.TrafficRoutingStrategy `json:",inline"`
// 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"`
// Pause defines a pause stage for a rollout, manual or auto
// +optional
Pause RolloutPause `json:"pause,omitempty"`
}

// CanaryStep defines a step of a canary workload.
type CanaryStep struct {
// CanaryStrategy defines parameters for a Replica Based Canary
type CanaryStrategy struct {
v1alpha1.TrafficRoutingStrategy `json:",inline"`
// 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"`
// TrafficRoutings hosts all the supported service meshes supported to enable more fine-grained traffic routing
// and current only support one TrafficRouting
TrafficRoutings []v1alpha1.TrafficRoutingRef `json:"trafficRoutings"`
veophi marked this conversation as resolved.
Show resolved Hide resolved
// End-to-end progressive delivery capacity for microservice application,
// TrafficRoutingRef is Type TrafficRouting's Name
TrafficRoutingRef string `json:"trafficRoutingRef,omitempty"`
// PatchPodTemplateMetadata indicates patch configuration(e.g. labels, annotations) to the canary deployment podTemplateSpec.metadata
// only support for canary deployment
// +optional
PatchPodTemplateMetadata *PatchPodTemplateMetadata `json:"patchPodTemplateMetadata,omitempty"`
}

type PatchPodTemplateMetadata struct {
// annotations
Annotations map[string]string `json:"annotations,omitempty"`
// labels
Labels map[string]string `json:"labels,omitempty"`
}

type HttpRouteMatch struct {
Expand Down
6 changes: 5 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 21 additions & 25 deletions config/crd/bases/rollouts.kruise.io_rollouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -567,30 +567,6 @@ spec:
description: if a rollout disabled, then the rollout would not watch
changes of workload
type: boolean
objectRef:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "make" to regenerate code after modifying this file
ObjectRef indicates workload'
properties:
workloadRef:
description: WorkloadRef contains enough information to let you
identify a workload for Rollout Batch release of the bypass
properties:
apiVersion:
description: API Version of the referent
type: string
kind:
description: Kind of the referent
type: string
name:
description: Name of the referent
type: string
required:
- apiVersion
- kind
- name
type: object
type: object
rolloutID:
description: DeprecatedRolloutID is the deprecated field. It is recommended
that configure RolloutId in workload.annotations[rollouts.kruise.io/rollout-id].
Expand Down Expand Up @@ -911,8 +887,28 @@ spec:
value is false
type: boolean
type: object
workloadRef:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "make" to regenerate code after modifying this file
DeprecatedObjectRef indicates workload DeprecatedObjectRef ObjectRef
`json:"objectRef"` WorkloadRef contains enough information to let
you identify a workload for Rollout Batch release of the bypass'
properties:
apiVersion:
description: API Version of the referent
type: string
kind:
description: Kind of the referent
type: string
name:
description: Name of the referent
type: string
required:
- apiVersion
- kind
- name
type: object
required:
- objectRef
- strategy
type: object
status:
Expand Down
Loading