configmap: option to not trust incoming tracing spans (#7045)
* validate the sender of tracing spans * add location-specific setting
This commit is contained in:
parent
e4001df41e
commit
7d5452d00b
9 changed files with 124 additions and 34 deletions
|
|
@ -29,8 +29,10 @@ type opentracing struct {
|
|||
|
||||
// Config contains the configuration to be used in the Ingress
|
||||
type Config struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Set bool `json:"set"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Set bool `json:"set"`
|
||||
TrustEnabled bool `json:"trust-enabled"`
|
||||
TrustSet bool `json:"trust-set"`
|
||||
}
|
||||
|
||||
// Equal tests for equality between two Config types
|
||||
|
|
@ -43,6 +45,14 @@ func (bd1 *Config) Equal(bd2 *Config) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if bd1.TrustSet != bd2.TrustSet {
|
||||
return false
|
||||
}
|
||||
|
||||
if bd1.TrustEnabled != bd2.TrustEnabled {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -54,8 +64,13 @@ 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{Set: false, Enabled: false}, nil
|
||||
return &Config{}, nil
|
||||
}
|
||||
|
||||
return &Config{Set: true, Enabled: enabled}, nil
|
||||
trustSpan, err := parser.GetBoolAnnotation("opentracing-trust-incoming-span", ing)
|
||||
if err != nil {
|
||||
return &Config{Set: true, Enabled: enabled}, nil
|
||||
}
|
||||
|
||||
return &Config{Set: true, Enabled: enabled, TrustSet: true, TrustEnabled: trustSpan}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue