Skip to content

Commit

Permalink
fix: restore kube health check
Browse files Browse the repository at this point in the history
With the recent changes to the protocol and to routing there is no real need
for the controller to ping the runner. This ping was causing the ISTIO RBAC
issues that resulted in us disabling the health check.

fixes: #2710
  • Loading branch information
stuartwdouglas committed Sep 17, 2024
1 parent 39ed291 commit db37517
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
23 changes: 1 addition & 22 deletions backend/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ func (s *Service) ReplaceDeploy(ctx context.Context, c *connect.Request[ftlv1.Re
}

func (s *Service) RegisterRunner(ctx context.Context, stream *connect.ClientStream[ftlv1.RegisterRunnerRequest]) (*connect.Response[ftlv1.RegisterRunnerResponse], error) {
initialised := false

deferredDeregistration := false

logger := log.FromContext(ctx)
Expand All @@ -569,14 +569,6 @@ func (s *Service) RegisterRunner(ctx context.Context, stream *connect.ClientStre
runnerStr := fmt.Sprintf("%s (%s)", endpoint, runnerKey)
logger.Tracef("Heartbeat received from runner %s", runnerStr)

if !initialised {
err = s.pingRunner(ctx, endpoint)
if err != nil {
return nil, fmt.Errorf("runner callback failed: %w", err)
}
initialised = true
}

deploymentKey, err := model.ParseDeploymentKey(msg.Deployment)
if err != nil {
return nil, connect.NewError(connect.CodeInvalidArgument, err)
Expand Down Expand Up @@ -613,19 +605,6 @@ func (s *Service) RegisterRunner(ctx context.Context, stream *connect.ClientStre
return connect.NewResponse(&ftlv1.RegisterRunnerResponse{}), nil
}

// Check if we can contact the runner.
func (s *Service) pingRunner(ctx context.Context, endpoint *url.URL) error {
client := rpc.Dial(ftlv1connect.NewVerbServiceClient, endpoint.String(), log.Error)
retry := backoff.Backoff{}
heartbeatCtx, cancel := context.WithTimeout(ctx, s.config.RunnerTimeout)
defer cancel()
err := rpc.Wait(heartbeatCtx, retry, client)
if err != nil {
return connect.NewError(connect.CodeUnavailable, fmt.Errorf("failed to connect to runner: %w", err))
}
return nil
}

func (s *Service) GetDeployment(ctx context.Context, req *connect.Request[ftlv1.GetDeploymentRequest]) (*connect.Response[ftlv1.GetDeploymentResponse], error) {
deployment, err := s.getDeployment(ctx, req.Msg.DeploymentKey)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions backend/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func Start(ctx context.Context, config Config) error {
return rpc.Serve(ctx, config.Bind,
rpc.GRPC(ftlv1connect.NewVerbServiceHandler, svc),
rpc.HTTP("/", svc),
rpc.HealthCheck(svc.healthCheck),
)
}

Expand Down

0 comments on commit db37517

Please sign in to comment.