-
Notifications
You must be signed in to change notification settings - Fork 178
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
feat: refactor cmpd's role definition #8416
base: main
Are you sure you want to change the base?
Conversation
b18c91c
to
deaf5f1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8416 +/- ##
==========================================
- Coverage 61.22% 61.15% -0.07%
==========================================
Files 351 351
Lines 41854 41828 -26
==========================================
- Hits 25624 25581 -43
- Misses 13906 13921 +15
- Partials 2324 2326 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
752aefa
to
90b8f22
Compare
// | ||
// +kubebuilder:default=0 | ||
// +optional | ||
UpdatePriority int `json:"updatePriority"` |
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.
maybe MaintenanceOrder
// | ||
// +kubebuilder:default=false | ||
// +optional | ||
SwitchoverBeforeUpdate bool `json:"switchoverBeforeUpdate"` |
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.
maybe SwitchoverBeforeMaintenance
or NeedSwitchover
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 remove this option and decide within the switchover action whether a switchover is necessary based on the role of target pod?
// | ||
// +kubebuilder:default=false | ||
// +optional | ||
ParticipatesInQuorum bool `json:"participatesInQuorum"` |
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.
maybe simplify to InQuorum
98bfd03
to
b0e9c70
Compare
ea9ddbd
to
12ffec8
Compare
@@ -232,7 +232,16 @@ func (r *RestoreManager) DoPostReady(comp *component.SynthesizedComponent, | |||
backupObj *dpv1alpha1.Backup) error { | |||
jobActionLabels := constant.GetCompLabels(r.Cluster.Name, comp.Name) | |||
if len(comp.Roles) > 0 { | |||
jobActionLabels[instanceset.AccessModeLabelKey] = string(appsv1alpha1.ReadWrite) | |||
// HACK: assume the role with highest priority to be writable |
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.
It's better to let the data-protection define a policy to select target pods explicitly.
|
||
// getTargetRole returns the role on which the switchover is performed | ||
// FIXME: the assumption that only one role supports switchover may change in the future | ||
func getTargetRoleName(roles []appsv1.ReplicaRole) (string, error) { |
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 don't need to infer the target pods, just let the user specify the specific roles or pods.
return "", fmt.Errorf("more than one role defined as leader: %s,%s", targetRole, role.Name) | ||
} | ||
targetRole = role.Name | ||
// HACK: assume the role with highest priority to be leader |
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.
All of the legacy codes can be removed.
@@ -291,6 +293,9 @@ type InstanceSetStatus struct { | |||
|
|||
// Indicates whether it is required for the InstanceSet to have at least one primary instance ready. | |||
// | |||
// Deprecated: since instanceset no longer checks a "primary" role when doing ready check, this |
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.
Remove the field directly.
fixes #8377