Skip to content

Commit

Permalink
operator: disable maintenance mode hooks in single node clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Apr 20, 2022
1 parent ee85043 commit 0d80ac9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/go/k8s/pkg/resources/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ func (r *StatefulSetResource) obj(
},
}

if featuregates.MaintenanceMode(r.pandaCluster.Spec.Version) && r.pandaCluster.IsUsingMaintenanceModeHooks() {
// Only multi-replica clusters should use maintenance mode. See: https://github.com/redpanda-data/redpanda/issues/4338
multiReplica := r.pandaCluster.Spec.Replicas != nil && *r.pandaCluster.Spec.Replicas > 1
if featuregates.MaintenanceMode(r.pandaCluster.Spec.Version) && r.pandaCluster.IsUsingMaintenanceModeHooks() && multiReplica {
ss.Spec.Template.Spec.Containers[0].Lifecycle = &corev1.Lifecycle{
PreStop: r.getPreStopHook(),
PostStart: r.getPostStartHook(),
Expand Down

0 comments on commit 0d80ac9

Please sign in to comment.