Merge pull request #9662 from owncloud/pass-registration-config-to-micro-ocdav

pass registration cfg to micro ocdav
This commit is contained in:
kobergj
2024-07-22 12:17:42 +02:00
committed by GitHub
9 changed files with 34 additions and 9 deletions

View File

@@ -1,3 +1,4 @@
Enhancement: Bump reva
https://github.com/owncloud/ocis/pull/9662
https://github.com/owncloud/ocis/pull/9621

View File

@@ -2,5 +2,6 @@ Bugfix: Repair nats-js-kv registry
The registry would always send traffic to only one pod. This is now fixed and load should be spread evenly. Also implements watcher method so the cache can use it.
https://github.com/owncloud/ocis/pull/9662
https://github.com/owncloud/ocis/pull/9654
https://github.com/owncloud/ocis/pull/9620

2
go.mod
View File

@@ -15,7 +15,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.10.0
github.com/cs3org/go-cs3apis v0.0.0-20240425114016-d2cb31692b4e
github.com/cs3org/reva/v2 v2.21.1-0.20240717160526-d6bf8567005a
github.com/cs3org/reva/v2 v2.21.1-0.20240722093715-1a6e7f6d0e4f
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1

4
go.sum
View File

@@ -1025,8 +1025,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20240425114016-d2cb31692b4e h1:Cm2l8m2riLa79eh7V2wHd1Ra7wR3TbngmeLZBJ9MxTU=
github.com/cs3org/go-cs3apis v0.0.0-20240425114016-d2cb31692b4e/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE=
github.com/cs3org/reva/v2 v2.21.1-0.20240717160526-d6bf8567005a h1:QWtMu+iHKoM69CT2VqLgQkzeuVR5kACvwFhaldo6OpE=
github.com/cs3org/reva/v2 v2.21.1-0.20240717160526-d6bf8567005a/go.mod h1:+5pteFc4ymQnhYG2cOtg/jzaIZKgxrgIeH0D4fuC6gA=
github.com/cs3org/reva/v2 v2.21.1-0.20240722093715-1a6e7f6d0e4f h1:U0RoCVpBKU+xRYdgxBgZY3ZxtArnYVERobjhtXUv7qo=
github.com/cs3org/reva/v2 v2.21.1-0.20240722093715-1a6e7f6d0e4f/go.mod h1:+5pteFc4ymQnhYG2cOtg/jzaIZKgxrgIeH0D4fuC6gA=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=

View File

@@ -10,6 +10,7 @@ import (
"github.com/oklog/run"
"github.com/owncloud/ocis/v2/ocis-pkg/broker"
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
"github.com/owncloud/ocis/v2/ocis-pkg/tracing"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
"github.com/owncloud/ocis/v2/services/ocdav/pkg/config"
@@ -87,6 +88,8 @@ func Server(cfg *config.Config) *cli.Command {
ocdav.MetricsNamespace("ocis"),
ocdav.Tracing("Adding these strings is a workaround for ->", "https://github.com/cs3org/reva/issues/4131"),
ocdav.WithTraceProvider(traceProvider),
ocdav.RegisterTTL(registry.GetRegisterTTL()),
ocdav.RegisterInterval(registry.GetRegisterInterval()),
}
s, err := ocdav.Service(opts...)

View File

@@ -137,8 +137,11 @@ func (s *svc) handleSpacesDelete(w http.ResponseWriter, r *http.Request, spaceID
// do not allow deleting spaces via dav endpoint - use graph endpoint instead
// we get a relative reference coming from the space root
// so if the path is "empty" we a referencing the space
if ref.GetPath() == "." {
// so if the path is "empty" and no opaque id is present or the opaque id equals
// the space id, we are referencing the space
rid := ref.GetResourceId()
if ref.GetPath() == "." &&
(rid.GetOpaqueId() == "" || rid.GetOpaqueId() == rid.GetSpaceId()) {
return http.StatusMethodNotAllowed, errors.New("deleting spaces via dav is not allowed")
}

View File

@@ -21,6 +21,7 @@ package ocdav
import (
"context"
"crypto/tls"
"time"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav"
@@ -70,6 +71,9 @@ type Options struct {
AllowedHeaders []string
AllowedMethods []string
AllowDepthInfinity bool
RegisterTTL time.Duration
RegisterInterval time.Duration
}
// newOptions initializes the available default options.
@@ -383,3 +387,17 @@ func ItemNameMaxLength(i int) Option {
o.config.NameValidation.MaxLength = i
}
}
// RegisterTTL provides a function to set the RegisterTTL option.
func RegisterTTL(ttl time.Duration) Option {
return func(o *Options) {
o.RegisterTTL = ttl
}
}
// RegisterInterval provides a function to set the RegisterInterval option.
func RegisterInterval(interval time.Duration) Option {
return func(o *Options) {
o.RegisterInterval = interval
}
}

View File

@@ -78,6 +78,8 @@ func Service(opts ...Option) (micro.Service, error) {
server.Name(sopts.Name),
server.Address(sopts.Address), // Address defaults to ":0" and will pick any free port
server.Version(sopts.config.VersionString),
server.RegisterTTL(sopts.RegisterTTL),
server.RegisterInterval(sopts.RegisterInterval),
)
revaService, err := ocdav.NewWith(&sopts.config, sopts.FavoriteManager, sopts.lockSystem, &sopts.Logger, sopts.GatewaySelector)
@@ -125,9 +127,6 @@ func Service(opts ...Option) (micro.Service, error) {
micro.Registry(registry.GetRegistry()),
)
// Init the service? make that optional?
service.Init()
// finally, return the service so it can be Run() by the caller himself
return service, nil
}

2
vendor/modules.txt vendored
View File

@@ -366,7 +366,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.21.1-0.20240717160526-d6bf8567005a
# github.com/cs3org/reva/v2 v2.21.1-0.20240722093715-1a6e7f6d0e4f
## explicit; go 1.21
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime