-
Notifications
You must be signed in to change notification settings - Fork 500
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
Emit an event if failed to sync labels to tikv stores #2587
Conversation
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 code LGTM. Please format pkg/manager/member/tikv_member_manager.go
to pass the CI.
@@ -725,7 +729,9 @@ func (tkmm *tikvMemberManager) setStoreLabelsForTiKV(tc *v1alpha1.TidbCluster) ( | |||
if !tkmm.storeLabelsEqualNodeLabels(store.Store.Labels, ls) { | |||
set, err := pdCli.SetStoreLabels(store.Store.Id, ls) | |||
if err != nil { | |||
klog.Warningf("failed to set pod: [%s/%s]'s store labels: %v", ns, podName, ls) | |||
evtStr := fmt.Sprintf("failed to set pod: [%s/%s]'s store labels: %v", ns, podName, ls) | |||
tkmm.recorder.Event(tc, corev1.EventTypeWarning, unHealthEventReason, evtStr) |
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.
suggest to define a new const:
const FailedSetStoreLabels = "FailedSetStoreLabels"
and then replace unHealthEventReason
to FailedSetStoreLabels
.
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.
fixed
klog.Warningf("failed to set pod: [%s/%s]'s store labels: %v", ns, podName, ls) | ||
evtStr := fmt.Sprintf("failed to set pod: [%s/%s]'s store labels: %v", ns, podName, ls) | ||
tkmm.recorder.Event(tc, corev1.EventTypeWarning, FailedSetStoreLabels, evtStr) | ||
klog.Warning(evtStr) |
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.
klog.Warning(evtStr) |
this is not necessary, the recorder will print logs 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.
fixed
@@ -725,7 +729,9 @@ func (tkmm *tikvMemberManager) setStoreLabelsForTiKV(tc *v1alpha1.TidbCluster) ( | |||
if !tkmm.storeLabelsEqualNodeLabels(store.Store.Labels, ls) { | |||
set, err := pdCli.SetStoreLabels(store.Store.Id, ls) | |||
if err != nil { | |||
klog.Warningf("failed to set pod: [%s/%s]'s store labels: %v", ns, podName, ls) | |||
evtStr := fmt.Sprintf("failed to set pod: [%s/%s]'s store labels: %v", ns, podName, ls) |
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.
evtStr := fmt.Sprintf("failed to set pod: [%s/%s]'s store labels: %v", ns, podName, ls) | |
evtStr := fmt.Sprintf("failed to set labels %v for store (id: %d, pod: %s/%s): %v ", ls, store.Store.Id, ns, podName, err) |
more informative
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.
fixed
/run-e2e-tests |
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
/merge |
/merge |
/run-all-tests |
@PengJi merge failed. |
we had a problem in CI, will fix it soon |
/merge |
/run-all-tests |
@PengJi merge failed. |
/merge |
/run-all-tests |
/run-all-tests |
@PengJi merge failed. |
/merge |
Your auto merge job has been accepted, waiting for:
|
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-e2e-tests |
/merge |
Your auto merge job has been accepted, waiting for:
|
Signed-off-by: sre-bot <sre-bot@pingcap.com>
cherry pick to release-1.1 in PR #2675 |
What problem does this PR solve?
fix: #2536
What is changed and how does it work?
Check List
Tests
Code changes
Side effects
Related changes
Does this PR introduce a user-facing change?: