Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce micro based app registry #3907

Closed
wants to merge 1 commit into from

Conversation

butonic
Copy link
Contributor

@butonic butonic commented May 19, 2023

To fix owncloud/ocis#3832 we plan to rely on the micro registry. In kubernetes it will use the existing service registry, allowing kubernetes to move the app registry to other nodes without loosing the currently registered app providers.

Leaving this here as WIP as I'm off for the weekend...

  • move code to a dedicated micro app registry
  • make Register calls write to the micre registry as in ocis RegisterGRPCEndpoint
  • move ocis-pkg registry to reva?

in ocis this needs a new parameter

diff --git a/ocis-pkg/service/external/external.go b/ocis-pkg/service/external/external.go
index 7b90fe7fb..29d8f7d04 100644
--- a/ocis-pkg/service/external/external.go
+++ b/ocis-pkg/service/external/external.go
@@ -11,7 +11,7 @@ import (
 
 // RegisterGRPCEndpoint publishes an arbitrary endpoint to the service-registry. This allows querying nodes of
 // non-micro GRPC-services like reva. No health-checks are done, thus the caller is responsible for canceling.
-func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, version string, logger log.Logger) error {
+func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, version string, logger log.Logger, nodeMetadata map[string]string) error {
        node := &registry.Node{
                Id:       serviceID + "-" + uuid,
                Address:  addr,
@@ -23,6 +23,9 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, ver
        node.Metadata["server"] = "grpc"
        node.Metadata["transport"] = "grpc"
        node.Metadata["protocol"] = "grpc"
+       for k, v := range nodeMetadata {
+               node.Metadata[k] = v
+       }
 
        service := &registry.Service{
                Name:      serviceID,
diff --git a/services/app-provider/pkg/command/server.go b/services/app-provider/pkg/command/server.go
index a7fc216d0..85611476c 100644
--- a/services/app-provider/pkg/command/server.go
+++ b/services/app-provider/pkg/command/server.go
@@ -84,6 +84,17 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{
+                                       "cs3.app-provider.mime_type":   "text/plain", // FIXME
+                                       "cs3.app-provider.extension":   "txt",
+                                       "cs3.app-provider.name":        "demo",
+                                       "cs3.app-provider.description": "Demo text",
+                                       //"cs3.app-provider.icon":           "",
+                                       //"cs3.app-provider.default_app":    "",
+                                       "cs3.app-provider.allow_creation": "true",
+                                       "cs3.app-provider.priority":       "100", // TODO needs cs3 property on ProviderInfo
+                                       "cs3.app-provider.desktop_only":   "false",
+                               },
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/app-registry/pkg/command/server.go b/services/app-registry/pkg/command/server.go
index aa230570f..e8ae89a12 100644
--- a/services/app-registry/pkg/command/server.go
+++ b/services/app-registry/pkg/command/server.go
@@ -79,6 +79,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/app-registry/pkg/config/defaults/defaultconfig.go b/services/app-registry/pkg/config/defaults/defaultconfig.go
index 5cbc26c71..cd569f7fd 100644
--- a/services/app-registry/pkg/config/defaults/defaultconfig.go
+++ b/services/app-registry/pkg/config/defaults/defaultconfig.go
@@ -37,6 +37,12 @@ func DefaultConfig() *config.Config {
 
 func defaultMimeTypeConfig() []config.MimeTypeConfig {
        return []config.MimeTypeConfig{
+               {
+                       MimeType:    "text/plain",
+                       Extension:   "txt",
+                       Name:        "Demo",
+                       Description: "Demo text",
+               },
                {
                        MimeType:    "application/pdf",
                        Extension:   "pdf",
diff --git a/services/auth-basic/pkg/command/server.go b/services/auth-basic/pkg/command/server.go
index 4dc4ffba2..cef5af775 100644
--- a/services/auth-basic/pkg/command/server.go
+++ b/services/auth-basic/pkg/command/server.go
@@ -97,6 +97,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/auth-bearer/pkg/command/server.go b/services/auth-bearer/pkg/command/server.go
index 4c181bfab..f304c897d 100644
--- a/services/auth-bearer/pkg/command/server.go
+++ b/services/auth-bearer/pkg/command/server.go
@@ -84,6 +84,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/auth-machine/pkg/command/server.go b/services/auth-machine/pkg/command/server.go
index bf2ad19cc..0826eae01 100644
--- a/services/auth-machine/pkg/command/server.go
+++ b/services/auth-machine/pkg/command/server.go
@@ -84,6 +84,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/gateway/pkg/command/server.go b/services/gateway/pkg/command/server.go
index f2ddf03af..ac893acb4 100644
--- a/services/gateway/pkg/command/server.go
+++ b/services/gateway/pkg/command/server.go
@@ -79,6 +79,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/groups/pkg/command/server.go b/services/groups/pkg/command/server.go
index 6605c3dfd..85201e18c 100644
--- a/services/groups/pkg/command/server.go
+++ b/services/groups/pkg/command/server.go
@@ -97,6 +97,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/sharing/pkg/command/server.go b/services/sharing/pkg/command/server.go
index 6154ff20b..071cffd42 100644
--- a/services/sharing/pkg/command/server.go
+++ b/services/sharing/pkg/command/server.go
@@ -97,6 +97,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/storage-publiclink/pkg/command/server.go b/services/storage-publiclink/pkg/command/server.go
index 1c731ee52..3a050f198 100644
--- a/services/storage-publiclink/pkg/command/server.go
+++ b/services/storage-publiclink/pkg/command/server.go
@@ -84,6 +84,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/storage-shares/pkg/command/server.go b/services/storage-shares/pkg/command/server.go
index d3e507e2b..2b1160842 100644
--- a/services/storage-shares/pkg/command/server.go
+++ b/services/storage-shares/pkg/command/server.go
@@ -84,6 +84,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/storage-system/pkg/command/server.go b/services/storage-system/pkg/command/server.go
index de6095a66..285d51409 100644
--- a/services/storage-system/pkg/command/server.go
+++ b/services/storage-system/pkg/command/server.go
@@ -84,6 +84,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/storage-users/pkg/command/server.go b/services/storage-users/pkg/command/server.go
index ffff3afe2..47edf24b3 100644
--- a/services/storage-users/pkg/command/server.go
+++ b/services/storage-users/pkg/command/server.go
@@ -86,6 +86,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }
diff --git a/services/users/pkg/command/server.go b/services/users/pkg/command/server.go
index b0419b305..b57189367 100644
--- a/services/users/pkg/command/server.go
+++ b/services/users/pkg/command/server.go
@@ -97,6 +97,7 @@ func Server(cfg *config.Config) *cli.Command {
                                cfg.GRPC.Addr,
                                version.GetString(),
                                logger,
+                               map[string]string{},
                        ); err != nil {
                                logger.Fatal().Err(err).Msg("failed to register the grpc endpoint")
                        }

I wonder if we shouldnt introduce options to RegisterGRPCEndpoint

@update-docs
Copy link

update-docs bot commented May 19, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@butonic butonic self-assigned this May 24, 2023
@butonic butonic marked this pull request as draft May 24, 2023 07:39
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@dragonchaser
Copy link

superseded by #4060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants