Skip to content

Commit

Permalink
Merge branch 'kubernetes-sigs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nikmohan123 authored Mar 13, 2024
2 parents 7e9d89d + 9c6012c commit 6c554a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions hack/install-kwok.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ cat <<EOF > "${BASE}/kustomization.yaml"
newTag: "${KWOK_LATEST_RELEASE}"
resources:
- "https://github.com/${KWOK_REPO}/kustomize/kwok?ref=${KWOK_LATEST_RELEASE}"
patchesStrategicMerge:
- tolerate-all.yaml
patches:
- path: tolerate-all.yaml
EOF

# Define 10 different kwok controllers to handle large load
Expand Down
7 changes: 5 additions & 2 deletions pkg/controllers/node/termination/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ func (c *Controller) deleteAllNodeClaims(ctx context.Context, node *v1.Node) err
return err
}
for i := range nodeClaimList.Items {
if err := c.kubeClient.Delete(ctx, &nodeClaimList.Items[i]); err != nil {
return client.IgnoreNotFound(err)
// If we still get the NodeClaim, but it's already marked as terminating, we don't need to call Delete again
if nodeClaimList.Items[i].DeletionTimestamp.IsZero() {
if err := c.kubeClient.Delete(ctx, &nodeClaimList.Items[i]); err != nil {
return client.IgnoreNotFound(err)
}
}
}
return nil
Expand Down
9 changes: 6 additions & 3 deletions pkg/controllers/nodeclaim/termination/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ func (c *Controller) Finalize(ctx context.Context, nodeClaim *v1beta1.NodeClaim)
return reconcile.Result{}, err
}
for _, node := range nodes {
// We delete nodes to trigger the node finalization and deletion flow
if err = c.kubeClient.Delete(ctx, node); client.IgnoreNotFound(err) != nil {
return reconcile.Result{}, err
// If we still get the Node, but it's already marked as terminating, we don't need to call Delete again
if node.DeletionTimestamp.IsZero() {
// We delete nodes to trigger the node finalization and deletion flow
if err = c.kubeClient.Delete(ctx, node); client.IgnoreNotFound(err) != nil {
return reconcile.Result{}, err
}
}
}
// We wait until all the nodes associated with this nodeClaim have completed their deletion before triggering the finalization of the nodeClaim
Expand Down

0 comments on commit 6c554a4

Please sign in to comment.