cloudnative-pg / cloudnative-pg/cloudnative-pg

[Feature]: Scale single instance while rolling update

Open
#10,598 3 comments 1 reaction 1 assignee Claimed by @gbartolini View on GitHub
Stale 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?

Updating a `Cluster` (`spec.instances: 1`; RollingUpdate strategy configured or not) will result in a restart of this instance and will interrupt operations for a few minutes depending on the load.

### Describe the solution you'd like

Some could implement a (e.g.) `max_surge` for update procedures.

- Start update of `Cluster` / Operator / any process
- Check if `spec.instances` == 1
- Set the `Cluster` CR temporarily to `spec.instances: >=2` + adjust PDB if needed
- Wait for the seeding to be completed
- Failover to the new instance and update the old one
- Failover again to the old one
- Set `spec.instances` back to `1`

### Describe alternatives you've considered

I've manually scaled `spec.instances` to `2`. This is problematic if there's a breaking update like a CRD or probe changes (like in 1.26) where you have no time to react beforehand of if you are not using the inplace-replacement of the manager.

### Additional context

I've seen some old issues while searching for this feature. One complaint was, I guess this was related to alternative update strategies, that you should not run single instances in production. That's correct but some platform teams or development teams rely on single instances for development. A downtime of a few minutes (issue shutdown, failover, grace shutdown) could interrupt internal applications. This could be solved with an automatic scaleup like this.

### Backport?

N/A

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

No

### 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.