Skip to content

feat: allow customization of taints for node drain detection - #6928

Merged
gbartolini merged 14 commits into
cloudnative-pg:mainfrom
MarcusDunn:5299-check-for-nodes-cordoned-by-karpenter
Mar 26, 2025
Merged

gbartolini merged 14 commits into
cloudnative-pg:mainfrom
MarcusDunn:5299-check-for-nodes-cordoned-by-karpenter

Conversation

@MarcusDunn

@MarcusDunn MarcusDunn commented Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

Introduce the DRAIN_TAINTS operator configuration option, enabling users to specify which taint keys should be recognized as indicators of node drain.

By default, this includes commonly used taints from kubectl, Cluster Autoscaler, and Karpenter:

  • node.kubernetes.io/unschedulable
  • ToBeDeletedByClusterAutoscaler
  • karpenter.sh/disrupted
  • karpenter.sh/disruption

This enhancement provides greater flexibility in handling node drain scenarios, allowing adaptation to different cluster configurations and scheduling strategies.

Fixes: #5299

@MarcusDunn
MarcusDunn requested a review from a team February 21, 2025 23:34
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.22 labels Feb 21, 2025
@github-actions

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@MarcusDunn MarcusDunn changed the title 5299 check for nodes cordoned by karpenter feat: 5299 check for nodes cordoned by autoscalars Feb 21, 2025
@MarcusDunn
MarcusDunn force-pushed the 5299-check-for-nodes-cordoned-by-karpenter branch from 82c0133 to 62555cc Compare February 28, 2025 20:57
@MarcusDunn

Copy link
Copy Markdown
Contributor Author

@sxd could you take a look at this one? apologies for the three separate PRs this seemed to turn into.

@MarcusDunn
MarcusDunn force-pushed the 5299-check-for-nodes-cordoned-by-karpenter branch from 62555cc to dfffff7 Compare March 10, 2025 15:36
@armru

armru commented Mar 10, 2025

Copy link
Copy Markdown
Member

/test limit=local depth=push tl=4

@github-actions

Copy link
Copy Markdown
Contributor

@MarcusDunn
MarcusDunn force-pushed the 5299-check-for-nodes-cordoned-by-karpenter branch 2 times, most recently from e20d65b to 771a652 Compare March 10, 2025 20:35
@chris-gooch

Copy link
Copy Markdown

Hi @MarcusDunn

Hope you’re well.

I think you may need to add back the drain taints check to the cluster_controller.go. Without that, I think it will trigger NodeToCluster reconciliation loop whenever a node is changed, added, removed from the cluster and it should only do that if a node is draining I believe.

Thanks

@MarcusDunn

Copy link
Copy Markdown
Contributor Author

I would have liked to have a more clever check in cluster_controller but because the drain taints are configured per-cluster, I don't think there was a great way to do it.

For now (I think!) it only runs if any taints have changed.

Suggestions welcome.

@chris-gooch

chris-gooch commented Mar 10, 2025 via email

Copy link
Copy Markdown

@MarcusDunn

Copy link
Copy Markdown
Contributor Author

That seems pretty reasonable.

@armru

armru commented Mar 11, 2025

Copy link
Copy Markdown
Member

/test limit=local depth=push tl=4

@github-actions

Copy link
Copy Markdown
Contributor

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Mar 11, 2025
@MarcusDunn
MarcusDunn force-pushed the 5299-check-for-nodes-cordoned-by-karpenter branch from 51e94b2 to 0affe1c Compare March 17, 2025 16:42
@MarcusDunn

Copy link
Copy Markdown
Contributor Author

@armru Is there anything I can do to move this along?

@armru

armru commented Mar 21, 2025

Copy link
Copy Markdown
Member

@mnencia we should put this in the queue so we can take a look and give feedback

@leonardoce
leonardoce force-pushed the 5299-check-for-nodes-cordoned-by-karpenter branch from 02cc0d2 to f4b0c06 Compare March 25, 2025 12:36
MarcusDunn and others added 7 commits March 26, 2025 08:03
Signed-off-by: Marcus Dunn <[email protected]>
Mostly via formatting but had to ignore one because I did not want to spread URL across two lines.

Signed-off-by: Marcus Dunn <[email protected]>
…up when reconcile is triggered

Signed-off-by: Marcus Dunn <[email protected]>
Signed-off-by: Marcus Dunn <[email protected]>
Signed-off-by: Leonardo Cecchi <[email protected]>
@leonardoce
leonardoce force-pushed the 5299-check-for-nodes-cordoned-by-karpenter branch from b4b28a3 to 14c074a Compare March 26, 2025 07:03
Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
@leonardoce leonardoce changed the title feat: 5299 check for nodes cordoned by autoscalars feat: 5299 check for nodes cordoned by autoscalers Mar 26, 2025
Signed-off-by: Armando Ruocco <[email protected]>
@armru

armru commented Mar 26, 2025

Copy link
Copy Markdown
Member

/test limit=local tl=4 depth=push

@github-actions

Copy link
Copy Markdown
Contributor

Signed-off-by: Marco Nenciarini <[email protected]>
@armru armru added do not backport This PR must not be backported - it will be in the next minor release and removed backport-requested ◀️ This pull request should be backported to all supported releases release-1.22 labels Mar 26, 2025
Signed-off-by: Marco Nenciarini <[email protected]>
@gbartolini gbartolini changed the title feat: 5299 check for nodes cordoned by autoscalers feat: allow customization of taints for node drain detection Mar 26, 2025
@gbartolini
gbartolini merged commit ebc084f into cloudnative-pg:main Mar 26, 2025
mnencia added a commit that referenced this pull request Mar 26, 2025
The issue has been introduced by merging #6928

Signed-off-by: Marco Nenciarini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not backport This PR must not be backported - it will be in the next minor release ok to merge 👌 This PR can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Check for nodes cordoned by karpenter

7 participants