feat(cluster): expose shutdown and failover timing knobs - #972
Open
wittfabian wants to merge 1 commit into
Open
Conversation
Expose cluster.smartShutdownTimeout, cluster.switchoverDelay, cluster.startDelay and cluster.failoverDelay, mapping to the matching CNPG Cluster spec fields. This completes the shutdown/failover timing family started by cluster.stopDelay (cloudnative-pg#941): the template never rendered these four, so setting them in values.yaml was silently dropped and they stayed pinned to the operator defaults. Motivating case: on a brief API-server connectivity loss on the node running the primary, CNPG fails the primary over. With the default smartShutdownTimeout of 180s the old primary waits for idle client connections to drain before the standby can be promoted, turning a ~1 minute blip into a multi-minute read-write outage. Lowering smartShutdownTimeout (and raising failoverDelay to ride out very short partitions) is the intended knob, but until now it required patching the CR out of band. Also covers the remaining fields requested in cloudnative-pg#523. Same wire-up as cloudnative-pg#941: values.yaml plus template block, values.schema.json regenerated with helm-schema, README regenerated with helm-docs. Verified with helm lint and helm template; failoverDelay defaults to 0 and is only rendered when set. Closes cloudnative-pg#892 Signed-off-by: Fabian Witt <fabian.witt@t-online.de> Assisted-by: Claude Opus 4.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Expose four CNPG
Clusterspec fields as chart values, completing the shutdown/failover timing family thatcluster.stopDelay(#941) started:cluster.smartShutdownTimeoutspec.smartShutdownTimeoutcluster.switchoverDelayspec.switchoverDelaycluster.startDelayspec.startDelaycluster.failoverDelayspec.failoverDelayThe template never rendered these, so setting them in
values.yamlwas silently dropped and they stayed pinned to the operator defaults.Why
On a brief API-server connectivity loss on the node hosting the primary, CNPG fails the primary over. With the default
smartShutdownTimeout: 180, the old primary spends up to 180s in smart shutdown waiting for idle client connections to drain before the standby can be promoted — turning a ~1 minute network blip into a multi-minute read-write outage. LoweringsmartShutdownTimeout(and raisingfailoverDelayto ride out very short partitions) is the intended CNPG knob, but with the chart not exposing it the only workaround is an out-of-bandkubectl patchon theClusterCR.This closes the open request in #892 (
failoverDelay) and also covers the remaining fields from #523 (smartShutdownTimeout,startDelay,switchoverDelay).How
Same wire-up as #941:
templates/cluster.yaml:{{- with }}blocks, so a field is only rendered when set (failoverDelay: 0= operator default therefore stays unset).values.yaml: documented keys at their operator defaults.values.schema.json: regenerated with helm-schemav0.23.4.README.md: regenerated with helm-docsv1.14.2.Verified with
helm lint(0 failures) andhelm template: fields render when set;failoverDelay: 0is correctly not emitted.Closes #892
Disclosure (per the project AI policy): this change was drafted with AI assistance — see the
Assisted-by:commit trailer. I have reviewed and understand every line and take responsibility for it.