Skip to content

Commit

Permalink
Replace node sync service with stream delegates
Browse files Browse the repository at this point in the history
  • Loading branch information
kralicky committed Aug 16, 2023
1 parent bf8e4e4 commit 5604b81
Show file tree
Hide file tree
Showing 34 changed files with 244 additions and 659 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ require (
github.com/hashicorp/hcl/v2 v2.16.1 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/huandu/xstrings v1.4.0
github.com/iancoleman/orderedmap v0.2.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
Expand Down Expand Up @@ -381,7 +381,7 @@ require (
github.com/miekg/dns v1.1.53 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/minio-go/v7 v7.0.57-0.20230614143930-1d018af3bfab // indirect
github.com/minio/minio-go/v7 v7.0.57-0.20230614143930-1d018af3bfab
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2890,8 +2890,6 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
Expand Down
46 changes: 18 additions & 28 deletions pkg/apis/capability/v1/capability.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions pkg/apis/capability/v1/capability.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package capability;

import "github.com/kralicky/totem/extensions.proto";
import "github.com/rancher/opni/pkg/apis/core/v1/core.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
Expand Down Expand Up @@ -55,10 +54,6 @@ service Node {
}
}

service NodeManager {
rpc RequestSync(SyncRequest) returns (google.protobuf.Empty);
}

message Details {
string name = 1;
string source = 2;
Expand Down
90 changes: 0 additions & 90 deletions pkg/apis/capability/v1/capability_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 1 addition & 10 deletions pkg/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

bootstrapv1 "github.com/rancher/opni/pkg/apis/bootstrap/v1"
bootstrapv2 "github.com/rancher/opni/pkg/apis/bootstrap/v2"
capabilityv1 "github.com/rancher/opni/pkg/apis/capability/v1"
controlv1 "github.com/rancher/opni/pkg/apis/control/v1"
corev1 "github.com/rancher/opni/pkg/apis/core/v1"
streamv1 "github.com/rancher/opni/pkg/apis/stream/v1"
Expand Down Expand Up @@ -64,7 +63,6 @@ type Gateway struct {

storageBackend storage.Backend
capBackendStore capabilities.BackendStore
syncRequester *SyncRequester
}

type GatewayOptions struct {
Expand Down Expand Up @@ -268,10 +266,9 @@ func NewGateway(ctx context.Context, conf *config.GatewayConfig, pl plugins.Load
// set up stream server
listener := health.NewListener()
monitor := health.NewMonitor(health.WithLogger(lg.Named("monitor")))
sync := NewSyncRequester(lg)
delegate := NewDelegateServer(storageBackend, lg)
// set up agent connection handlers
agentHandler := MultiConnectionHandler(listener, sync, delegate)
agentHandler := MultiConnectionHandler(listener, delegate)

go monitor.Run(ctx, listener)
streamSvc := NewStreamServer(agentHandler, storageBackend, httpServer.metricsRegisterer, lg)
Expand Down Expand Up @@ -300,7 +297,6 @@ func NewGateway(ctx context.Context, conf *config.GatewayConfig, pl plugins.Load
httpServer: httpServer,
grpcServer: grpcServer,
statusQuerier: monitor,
syncRequester: sync,
}

waitctx.Go(ctx, func() {
Expand Down Expand Up @@ -361,11 +357,6 @@ func (g *Gateway) CapabilitiesStore() capabilities.BackendStore {
return g.capBackendStore
}

// Implements management.CapabilitiesDataSource
func (g *Gateway) NodeManagerServer() capabilityv1.NodeManagerServer {
return g.syncRequester
}

// Implements management.HealthStatusDataSource
func (g *Gateway) GetClusterHealthStatus(ref *corev1.Reference) (*corev1.HealthStatus, error) {
hs := g.statusQuerier.GetHealthStatus(ref.Id)
Expand Down
119 changes: 0 additions & 119 deletions pkg/gateway/sync.go

This file was deleted.

Loading

0 comments on commit 5604b81

Please sign in to comment.