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

add finalizing webhook #1194

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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: 2 additions & 0 deletions artifacts/flagger/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@ spec:
- pre-rollout
- rollout
- confirm-promotion
- confirm-finalizing
- post-rollout
- event
- rollback
Expand Down Expand Up @@ -1027,6 +1028,7 @@ spec:
- Progressing
- WaitingPromotion
- Promoting
- WaitingFinalising
- Finalising
- Succeeded
- Failed
Expand Down
2 changes: 2 additions & 0 deletions charts/flagger/crds/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@ spec:
- pre-rollout
- rollout
- confirm-promotion
- confirm-finalizing
- post-rollout
- event
- rollback
Expand Down Expand Up @@ -1028,6 +1029,7 @@ spec:
- WaitingPromotion
- Promoting
- Finalising
- WaitingFinalising
- Succeeded
- Failed
- Terminating
Expand Down
16 changes: 9 additions & 7 deletions pkg/apis/flagger/v1beta1/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,22 +319,24 @@ type CanaryAlert struct {
type HookType string

const (
// RolloutHook execute webhook during the canary analysis
// RolloutHook executes webhook during the canary analysis
RolloutHook HookType = "rollout"
// PreRolloutHook execute webhook before routing traffic to canary
// PreRolloutHook executes webhook before routing traffic to canary
PreRolloutHook HookType = "pre-rollout"
// PostRolloutHook execute webhook after the canary analysis
// PostRolloutHook executes webhook after the canary analysis
PostRolloutHook HookType = "post-rollout"
// ConfirmRolloutHook halt canary analysis until webhook returns HTTP 200
// ConfirmRolloutHook halts canary analysis until webhook returns HTTP 200
ConfirmRolloutHook HookType = "confirm-rollout"
// ConfirmPromotionHook halt canary promotion until webhook returns HTTP 200
// ConfirmPromotionHook halts canary promotion until webhook returns HTTP 200
ConfirmPromotionHook HookType = "confirm-promotion"
// ConfirmFinalizingHook halts canary finalizing until webhook returns HTTP 200
ConfirmFinalizingHook HookType = "confirm-finalizing"
// EventHook dispatches Flagger events to the specified endpoint
EventHook HookType = "event"
// RollbackHook rollback canary analysis if webhook returns HTTP 200
// RollbackHook rollbacks canary analysis if webhook returns HTTP 200
RollbackHook HookType = "rollback"
// ConfirmTrafficIncreaseHook increases traffic weight if webhook returns HTTP 200
ConfirmTrafficIncreaseHook = "confirm-traffic-increase"
ConfirmTrafficIncreaseHook HookType = "confirm-traffic-increase"
)

// CanaryWebhook holds the reference to external checks used for canary analysis
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/flagger/v1beta1/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const (
CanaryPhaseWaitingPromotion CanaryPhase = "WaitingPromotion"
// CanaryPhasePromoting means the canary analysis is finished and the primary spec has been updated
CanaryPhasePromoting CanaryPhase = "Promoting"
// CanaryPhaseWaitingFinalising means the canary finalising is paused (waiting for confirmation to proceed)
CanaryPhaseWaitingFinalising CanaryPhase = "WaitingFinalising"
// CanaryPhaseFinalising means the canary promotion is finished and traffic has been routed back to primary
CanaryPhaseFinalising CanaryPhase = "Finalising"
// CanaryPhaseSucceeded means the canary analysis has been successful
Expand Down
15 changes: 9 additions & 6 deletions pkg/canary/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,25 @@ func MakeStatusConditions(cd *flaggerv1.Canary,
message = fmt.Sprintf("%s initialization completed.", cd.Spec.TargetRef.Kind)
case flaggerv1.CanaryPhaseWaiting:
status = corev1.ConditionUnknown
message = "Waiting for approval."
case flaggerv1.CanaryPhaseWaitingPromotion:
status = corev1.ConditionUnknown
message = "Waiting for approval."
message = "Waiting for approval to start canary handling."
case flaggerv1.CanaryPhaseProgressing:
status = corev1.ConditionUnknown
message = "New revision detected, progressing canary analysis."
case flaggerv1.CanaryPhaseWaitingPromotion:
status = corev1.ConditionUnknown
message = "Waiting for approval to start primary rolling update"
case flaggerv1.CanaryPhasePromoting:
status = corev1.ConditionUnknown
message = "Canary analysis completed, starting primary rolling update."
case flaggerv1.CanaryPhaseWaitingFinalising:
status = corev1.ConditionUnknown
message = "Waiting for approval to start finalizing"
case flaggerv1.CanaryPhaseFinalising:
status = corev1.ConditionUnknown
message = "Canary analysis completed, routing all traffic to primary."
message = "Primary rolling update completed, routed all traffic to primary."
case flaggerv1.CanaryPhaseSucceeded:
status = corev1.ConditionTrue
message = "Canary analysis completed successfully, promotion finished."
message = "Canary analysis completed successfully, promotion & finlization finished."
case flaggerv1.CanaryPhaseFailed:
status = corev1.ConditionFalse
message = fmt.Sprintf("Canary analysis failed, %s scaled to zero.", cd.Spec.TargetRef.Kind)
Expand Down
Loading