mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-04 23:37:18 -05:00
Merge branch 'master' into initialization-responsibility
This commit is contained in:
17
CHANGELOG.md
17
CHANGELOG.md
@@ -6,11 +6,20 @@ The following sections list the changes for unreleased.
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Fix the ttl of the authentication middleware cache: [#1699](https://github.com/owncloud/ocis/pull/1699)
|
||||
* Change - Update ownCloud Web to v2.0.1: [#1683](https://github.com/owncloud/ocis/pull/1683)
|
||||
* Enhancement - Update go-micro to v3.5.1-0.20210217182006-0f0ace1a44a9: [#1670](https://github.com/owncloud/ocis/pull/1670)
|
||||
* Enhancement - Add initial nats and kubernetes registry support: [#1697](https://github.com/owncloud/ocis/pull/1697)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Fix the ttl of the authentication middleware cache: [#1699](https://github.com/owncloud/ocis/pull/1699)
|
||||
|
||||
The authentication cache ttl was multiplied with `time.Second` multiple times. This
|
||||
resulted in a ttl that was not intended.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/1699
|
||||
|
||||
* Change - Update ownCloud Web to v2.0.1: [#1683](https://github.com/owncloud/ocis/pull/1683)
|
||||
|
||||
Tags: web
|
||||
@@ -33,6 +42,14 @@ The following sections list the changes for unreleased.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/1670
|
||||
https://github.com/asim/go-micro/pull/2126
|
||||
|
||||
* Enhancement - Add initial nats and kubernetes registry support: [#1697](https://github.com/owncloud/ocis/pull/1697)
|
||||
|
||||
We added initial support to use nats and kubernetes as a service registry using
|
||||
`MICRO_REGISTRY=nats` and `MICRO_REGISTRY=kubernetes` respectively. Multiple nodes can
|
||||
be given with `MICRO_REGISTRY_ADDRESS=1.2.3.4,5.6.7.8,9.10.11.12`.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/1697
|
||||
# Changelog for [1.2.0] (2021-02-17)
|
||||
|
||||
The following sections list the changes for 1.2.0.
|
||||
|
||||
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListAccountsWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.GRPC.Namespace + "." + cfg.Server.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get accounts services from the registry: %v", err))
|
||||
|
||||
5
changelog/unreleased/fix-tokencache-ttl.md
Normal file
5
changelog/unreleased/fix-tokencache-ttl.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Bugfix: Fix the ttl of the authentication middleware cache
|
||||
|
||||
The authentication cache ttl was multiplied with `time.Second` multiple times. This resulted in a ttl that was not intended.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/1699
|
||||
6
changelog/unreleased/use-registry-interface.md
Normal file
6
changelog/unreleased/use-registry-interface.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Enhancement: Add initial nats and kubernetes registry support
|
||||
|
||||
We added initial support to use nats and kubernetes as a service registry using `MICRO_REGISTRY=nats` and `MICRO_REGISTRY=kubernetes` respectively.
|
||||
Multiple nodes can be given with `MICRO_REGISTRY_ADDRESS=1.2.3.4,5.6.7.8,9.10.11.12`.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/1697
|
||||
@@ -58,7 +58,7 @@ services:
|
||||
WEB_OIDC_CLIENT_ID: ${OCIS_OIDC_CLIENT_ID:-web}
|
||||
WEB_OIDC_METADATA_URL: https://${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}/auth/realms/${KEYCLOAK_REALM:-oCIS}/.well-known/openid-configuration
|
||||
STORAGE_OIDC_ISSUER: https://${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}
|
||||
STORAGE_LDAP_IDP: https://${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}
|
||||
STORAGE_LDAP_IDP: https://${KEYCLOAK_DOMAIN:-keycloak.owncloud.test}/auth/realms/${KEYCLOAK_REALM:-oCIS}
|
||||
# general config
|
||||
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-error} # make oCIS less verbose
|
||||
|
||||
@@ -275,7 +275,7 @@ func attribute(name string, values ...string) *ldap.EntryAttribute {
|
||||
}
|
||||
|
||||
func (h ocisHandler) mapAccounts(accounts []*accounts.Account) []*ldap.Entry {
|
||||
var entries []*ldap.Entry
|
||||
entries := make([]*ldap.Entry, 0, len(accounts))
|
||||
for i := range accounts {
|
||||
attrs := []*ldap.EntryAttribute{
|
||||
attribute("objectClass", "posixAccount", "inetOrgPerson", "organizationalPerson", "Person", "top"),
|
||||
@@ -314,7 +314,7 @@ func (h ocisHandler) mapAccounts(accounts []*accounts.Account) []*ldap.Entry {
|
||||
}
|
||||
|
||||
func (h ocisHandler) mapGroups(groups []*accounts.Group) []*ldap.Entry {
|
||||
var entries []*ldap.Entry
|
||||
entries := make([]*ldap.Entry, 0, len(groups))
|
||||
for i := range groups {
|
||||
attrs := []*ldap.EntryAttribute{
|
||||
attribute("objectClass", "posixGroup", "groupOfNames", "top"),
|
||||
|
||||
@@ -53,7 +53,7 @@ func (g Graph) GetGroups(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
var groups []*msgraph.Group
|
||||
groups := make([]*msgraph.Group, 0, len(result.Entries))
|
||||
|
||||
for _, group := range result.Entries {
|
||||
groups = append(
|
||||
|
||||
@@ -76,7 +76,7 @@ func (g Graph) GetUsers(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
var users []*msgraph.User
|
||||
users := make([]*msgraph.User, 0, len(result.Entries))
|
||||
|
||||
for _, user := range result.Entries {
|
||||
users = append(
|
||||
|
||||
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListIDPWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get idp services from the registry: %v", err))
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
// StringToSliceString splits a string into a slice string according to separator
|
||||
func StringToSliceString(src string, sep string) []string {
|
||||
var parts []string
|
||||
parsed := strings.Split(src, sep)
|
||||
parts := make([]string, 0, len(parsed))
|
||||
for _, v := range parsed {
|
||||
parts = append(parts, strings.TrimSpace(v))
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func TestStringToSliceString(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
s := StringToSliceString(tt.input, tt.separator)
|
||||
for i, v := range tt.out {
|
||||
if tt.out[i] != v {
|
||||
if s[i] != v {
|
||||
t.Errorf("got %q, want %q", s, tt.out)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func (idx *NonUnique) Lookup(v string) ([]string, error) {
|
||||
return []string{}, err
|
||||
}
|
||||
|
||||
var ids []string = nil
|
||||
ids := make([]string, 0, len(fi))
|
||||
for _, f := range fi {
|
||||
ids = append(ids, f.Name())
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import (
|
||||
"strings"
|
||||
|
||||
etcdr "github.com/asim/go-micro/plugins/registry/etcd/v3"
|
||||
kubernetesr "github.com/asim/go-micro/plugins/registry/kubernetes/v3"
|
||||
mdnsr "github.com/asim/go-micro/plugins/registry/mdns/v3"
|
||||
natsr "github.com/asim/go-micro/plugins/registry/nats/v3"
|
||||
|
||||
"github.com/asim/go-micro/v3/registry"
|
||||
)
|
||||
@@ -18,11 +20,19 @@ var (
|
||||
// GetRegistry returns a configured micro registry based on Micro env vars.
|
||||
// It defaults to mDNS, so mind that systems with mDNS disabled by default (i.e SUSE) will have a hard time
|
||||
// and it needs to explicitly use etcd. Os awareness for providing a working registry out of the box should be done.
|
||||
func GetRegistry() *registry.Registry {
|
||||
func GetRegistry() registry.Registry {
|
||||
addresses := strings.Split(os.Getenv(registryAddressEnv), ",")
|
||||
|
||||
var r registry.Registry
|
||||
switch os.Getenv(registryEnv) {
|
||||
case "nats":
|
||||
r = natsr.NewRegistry(
|
||||
registry.Addrs(addresses...),
|
||||
)
|
||||
case "kubernetes":
|
||||
r = kubernetesr.NewRegistry(
|
||||
registry.Addrs(addresses...),
|
||||
)
|
||||
case "etcd":
|
||||
r = etcdr.NewRegistry(
|
||||
registry.Addrs(addresses...),
|
||||
@@ -31,5 +41,5 @@ func GetRegistry() *registry.Registry {
|
||||
r = mdnsr.NewRegistry()
|
||||
}
|
||||
|
||||
return &r
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func NewService(opts ...Option) Service {
|
||||
micro.Version(sopts.Version),
|
||||
micro.Context(sopts.Context),
|
||||
micro.Flags(sopts.Flags...),
|
||||
micro.Registry(*registry.GetRegistry()),
|
||||
micro.Registry(registry.GetRegistry()),
|
||||
micro.RegisterTTL(time.Second * 30),
|
||||
micro.RegisterInterval(time.Second * 10),
|
||||
micro.WrapHandler(prometheus.NewHandlerWrapper()),
|
||||
|
||||
@@ -32,7 +32,7 @@ func NewService(opts ...Option) Service {
|
||||
micro.Version(sopts.Version),
|
||||
micro.Context(sopts.Context),
|
||||
micro.Flags(sopts.Flags...),
|
||||
micro.Registry(*registry.GetRegistry()),
|
||||
micro.Registry(registry.GetRegistry()),
|
||||
micro.RegisterTTL(time.Second * 30),
|
||||
micro.RegisterInterval(time.Second * 10),
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func Execute() error {
|
||||
)
|
||||
}
|
||||
|
||||
//r := *registry.GetRegistry()
|
||||
//r := registry.GetRegistry()
|
||||
|
||||
//opts := micro.Options{
|
||||
// Registry: r,
|
||||
|
||||
@@ -19,7 +19,7 @@ func VersionCommand(cfg *config.Config) *cli.Command {
|
||||
Usage: "Lists running services with version",
|
||||
Category: "Runtime",
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
serviceList, err := reg.ListServices()
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not list services: %v", err))
|
||||
|
||||
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListOcsWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get ocs services from the registry: %v", err))
|
||||
|
||||
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListProxyWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get proxy services from the registry: %v", err))
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -114,7 +113,7 @@ func newOIDCAuth(options Options) func(http.Handler) http.Handler {
|
||||
HTTPClient(options.HTTPClient),
|
||||
OIDCIss(options.OIDCIss),
|
||||
TokenCacheSize(options.UserinfoCacheSize),
|
||||
TokenCacheTTL(time.Second*time.Duration(options.UserinfoCacheTTL)),
|
||||
TokenCacheTTL(options.UserinfoCacheTTL),
|
||||
CredentialsByUserAgent(options.CredentialsByUserAgent),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
"rollup-plugin-node-globals": "^1.4.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-vue": "^6.0.0",
|
||||
"rollup-plugin-vue": "^5.1.9",
|
||||
"swagger-vue-generator": "^1.0.6",
|
||||
"url-search-params-polyfill": "^8.1.0",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListSettingsWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.GRPC.Namespace + "." + cfg.Service.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get settings services from the registry: %v", err))
|
||||
|
||||
@@ -450,17 +450,17 @@ func TestSaveGetIntValue(t *testing.T) {
|
||||
{
|
||||
name: "negative",
|
||||
value: proto.Value_IntValue{IntValue: -42},
|
||||
// https://github.com/owncloud/ocis/settings/issues/57
|
||||
// no validation for SaveValue https://github.com/owncloud/ocis/issues/1445
|
||||
},
|
||||
{
|
||||
name: "less than Min",
|
||||
value: proto.Value_IntValue{IntValue: 0},
|
||||
// https://github.com/owncloud/ocis/settings/issues/57
|
||||
// no validation for SaveValue https://github.com/owncloud/ocis/issues/1445
|
||||
},
|
||||
{
|
||||
name: "more than Max",
|
||||
value: proto.Value_IntValue{IntValue: 128},
|
||||
// https://github.com/owncloud/ocis/settings/issues/57
|
||||
// no validation for SaveValue https://github.com/owncloud/ocis/issues/1445
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -502,7 +502,7 @@ func TestSaveGetIntValue(t *testing.T) {
|
||||
|
||||
/**
|
||||
try to save a wrong type of the value
|
||||
https://github.com/owncloud/ocis/settings/issues/57
|
||||
no validation for SaveValue https://github.com/owncloud/ocis/issues/1445
|
||||
*/
|
||||
func TestSaveGetIntValueIntoString(t *testing.T) {
|
||||
teardown := setup()
|
||||
@@ -538,7 +538,7 @@ func TestSaveGetIntValueIntoString(t *testing.T) {
|
||||
assert.Equal(t, "forty two", getValueResponse.Value.Value.GetStringValue())
|
||||
}
|
||||
|
||||
// https://github.com/owncloud/ocis/settings/issues/18
|
||||
// no plausibility check in settings of bundle https://github.com/owncloud/ocis/issues/1455
|
||||
func TestSaveBundleWithInvalidSettings(t *testing.T) {
|
||||
var tests = []proto.Setting{
|
||||
{
|
||||
@@ -747,7 +747,6 @@ func TestSaveBundleWithInvalidSettings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/owncloud/ocis/settings/issues/19
|
||||
func TestGetBundleNoSideEffectsOnDisk(t *testing.T) {
|
||||
teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
6
storage/pkg/service/external/external.go
vendored
6
storage/pkg/service/external/external.go
vendored
@@ -19,14 +19,14 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, log
|
||||
Address: addr,
|
||||
Metadata: make(map[string]string),
|
||||
}
|
||||
r := oregistry.GetRegistry()
|
||||
|
||||
node.Metadata["broker"] = broker.String()
|
||||
node.Metadata["registry"] = registry.String()
|
||||
node.Metadata["registry"] = r.String()
|
||||
node.Metadata["server"] = "grpc"
|
||||
node.Metadata["transport"] = "grpc"
|
||||
node.Metadata["protocol"] = "grpc"
|
||||
|
||||
r := *oregistry.GetRegistry()
|
||||
|
||||
service := ®istry.Service{
|
||||
Name: serviceID,
|
||||
Version: "",
|
||||
|
||||
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListStoreWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get store services from the registry: %v", err))
|
||||
|
||||
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListThumbnailsWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.Server.Namespace + "." + cfg.Server.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get thumbnails services from the registry: %v", err))
|
||||
|
||||
@@ -36,7 +36,7 @@ type Resolutions []image.Rectangle
|
||||
|
||||
// ParseResolutions creates an instance of Resolutions from resolution strings.
|
||||
func ParseResolutions(strs []string) (Resolutions, error) {
|
||||
var rs Resolutions
|
||||
rs := make(Resolutions, 0, len(strs))
|
||||
for _, s := range strs {
|
||||
r, err := ParseResolution(s)
|
||||
if err != nil {
|
||||
|
||||
@@ -19,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
|
||||
Usage: "Print the versions of the running instances",
|
||||
Flags: flagset.ListWebdavWithConfig(cfg),
|
||||
Action: func(c *cli.Context) error {
|
||||
reg := *registry.GetRegistry()
|
||||
reg := registry.GetRegistry()
|
||||
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
|
||||
if err != nil {
|
||||
fmt.Println(fmt.Errorf("could not get webdav services from the registry: %v", err))
|
||||
|
||||
Reference in New Issue
Block a user