-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature:support configuring PodManagementPolicy in TidbCluster CR #4211
Feature:support configuring PodManagementPolicy in TidbCluster CR #4211
Conversation
the TidbCluster
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov Report
@@ Coverage Diff @@
## master #4211 +/- ##
=======================================
Coverage 61.78% 61.79%
=======================================
Files 181 181
Lines 19273 19277 +4
=======================================
+ Hits 11908 11912 +4
Misses 6217 6217
Partials 1148 1148
|
policy = a.ComponentSpec.PodManagementPolicy | ||
} | ||
// unified podManagementPolicy check to avoid check everywhere | ||
if len(policy) == 0 || policy == apps.OrderedReadyPodManagement { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I add the check of PodManagementPolicyType here to avoid check it everywhere, is this OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK
@@ -696,7 +696,7 @@ func getNewMasterSetForDMCluster(dc *v1alpha1.DMCluster, cm *corev1.ConfigMap) ( | |||
}, | |||
}, | |||
ServiceName: controller.DMMasterPeerMemberName(dcName), | |||
PodManagementPolicy: apps.ParallelPodManagement, | |||
PodManagementPolicy: apps.OrderedReadyPodManagement, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not support configuring DM master&worker cause StatefulSetUpdateStrategy
is not supported too.
tidb-operator/pkg/manager/member/dm_master_member_manager.go
Lines 700 to 704 in d4c238c
UpdateStrategy: apps.StatefulSetUpdateStrategy{ | |
Type: apps.RollingUpdateStatefulSetStrategyType, | |
RollingUpdate: &apps.RollingUpdateStatefulSetStrategy{ | |
Partition: pointer.Int32Ptr(dc.Spec.Master.Replicas + int32(failureReplicas) + deleteSlotsNumber), | |
}}, |
I'll add them if need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's needed, but you can added them later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will add them in another PR.
…k/tidb-operator into support-PodManagementPolicy-config
…mentPolicy-config
…k/tidb-operator into support-PodManagementPolicy-config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
// unified podManagementPolicy check to avoid check everywhere | ||
if policy == apps.OrderedReadyPodManagement { | ||
return apps.OrderedReadyPodManagement | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some unknown value will be treated as ParallelPodManagement
silently? at least log for unknown config item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about just passing the value to set in sts spec, make it error to let the user know setting wrong item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Refer to StatefulSetUpdateStrategy:
tidb-operator/pkg/manager/member/pd_member_manager.go
Lines 759 to 767 in 48ae829
updateStrategy := apps.StatefulSetUpdateStrategy{} | |
if basePDSpec.StatefulSetUpdateStrategy() == apps.OnDeleteStatefulSetStrategyType { | |
updateStrategy.Type = apps.OnDeleteStatefulSetStrategyType | |
} else { | |
updateStrategy.Type = apps.RollingUpdateStatefulSetStrategyType | |
updateStrategy.RollingUpdate = &apps.RollingUpdateStatefulSetStrategy{ | |
Partition: pointer.Int32Ptr(tc.PDStsDesiredReplicas() + deleteSlotsNumber), | |
} | |
} |
examples/advanced/tidb-cluster.yaml
Outdated
|
||
## PodManagementPolicy default Parallel. | ||
## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies | ||
podManagementPolicy: Parallel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change the default value as OrderedReady?
@DanielZhangQD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep the current behavior for the default configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, for pump it is not keep the current behavior for the default configuration
, it does not set the value before
/run-all-tests |
/test pull-e2e-kind |
@@ -470,6 +470,7 @@ func getNewPumpStatefulSet(tc *v1alpha1.TidbCluster, cm *corev1.ConfigMap) (*app | |||
|
|||
Template: podTemplate, | |||
VolumeClaimTemplates: volumeClaims, | |||
PodManagementPolicy: spec.PodManagementPolicy(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The podManagementPolicy
is not set before as @july2993 has said in another comment, so the default value is OrderedReady
for pump, and this field is not allowed to update after the sts is created, so we have to set to OrderedReady
for pump if it's not set explicitly.
Co-authored-by: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: eb41a1b
|
/run-all-tests |
/test pull-e2e-kind |
1 similar comment
/test pull-e2e-kind |
What problem does this PR solve?
Close: #3228
What is changed and how does it work?
Code changes
Tests
Side effects
Related changes
Release Notes
Please refer to Release Notes Language Style Guide before writing the release note.