Fix enable opentracing per location (#4983)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-01-29 12:20:05 -03:00 committed by GitHub
parent 19e9e9d7ed
commit 5d05e19cc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 147 additions and 35 deletions

View file

@ -30,10 +30,15 @@ type opentracing struct {
// Config contains the configuration to be used in the Ingress
type Config struct {
Enabled bool `json:"enabled"`
Set bool `json:"set"`
}
// Equal tests for equality between two Config types
func (bd1 *Config) Equal(bd2 *Config) bool {
if bd1.Set != bd2.Set {
return false
}
if bd1.Enabled != bd2.Enabled {
return false
}
@ -49,8 +54,8 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation {
func (s opentracing) Parse(ing *networking.Ingress) (interface{}, error) {
enabled, err := parser.GetBoolAnnotation("enable-opentracing", ing)
if err != nil {
return &Config{Enabled: false}, nil
return &Config{Set: false, Enabled: false}, nil
}
return &Config{Enabled: enabled}, nil
return &Config{Set: true, Enabled: enabled}, nil
}