Skip to content
Open
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AIBRIX_IMAGES := $(foreach img,$(IMAGES),$(AIBRIX_CONTAINER_REGISTRY_NAMESPACE)/
IMG ?= ${AIBRIX_CONTAINER_REGISTRY_NAMESPACE}/controller-manager:${IMAGE_TAG}

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.29.0
ENVTEST_K8S_VERSION = 1.30.0

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down
107 changes: 107 additions & 0 deletions api/orchestration/v1alpha1/stormservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ type StormServiceStatus struct {
//
// +optional
RoleStatuses []RoleStatus `json:"roleStatuses,omitempty"`

// CanaryStatus tracks the progress of canary deployments.
// +optional
CanaryStatus *CanaryStatus `json:"canaryStatus,omitempty"`
}

// These are valid conditions of a stormService.
Expand Down Expand Up @@ -158,6 +162,10 @@ type StormServiceUpdateStrategy struct {

// +optional
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"`

// Canary defines the canary deployment strategy for gradual rollouts.
// +optional
Canary *CanaryUpdateStrategy `json:"canary,omitempty"`
}

// +enum
Expand Down Expand Up @@ -197,6 +205,105 @@ type StormServiceList struct {
Items []StormService `json:"items"`
}

// CanaryUpdateStrategy defines the canary deployment configuration
type CanaryUpdateStrategy struct {
// Steps defines the sequence of canary deployment steps
Steps []CanaryStep `json:"steps,omitempty"`
}

// CanaryStep defines a single step in the canary deployment process
type CanaryStep struct {
// SetWeight defines the percentage of traffic/replicas to route to the new version
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=100
// +optional
SetWeight *int32 `json:"setWeight,omitempty"`

// Pause defines a pause in the canary deployment
// +optional
Pause *PauseStep `json:"pause,omitempty"`
}

// PauseStep defines pause behavior in canary deployments
type PauseStep struct {
// Duration specifies how long to pause
// - String: "30s", "5m", etc. (parsed as time.Duration)
// - Int: seconds as integer
// - nil: manual pause requiring user intervention
// Resume manual pause by setting duration to "0" or 0

// Duration field is accepted but not implemented.
// At this moment, all pauses are manual and require removing the pause condition to resume.
// - pause: {} # this is accepted
// - pause: # api accepted but not implemented.
// duration: "60s"
Comment on lines +235 to +239
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The comment here clearly states that the Duration field is not implemented and all pauses are manual. This is great for developers reading the Go code. However, this important information is not propagated to the CRD definition, which can be misleading for users of the API. It would be beneficial to add a +kubebuilder:doc comment to ensure this limitation is reflected in the CRD's description field for PauseStep.Duration.


// +optional
Duration *intstr.IntOrString `json:"duration,omitempty"`
}

// CanaryStatus tracks the progress of a canary deployment
type CanaryStatus struct {
// CurrentStep is the index of the current step in the canary deployment
// +optional
CurrentStep int32 `json:"currentStep,omitempty"`

// PauseConditions indicates the reasons why the canary deployment is paused
// When paused, the first pause condition's StartTime indicates when the pause began
// +optional
PauseConditions []PauseCondition `json:"pauseConditions,omitempty"`

// NOTE: Removed StableRevision and CanaryRevision fields
// Use status.CurrentRevision for stable revision
// Use status.UpdateRevision for canary revision

// Phase indicates the current phase of the canary deployment
// +optional
Phase CanaryPhase `json:"phase,omitempty"`

// AbortedAt indicates when the canary deployment was aborted
// +optional
AbortedAt *metav1.Time `json:"abortedAt,omitempty"`

// Message provides details about the current canary state
// +optional
Message string `json:"message,omitempty"`
}

// CanaryPhase represents the phase of a canary deployment
// +enum
type CanaryPhase string

const (
// CanaryPhaseInitializing indicates the canary deployment is starting
CanaryPhaseInitializing CanaryPhase = "Initializing"
// CanaryPhaseProgressing indicates the canary deployment is progressing through steps
CanaryPhaseProgressing CanaryPhase = "Progressing"
// CanaryPhasePaused indicates the canary deployment is paused
CanaryPhasePaused CanaryPhase = "Paused"
// CanaryPhaseCompleted indicates the canary deployment has completed successfully
CanaryPhaseCompleted CanaryPhase = "Completed"
// CanaryPhaseAborted indicates the canary deployment was aborted/rolled back
CanaryPhaseAborted CanaryPhase = "Aborted"
)

// PauseReason represents the reason for a pause condition
// +enum
type PauseReason string

const (
// PauseReasonCanaryPauseStep indicates a pause at a canary step
PauseReasonCanaryPauseStep PauseReason = "CanaryPauseStep"
)

// PauseCondition represents a pause condition in the canary deployment
type PauseCondition struct {
// Reason indicates why the canary deployment was paused
Reason PauseReason `json:"reason"`
// StartTime is when the pause condition was added
StartTime metav1.Time `json:"startTime"`
}

func init() {
SchemeBuilder.Register(&StormService{}, &StormServiceList{})
}
119 changes: 119 additions & 0 deletions api/orchestration/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -4106,6 +4106,27 @@ spec:
type: object
updateStrategy:
properties:
canary:
properties:
steps:
items:
properties:
pause:
properties:
duration:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
type: object
setWeight:
format: int32
maximum: 100
minimum: 0
type: integer
type: object
type: array
type: object
maxSurge:
anyOf:
- type: integer
Expand All @@ -4129,6 +4150,32 @@ spec:
type: object
status:
properties:
canaryStatus:
properties:
abortedAt:
format: date-time
type: string
currentStep:
format: int32
type: integer
message:
type: string
pauseConditions:
items:
properties:
reason:
type: string
startTime:
format: date-time
type: string
required:
- reason
- startTime
type: object
type: array
phase:
type: string
type: object
collisionCount:
format: int32
type: integer
Expand Down
Loading