Ignore ErrKeyNotFound error for the KV provider
This commit is contained in:
parent
c3880a69ca
commit
173154cf59
3 changed files with 88 additions and 0 deletions
|
@ -136,6 +136,16 @@ func (p *Provider) watchKv(ctx context.Context, configurationChan chan<- dynamic
|
|||
func (p *Provider) buildConfiguration(ctx context.Context) (*dynamic.Configuration, error) {
|
||||
pairs, err := p.kvClient.List(ctx, p.RootKey, nil)
|
||||
if err != nil {
|
||||
if errors.Is(err, store.ErrKeyNotFound) {
|
||||
// This empty configuration satisfies the pkg/server/configurationwatcher.go isEmptyConfiguration func constraints,
|
||||
// and will not be discarded by the configuration watcher.
|
||||
return &dynamic.Configuration{
|
||||
HTTP: &dynamic.HTTPConfiguration{
|
||||
Routers: make(map[string]*dynamic.Router),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue