metropolis/node/core: use curator
This finally switches over the node startup code to use the full Cluster
Manager / Curator / Role Server chain to bring up the node.
Change-Id: Iaf6173671aed107a67b4201d9d1ad8bb33baa90f
Reviewed-on: https://review.monogon.dev/c/monogon/+/189
Reviewed-by: Lorenz Brun <lorenz@nexantic.com>
diff --git a/metropolis/node/core/debug_service.go b/metropolis/node/core/debug_service.go
index e0f7753..30f7ac7 100644
--- a/metropolis/node/core/debug_service.go
+++ b/metropolis/node/core/debug_service.go
@@ -28,11 +28,9 @@
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
- apb "source.monogon.dev/metropolis/proto/api"
-
- "source.monogon.dev/metropolis/node/core/cluster"
- "source.monogon.dev/metropolis/node/kubernetes"
+ "source.monogon.dev/metropolis/node/core/roleserve"
"source.monogon.dev/metropolis/pkg/logtree"
+ apb "source.monogon.dev/metropolis/proto/api"
)
const (
@@ -41,9 +39,8 @@
// debugService implements the Metropolis node debug API.
type debugService struct {
- cluster *cluster.Manager
- kubernetes *kubernetes.Service
- logtree *logtree.LogTree
+ roleserve *roleserve.Service
+ logtree *logtree.LogTree
// traceLock provides exclusive access to the Linux tracing infrastructure
// (ftrace)
// This is a channel because Go's mutexes can't be cancelled or be acquired
@@ -52,7 +49,18 @@
}
func (s *debugService) GetDebugKubeconfig(ctx context.Context, req *apb.GetDebugKubeconfigRequest) (*apb.GetDebugKubeconfigResponse, error) {
- return s.kubernetes.GetDebugKubeconfig(ctx, req)
+ w := s.roleserve.Watch()
+ defer w.Close()
+ for {
+ v, err := w.Get(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Unavailable, "could not get roleserve status: %v", err)
+ }
+ if v.Kubernetes == nil {
+ continue
+ }
+ return v.Kubernetes.GetDebugKubeconfig(ctx, req)
+ }
}
func (s *debugService) GetLogs(req *apb.GetLogsRequest, srv apb.NodeDebugService_GetLogsServer) error {