Add hook type to CRD

- pre-rollout execute webhook before routing traffic to canary
- rollout execute webhook during the canary analysis on each iteration
- post-rollout execute webhook after the canary has been promoted or rolled back
Add canary phase to webhook payload
This commit is contained in:
stefanprodan
2019-04-13 15:37:41 +03:00
parent 4ac6629969
commit e0fc5ecb39
+17 -3
View File
@@ -148,11 +148,24 @@ type CanaryMetric struct {
Query string `json:"query,omitempty"`
}
// HookType can be pre, post or during rollout
type HookType string
const (
// RolloutHook execute webhook during the canary analysis
RolloutHook HookType = "rollout"
// PreRolloutHook execute webhook before routing traffic to canary
PreRolloutHook HookType = "pre-rollout"
// PreRolloutHook execute webhook after the canary analysis
PostRolloutHook HookType = "post-rollout"
)
// CanaryWebhook holds the reference to external checks used for canary analysis
type CanaryWebhook struct {
Name string `json:"name"`
URL string `json:"url"`
Timeout string `json:"timeout"`
Type HookType `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
Timeout string `json:"timeout"`
// +optional
Metadata *map[string]string `json:"metadata,omitempty"`
}
@@ -161,6 +174,7 @@ type CanaryWebhook struct {
type CanaryWebhookPayload struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Phase CanaryPhase `json:"phase"`
Metadata map[string]string `json:"metadata,omitempty"`
}