Skip to content

Commit 8edea4b

Browse files
authored
[api] Default Parallel pod management (#230)
Various production workloads have proven this to be a useful default.
1 parent fff04ac commit 8edea4b

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ ClusterSpec defines the desired state for a M3 cluster to be converge to.
6767
| initContainers | Custom setup for db nodes can be done via initContainers Provide the complete spec for the initContainer here If any storage volumes are needed in the initContainer see InitVolumes below | []corev1.Container | false |
6868
| initVolumes | If the InitContainers require any storage volumes Provide the complete specification for the required Volumes here | []corev1.Volume | false |
6969
| podMetadata | PodMetadata is for any Metadata that is unique to the pods, and does not belong on any other objects, such as Prometheus scrape tags | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#objectmeta-v1-meta) | false |
70-
| parallelPodManagement | ParallelPodManagement sets StatefulSets created by the operator to have Parallel pod management instead of OrderedReady. This is an EXPERIMENTAL flag and subject to deprecation in a future release. This has not been tested in production and users should not depend on it without validating it for their own use case. | bool | true |
70+
| parallelPodManagement | ParallelPodManagement sets StatefulSets created by the operator to have Parallel pod management instead of OrderedReady. If nil, this will default to true. | *bool | true |
7171
| serviceAccountName | To use a non-default service account, specify the name here otherwise the service account \"default\" will be used. This is useful for advanced use-cases such as pod security policies. The service account must exist. This operator will not create it. | string | false |
7272
| frozen | Frozen is used to stop the operator from taking any further actions on a cluster. This is useful when troubleshooting as it guarantees the operator won't make any changes to the cluster. | bool | false |
7373

pkg/apis/m3dboperator/v1alpha1/cluster.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,9 @@ type ClusterSpec struct {
295295
PodMetadata metav1.ObjectMeta `json:"podMetadata,omitempty"`
296296

297297
// ParallelPodManagement sets StatefulSets created by the operator to have
298-
// Parallel pod management instead of OrderedReady. This is an EXPERIMENTAL
299-
// flag and subject to deprecation in a future release. This has not been
300-
// tested in production and users should not depend on it without validating
301-
// it for their own use case.
302-
ParallelPodManagement bool `json:"parallelPodManagement,omitEmpty"`
298+
// Parallel pod management instead of OrderedReady. If nil, this will default
299+
// to true.
300+
ParallelPodManagement *bool `json:"parallelPodManagement,omitEmpty"`
303301

304302
// To use a non-default service account, specify the name here otherwise the
305303
// service account "default" will be used. This is useful for advanced

pkg/apis/m3dboperator/v1alpha1/openapi_generated.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/m3dboperator/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/k8sops/m3db/generators_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ func TestGenerateStatefulSet(t *testing.T) {
137137
Selector: &metav1.LabelSelector{
138138
MatchLabels: labels,
139139
},
140-
Replicas: instanceAmount,
140+
PodManagementPolicy: appsv1.ParallelPodManagement,
141+
Replicas: instanceAmount,
141142
Template: v1.PodTemplateSpec{
142143
ObjectMeta: metav1.ObjectMeta{
143144
Labels: labels,
@@ -492,16 +493,17 @@ func TestGenerateStatefulSet(t *testing.T) {
492493

493494
// Test PodManagement
494495
fixture = getFixture("testM3DBCluster.yaml", t)
495-
fixture.Spec.ParallelPodManagement = true
496+
fixture.Spec.ParallelPodManagement = pointer.BoolPtr(false)
496497

497498
ss = baseSS.DeepCopy()
498-
ss.Spec.PodManagementPolicy = "Parallel"
499+
ss.Spec.PodManagementPolicy = ""
499500
newSS, err = GenerateStatefulSet(fixture, isolationGroup, *instanceAmount)
500501
assert.NoError(t, err)
501502
assert.NotNil(t, newSS)
502503
if !assert.Equal(t, ss, newSS) {
503504
diff, _ := messagediff.PrettyDiff(ss, newSS)
504505
t.Log(diff)
506+
t.Log(fixture.Spec.ParallelPodManagement)
505507
}
506508
}
507509

pkg/k8sops/m3db/statefulset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func NewBaseStatefulSet(ssName, isolationGroup string, cluster *myspec.M3DBClust
179179
},
180180
}
181181

182-
if cluster.Spec.ParallelPodManagement {
182+
if cluster.Spec.ParallelPodManagement == nil || *cluster.Spec.ParallelPodManagement {
183183
stsSpec.PodManagementPolicy = appsv1.ParallelPodManagement
184184
}
185185

0 commit comments

Comments
 (0)