mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
add field for configuring canary threshold
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
This commit is contained in:
@@ -30,6 +30,7 @@ const (
|
||||
ProgressDeadlineSeconds = 600
|
||||
AnalysisInterval = 60 * time.Second
|
||||
PrimaryReadyThreshold = 100
|
||||
CanaryReadyThreshold = 100
|
||||
MetricInterval = "1m"
|
||||
)
|
||||
|
||||
@@ -233,6 +234,9 @@ type CanaryAnalysis struct {
|
||||
// Percentage of pods that need to be available to consider primary as ready
|
||||
PrimaryReadyThreshold *int `json:"primaryReadyThreshold,omitempty"`
|
||||
|
||||
// Percentage of pods that need to be available to consider canary as ready
|
||||
CanaryReadyThreshold *int `json:"canaryReadyThreshold,omitempty"`
|
||||
|
||||
// Alert list for this canary analysis
|
||||
Alerts []CanaryAlert `json:"alerts,omitempty"`
|
||||
|
||||
@@ -452,6 +456,14 @@ func (c *Canary) GetAnalysisPrimaryReadyThreshold() int {
|
||||
return PrimaryReadyThreshold
|
||||
}
|
||||
|
||||
// GetAnalysisCanaryReadyThreshold returns the canary canaryReadyThreshold (default 100)
|
||||
func (c *Canary) GetAnalysisCanaryReadyThreshold() int {
|
||||
if c.GetAnalysis().CanaryReadyThreshold != nil {
|
||||
return *c.GetAnalysis().CanaryReadyThreshold
|
||||
}
|
||||
return CanaryReadyThreshold
|
||||
}
|
||||
|
||||
// GetMetricInterval returns the metric interval default value (1m)
|
||||
func (c *Canary) GetMetricInterval() string {
|
||||
return MetricInterval
|
||||
|
||||
@@ -208,6 +208,11 @@ func (in *CanaryAnalysis) DeepCopyInto(out *CanaryAnalysis) {
|
||||
*out = new(int)
|
||||
**out = **in
|
||||
}
|
||||
if in.CanaryReadyThreshold != nil {
|
||||
in, out := &in.CanaryReadyThreshold, &out.CanaryReadyThreshold
|
||||
*out = new(int)
|
||||
**out = **in
|
||||
}
|
||||
if in.Alerts != nil {
|
||||
in, out := &in.Alerts, &out.Alerts
|
||||
*out = make([]CanaryAlert, len(*in))
|
||||
|
||||
Reference in New Issue
Block a user