diff --git a/pkg/registry/apis/dashboard/search.go b/pkg/registry/apis/dashboard/search.go index ca61ca5eb27..d1650e9d7c9 100644 --- a/pkg/registry/apis/dashboard/search.go +++ b/pkg/registry/apis/dashboard/search.go @@ -12,6 +12,7 @@ import ( "strings" "go.opentelemetry.io/otel/trace" + "google.golang.org/grpc/metadata" apierrors "k8s.io/apimachinery/pkg/api/errors" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/kube-openapi/pkg/common" @@ -362,6 +363,8 @@ func (s *SearchHandler) DoSearch(w http.ResponseWriter, r *http.Request) { searchRequest.Options.Fields = append(searchRequest.Options.Fields, namesFilter...) } + ctx = metadata.AppendToOutgoingContext(ctx, "namespace", searchRequest.Options.Key.Namespace) + result, err := s.client.Search(ctx, searchRequest) if err != nil { errhttp.Write(ctx, err, w) diff --git a/pkg/server/distributor.go b/pkg/server/distributor.go index ffd7bbf8129..eafce068cc3 100644 --- a/pkg/server/distributor.go +++ b/pkg/server/distributor.go @@ -2,7 +2,6 @@ package server import ( "context" - "errors" "fmt" "hash/fnv" "io" @@ -151,6 +150,7 @@ func (ds *DistributorServer) handler(srv interface{}, serverStream grpc.ServerSt namespace := ds.getNamespaceFromContext(serverStream.Context()) // TODO if namespace is not present or is *, assign random pod for now + fmt.Println("got namespace: ", namespace) conn, err := ds.getClientConnToDistributeRequest(serverStream.Context(), namespace) if err != nil { return err @@ -172,7 +172,8 @@ func (ds *DistributorServer) handler(srv interface{}, serverStream grpc.ServerSt for i := 0; i < 2; i++ { select { case s2cErr := <-s2cErrChan: - if errors.Is(s2cErr, io.EOF) { + //nolint:errorlint + if s2cErr == io.EOF { // this is the happy case where the sender has encountered io.EOF, and won't be sending anymore./ // the clientStream>serverStream may continue pumping though. // TODO handle err? @@ -190,7 +191,8 @@ func (ds *DistributorServer) handler(srv interface{}, serverStream grpc.ServerSt // will be nil. serverStream.SetTrailer(clientStream.Trailer()) // c2sErr will contain RPC error from client code. If not io.EOF return the RPC error as server stream error. - if errors.Is(c2sErr, io.EOF) { + //nolint:errorlint + if c2sErr != io.EOF { return c2sErr } return nil