fix(ingress): nil deref in parseRules, missing httpLoader.Close, swallowed SetRule error
- parseRules: add nil guard before accessing rule.Hostname (parseLine returns nil for comments, blanks, and invalid lines) - Close: call httpLoader.Close() alongside fileLoader and redisLoader - grpcPlugin.SetRule: log error and return false instead of discarding it - Add 28 unit tests covering parseLine, parseRules, GetRule wildcard matching, reload, Close, and all loader types
This commit is contained in:
@@ -81,11 +81,15 @@ func (p *grpcPlugin) SetRule(ctx context.Context, rule *ingress.Rule, opts ...in
|
||||
opt(&options)
|
||||
}
|
||||
|
||||
r, _ := p.client.SetRule(ctx, &proto.SetRuleRequest{
|
||||
r, err := p.client.SetRule(ctx, &proto.SetRuleRequest{
|
||||
Service: options.Service,
|
||||
Host: rule.Hostname,
|
||||
Endpoint: rule.Endpoint,
|
||||
})
|
||||
if err != nil {
|
||||
p.log.Error(err)
|
||||
return false
|
||||
}
|
||||
if r == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user