This commit is contained in:
Ryan McKinley 2024-06-15 00:42:19 +03:00
parent 31a05d5666
commit 1a5de75c34
6 changed files with 13 additions and 1 deletions

2
go.mod
View File

@ -443,6 +443,8 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect; @grafana-app-platform-squad
)
require github.com/hack-pad/hackpadfs v0.2.1
// Use fork of crewjam/saml with fixes for some issues until changes get merged into upstream
replace github.com/crewjam/saml => github.com/grafana/saml v0.4.15-0.20240523142256-cc370b98af7c

1
go.sum
View File

@ -2353,6 +2353,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9K
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/hack-pad/hackpadfs v0.2.1 h1:FelFhIhv26gyjujoA/yeFO+6YGlqzmc9la/6iKMIxMw=
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFisZH3Ok=
github.com/hanwen/go-fuse/v2 v2.1.0/go.mod h1:oRyA5eK+pvJyv5otpO/DgccS8y/RvYMaO00GgRLGryc=

View File

@ -197,6 +197,7 @@ func (s *service) RegisterAPI(b builder.APIGroupBuilder) {
s.builders = append(s.builders, b)
}
// nolint:gocyclo
func (s *service) start(ctx context.Context) error {
defer close(s.startedCh)

View File

@ -60,7 +60,7 @@ decode:
// Error event
if evt.Type == resource.WatchEvent_ERROR {
err = fmt.Errorf(string(evt.Message))
err = fmt.Errorf(evt.Message)
klog.Errorf("client: error receiving result: %s", err)
return watch.Error, nil, err
}

View File

@ -143,6 +143,9 @@ func (b *entityBridge) WriteEvent(ctx context.Context, event *resource.WriteEven
return 0, err
}
return rsp.Entity.ResourceVersion, err
case resource.ResourceOperation_UNKNOWN:
case resource.ResourceOperation_DELETED:
}
return 0, fmt.Errorf("unsupported operation: %s", event.Operation.String())

View File

@ -163,6 +163,11 @@ func (s *server) Stop() {
}
func (s *server) newEvent(ctx context.Context, key *ResourceKey, value, oldValue []byte) (*WriteEvent, error) {
if key.Name == "" {
return nil, apierrors.NewBadRequest("empty name")
}
// TODO -- make sure it is alphanumeric+
var err error
event := &WriteEvent{
EventID: s.nextEventID(),