Chore: Add storage submodule to lint & test config (#91529)

pull/91484/head
Todd Treece 11 months ago committed by GitHub
parent 93aa5a56ad
commit 9a2c9647ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/go_lint.yml
  2. 2
      Makefile
  3. 5
      pkg/storage/unified/resource/cdk_backend.go
  4. 2
      pkg/storage/unified/resource/grpc/authenticator.go
  5. 6
      pkg/storage/unified/resource/server.go

@ -27,6 +27,6 @@ jobs:
with:
version: v1.59.1
args: |
--config .golangci.toml --max-same-issues=0 --max-issues-per-linter=0 --verbose ./pkg/... ./pkg/apiserver/... ./pkg/apimachinery/... ./pkg/promlib/... ./pkg/semconv/...
--config .golangci.toml --max-same-issues=0 --max-issues-per-linter=0 --verbose ./pkg/... ./pkg/apiserver/... ./pkg/apimachinery/... ./pkg/promlib/... ./pkg/semconv/... ./pkg/storage/unified/resource/...
skip-cache: true
install-mode: binary

@ -10,7 +10,7 @@ include .bingo/Variables.mk
GO = go
GO_VERSION = 1.22.4
GO_FILES ?= ./pkg/... ./pkg/apiserver/... ./pkg/apimachinery/... ./pkg/promlib/... ./pkg/semconv/...
GO_FILES ?= ./pkg/... ./pkg/apiserver/... ./pkg/apimachinery/... ./pkg/promlib/... ./pkg/semconv/... ./pkg/storage/unified/resource/...
SH_FILES ?= $(shell find ./scripts -name *.sh)
GO_RACE := $(shell [ -n "$(GO_RACE)" -o -e ".go-race-enabled-locally" ] && echo 1 )
GO_RACE_FLAG := $(if $(GO_RACE),-race)

@ -3,6 +3,7 @@ package resource
import (
"bytes"
context "context"
"errors"
"fmt"
"io"
"net/http"
@ -141,7 +142,7 @@ func (s *cdkBackend) ReadResource(ctx context.Context, req *ReadRequest) *ReadRe
iter := s.bucket.List(&blob.ListOptions{Prefix: path + "/", Delimiter: "/"})
for {
obj, err := iter.Next(ctx)
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
if strings.HasSuffix(obj.Key, ".json") {
@ -325,7 +326,7 @@ func buildTree(ctx context.Context, s *cdkBackend, key *ResourceKey) (*cdkListIt
iter := s.bucket.List(&blob.ListOptions{Prefix: path, Delimiter: ""}) // "" is recursive
for {
obj, err := iter.Next(ctx)
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
if strings.HasSuffix(obj.Key, ".json") {

@ -72,7 +72,7 @@ func (f *Authenticator) decodeMetadata(ctx context.Context, meta metadata.MD) (i
return nil, fmt.Errorf("no login found in grpc metadata")
}
// The namespaced verisons have a "-" in the key
// The namespaced versions have a "-" in the key
// TODO, remove after this has been deployed to unified storage
if getter(mdUserID) == "" {
var err error

@ -585,7 +585,7 @@ func (s *server) Watch(req *WatchRequest, srv ResourceStore_WatchServer) error {
// }
// TODO: return values that match either the old or the new
srv.Send(&WatchEvent{
if err := srv.Send(&WatchEvent{
Timestamp: event.Timestamp,
Type: event.Type,
Resource: &WatchEvent_Resource{
@ -593,7 +593,9 @@ func (s *server) Watch(req *WatchRequest, srv ResourceStore_WatchServer) error {
Version: event.ResourceVersion,
},
// TODO... previous???
})
}); err != nil {
return err
}
}
}
}

Loading…
Cancel
Save