Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
Handle karpenter nodes in node-termination-handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
whites11 committed Mar 4, 2024
1 parent 35327df commit 2d0bcb4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Handle karpenter nodes in node-termination-handler.

## [15.0.0-patch1] - 2024-01-31

### Fixed
Expand Down
12 changes: 12 additions & 0 deletions service/controller/resource/terminateunhealthynode/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ func (r *Resource) terminateNode(ctx context.Context, node corev1.Node, clusterI
return microerror.Mask(err)
}

// Check if VM is managed by karpenter.
if node.GetLabels()["managed-by"] == "karpenter" {
r.logger.Debugf(ctx, "node %s is managed by karpenter, deleting it from k8s api", node.Name)

err = cc.Client.TenantCluster.K8s.CtrlClient().Delete(ctx, &node)
if err != nil {
return microerror.Mask(err)
}

return nil
}

instanceID, err := getInstanceId(node)
if err != nil {
return microerror.Mask(err)
Expand Down

0 comments on commit 2d0bcb4

Please sign in to comment.