add canary-weight-total annotation (#6338)

This commit is contained in:
Yecheng Fu 2021-12-08 00:40:00 +08:00 committed by GitHub
parent 6163231ef6
commit 5cff197bc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 71 additions and 5 deletions

View file

@ -32,6 +32,7 @@ type canary struct {
type Config struct {
Enabled bool
Weight int
WeightTotal int
Header string
HeaderValue string
HeaderPattern string
@ -59,6 +60,11 @@ func (c canary) Parse(ing *networking.Ingress) (interface{}, error) {
config.Weight = 0
}
config.WeightTotal, err = parser.GetIntAnnotation("canary-weight-total", ing)
if err != nil {
config.WeightTotal = 100
}
config.Header, err = parser.GetStringAnnotation("canary-by-header", ing)
if err != nil {
config.Header = ""