Skip to content

CLM could wait forever for node decommissioning #533

@AlexanderYastrebov

Description

@AlexanderYastrebov

CLM could wait forever for node decommissioning (if there is some kind of problem)

func (c *CLCUpdateStrategy) PrepareForRemoval(ctx context.Context, nodePoolDesc *api.NodePool) error {
c.logger.Infof("Preparing for removal of node pool '%s'", nodePoolDesc.Name)
for {
nodePool, err := c.nodePoolManager.GetPool(ctx, nodePoolDesc)
if err != nil {
return err
}
err = c.nodePoolManager.MarkPoolForDecommission(nodePoolDesc)
if err != nil {
return err
}
for _, node := range nodePool.Nodes {
err := c.nodePoolManager.DisableReplacementNodeProvisioning(ctx, node)
if err != nil {
return err
}
}
nodes, err := c.markNodes(ctx, nodePool, func(_ *Node) bool {
return true
})
if err != nil {
return err
}
if nodes == 0 {
return nil
}
c.logger.WithField("node-pool", nodePoolDesc.Name).Infof("Waiting for decommissioning of the nodes (%d left)", nodes)
// wait for CLC to finish removing the nodes
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(c.pollingInterval):
}
}
}

func (c *CLCUpdateStrategy) doUpdate(ctx context.Context, nodePoolDesc *api.NodePool) error {
for {
if err := ctx.Err(); err != nil {
return err
}
nodePool, err := c.nodePoolManager.GetPool(ctx, nodePoolDesc)
if err != nil {
return err
}
oldNodes, err := c.markNodes(ctx, nodePool, func(node *Node) bool {
return node.Generation != nodePool.Generation
})
if err != nil {
return err
}
if oldNodes == 0 {
return nil
}
c.logger.WithField("node-pool", nodePoolDesc.Name).Infof("Waiting for decommissioning of old nodes (%d left)", oldNodes)
// wait for CLC to finish rolling the nodes
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(c.pollingInterval):
}
}
}

and therefore does not update other node pools.

See also #154

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions