cloudnative-pg / cloudnative-pg/cloudnative-pg

[Feature]: Allow primary to keep running on cordoned/unschedulable node

Open
#9,997 5 comments 7 reactions 1 assignee Claimed by @gbartolini View on GitHub
triage
Dominant language
Go
Stars
9.3k
Forks
759
Avg merge
2d 6h
Merged PRs (30d)
44

Description

### Is there an existing issue already for this feature request/idea?

- [x] I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

### What problem is this feature going to solve? Why should it be added?

Cordoning a node with a cluster primary pod on it, forces a switchover regardless of the users's DRAIN_TAINTS setting. This is because the node.Spec.Unschedulable is currently hardcoded to cause a switchover, even if the unschedulable taint is overridden in DRAIN_TAINTS.

See the code here for specifics: https://github.com/cloudnative-pg/cloudnative-pg/blob/3ce5c607475e4ee0f201f8d30ce55b8c6714d407/internal/controller/replicas.go#L200

I think the intention of https://github.com/cloudnative-pg/cloudnative-pg/pull/6928 was to allow users to override this, but this line of code prevents users from overriding it completely.

### Describe the solution you'd like

I want to be able to cordon nodes without forcing a switchover, atleast if I specifically configure DRAIN_TAINTS to not respect the "node.kubernetes.io/unschedulable" taint.

In my opinion the function at https://github.com/cloudnative-pg/cloudnative-pg/blob/3ce5c607475e4ee0f201f8d30ce55b8c6714d407/internal/controller/replicas.go#L200 should return false instead of "node.Spec.Unschedulable".

### Describe alternatives you've considered

The alternative is for me to think of a node cordon as a node drain, but I am not aware of any other workloads that act is if the node is about to be drained just because it is cordoned. I may just be unaware here though.

### Additional context

_No response_

### Backport?

No

### Are you willing to actively contribute to this feature?

Yes

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.