add header-value annotation
add new annotation (header-value) parse it and propogate to lua script alter balancer rule to include it into the canary routing logic add e2e test to validate fallback for canary-by-header-value add description of canary-by-header-value to documentation
This commit is contained in:
parent
e7e8d1a0f2
commit
de2a1ece6d
7 changed files with 155 additions and 13 deletions
|
|
@ -30,10 +30,11 @@ type canary struct {
|
|||
|
||||
// Config returns the configuration rules for setting up the Canary
|
||||
type Config struct {
|
||||
Enabled bool
|
||||
Weight int
|
||||
Header string
|
||||
Cookie string
|
||||
Enabled bool
|
||||
Weight int
|
||||
Header string
|
||||
HeaderValue string
|
||||
Cookie string
|
||||
}
|
||||
|
||||
// NewParser parses the ingress for canary related annotations
|
||||
|
|
@ -62,12 +63,17 @@ func (c canary) Parse(ing *extensions.Ingress) (interface{}, error) {
|
|||
config.Header = ""
|
||||
}
|
||||
|
||||
config.HeaderValue, err = parser.GetStringAnnotation("canary-by-header-value", ing)
|
||||
if err != nil {
|
||||
config.HeaderValue = ""
|
||||
}
|
||||
|
||||
config.Cookie, err = parser.GetStringAnnotation("canary-by-cookie", ing)
|
||||
if err != nil {
|
||||
config.Cookie = ""
|
||||
}
|
||||
|
||||
if !config.Enabled && (config.Weight > 0 || len(config.Header) > 0 || len(config.Cookie) > 0) {
|
||||
if !config.Enabled && (config.Weight > 0 || len(config.Header) > 0 || len(config.HeaderValue) > 0 || len(config.Cookie) > 0) {
|
||||
return nil, errors.NewInvalidAnnotationConfiguration("canary", "configured but not enabled")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue