logs should return for non existent services (#1906)
This commit is contained in:
parent
74907987d1
commit
835343d6a5
@ -364,6 +364,7 @@ func (k *kubernetes) Logs(s *runtime.Service, options ...runtime.LogsOption) (ru
|
|||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
kstream.Chan() <- record
|
kstream.Chan() <- record
|
||||||
}
|
}
|
||||||
|
kstream.Stop()
|
||||||
}()
|
}()
|
||||||
return kstream, nil
|
return kstream, nil
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/micro/go-micro/v3/errors"
|
||||||
"github.com/micro/go-micro/v3/runtime"
|
"github.com/micro/go-micro/v3/runtime"
|
||||||
"github.com/micro/go-micro/v3/util/kubernetes/client"
|
"github.com/micro/go-micro/v3/util/kubernetes/client"
|
||||||
"github.com/micro/go-micro/v3/util/log"
|
"github.com/micro/go-micro/v3/util/log"
|
||||||
@ -105,6 +106,9 @@ func (k *klog) Read() ([]runtime.LogRecord, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if len(pods) == 0 {
|
||||||
|
return nil, errors.NotFound("runtime.logs", "no such service")
|
||||||
|
}
|
||||||
|
|
||||||
var records []runtime.LogRecord
|
var records []runtime.LogRecord
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user