-
Notifications
You must be signed in to change notification settings - Fork 499
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
Sync TiDB service in control-loop #1242
Conversation
Signed-off-by: Aylei <[email protected]>
/run-e2e-in-kind |
@@ -122,7 +122,7 @@ func (tmm *tidbMemberManager) syncTiDBHeadlessServiceForTidbCluster(tc *v1alpha1 | |||
if !equal { | |||
svc := *oldSvc | |||
svc.Spec = newSvc.Spec | |||
err = SetServiceLastAppliedConfigAnnotation(newSvc) |
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.
Fix an old typo
oldSvc := oldSvcTmp.DeepCopy() | ||
|
||
// Adopt orphaned service by simply overriding | ||
if metav1.GetControllerOf(oldSvc) == nil { |
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.
Adopting orphaned objects is a systematic problem that should be considered at project level in a separate issue, this PR adopts the TiDB service only.
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.
if err != nil { | ||
return err | ||
} | ||
annoEqual := isSubMapOf(newSvc.Annotations, oldSvc.Annotations) |
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.
Annotation directly added by user will be retained.
/run-e2e-in-kind |
Spec: corev1.ServiceSpec{ | ||
Type: svcSpec.Type, | ||
Ports: ports, | ||
ExternalTrafficPolicy: svcSpec.ExternalTrafficPolicy, |
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.
For api server, this should have validation and defaulting.
@@ -93,7 +93,11 @@ func (tmm *tidbMemberManager) Sync(tc *v1alpha1.TidbCluster) error { | |||
} | |||
|
|||
// Sync Tidb StatefulSet | |||
return tmm.syncTiDBStatefulSetForTidbCluster(tc) | |||
if err := tmm.syncTiDBStatefulSetForTidbCluster(tc); err != nil { | |||
return err |
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'm a bit worried that if something goes wrong with sts synchronization, then the service will not be synchronized too.
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, such dangers are everywhere in today's tidb-controller-manager because of synchronized reconciling, this should be a systematic improvement that I'd like to collect efforts in a dedicated ticket
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.
follow up: #1245
Signed-off-by: Aylei <[email protected]>
/run-e2e-in-kind |
1 similar comment
/run-e2e-in-kind |
Co-Authored-By: weekface <[email protected]>
Co-Authored-By: weekface <[email protected]>
Signed-off-by: Aylei <[email protected]>
/run-e2e-in-kind |
1 similar comment
/run-e2e-in-kind |
Signed-off-by: Aylei <[email protected]>
/run-e2e-in-kind |
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-e2e-in-kind |
1 similar comment
/run-e2e-in-kind |
/run-e2e-test |
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-e2e-test |
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
Signed-off-by: Aylei [email protected]
What problem does this PR solve?
close #1190
What is changed and how does it work?
Add syncTiDBService in tidb_member_manager
Check List
Tests
Does this PR introduce a user-facing change?: