mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-22 21:31:14 -05:00
bootstrapper: fix GracefulStop of InitServer
Let joinclient stop initserver only when itself initializes the node.
This commit is contained in:
parent
1362e40f53
commit
0232c835ca
@ -148,7 +148,11 @@ func (s *Server) Init(ctx context.Context, req *initproto.InitRequest) (*initpro
|
|||||||
|
|
||||||
// Stop stops the initialization server gracefully.
|
// Stop stops the initialization server gracefully.
|
||||||
func (s *Server) Stop() {
|
func (s *Server) Stop() {
|
||||||
|
s.log.Infof("Stopping")
|
||||||
|
|
||||||
s.grpcServer.GracefulStop()
|
s.grpcServer.GracefulStop()
|
||||||
|
|
||||||
|
s.log.Infof("Stopped")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) setupDisk(masterSecret, salt []byte) error {
|
func (s *Server) setupDisk(masterSecret, salt []byte) error {
|
||||||
|
@ -58,6 +58,7 @@ type JoinClient struct {
|
|||||||
|
|
||||||
dialer grpcDialer
|
dialer grpcDialer
|
||||||
joiner ClusterJoiner
|
joiner ClusterJoiner
|
||||||
|
cleaner cleaner
|
||||||
metadataAPI MetadataAPI
|
metadataAPI MetadataAPI
|
||||||
|
|
||||||
log *logger.Logger
|
log *logger.Logger
|
||||||
@ -100,13 +101,13 @@ func (c *JoinClient) Start(cleaner cleaner) {
|
|||||||
c.log.Infof("Starting")
|
c.log.Infof("Starting")
|
||||||
c.stopC = make(chan struct{}, 1)
|
c.stopC = make(chan struct{}, 1)
|
||||||
c.stopDone = make(chan struct{}, 1)
|
c.stopDone = make(chan struct{}, 1)
|
||||||
|
c.cleaner = cleaner
|
||||||
|
|
||||||
ticker := c.clock.NewTicker(c.interval)
|
ticker := c.clock.NewTicker(c.interval)
|
||||||
go func() {
|
go func() {
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
defer func() { c.stopDone <- struct{}{} }()
|
defer func() { c.stopDone <- struct{}{} }()
|
||||||
defer c.log.Infof("Client stopped")
|
defer c.log.Infof("Client stopped")
|
||||||
defer cleaner.Clean()
|
|
||||||
|
|
||||||
diskUUID, err := c.getDiskUUID()
|
diskUUID, err := c.getDiskUUID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -254,6 +255,8 @@ func (c *JoinClient) startNodeAndJoin(ticket *joinproto.IssueJoinTicketResponse,
|
|||||||
return errors.New("node is already being initialized")
|
return errors.New("node is already being initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.cleaner.Clean()
|
||||||
|
|
||||||
if err := c.updateDiskPassphrase(string(ticket.StateDiskKey)); err != nil {
|
if err := c.updateDiskPassphrase(string(ticket.StateDiskKey)); err != nil {
|
||||||
return fmt.Errorf("updating disk passphrase: %w", err)
|
return fmt.Errorf("updating disk passphrase: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user