-
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
Stability cases: stop kubelet and etcd #665
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
742e75a
* stop kubelet
weekface 2aff2ea
fix check operator
weekface fbf67d2
Merge branch 'master' into stop-kubelet
weekface 9c98654
* stop kubelet
weekface 0984a59
fix check operator
weekface 1c22c2e
Merge branch 'master' into stop-kubelet
cofyc 78e47a6
tinyfix
weekface a0e1efa
Merge branch 'stop-kubelet' of https://github.com/weekface/tidb-opera…
weekface b96f3ea
address comment
weekface 27e08a5
Merge branch 'master' into stop-kubelet
weekface a6715df
Merge branch 'master' into stop-kubelet
xiaojingchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,8 @@ func (oa *operatorActions) CheckFailoverPending(info *TidbClusterConfig, node st | |
if _, exist := affectedPods[failureStore.PodName]; exist { | ||
err := fmt.Errorf("cluster: [%s] the tikv store[%s] should be mark failure after %s", info.FullName(), failureStore.PodName, deadline.Format(time.RFC3339)) | ||
glog.Errorf(err.Error()) | ||
return false, err | ||
// There may have been a failover before | ||
return false, nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There may have been a failover before. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be a comment in the code? |
||
} | ||
} | ||
|
||
|
@@ -276,7 +277,7 @@ func (oa *operatorActions) getPodsByNode(info *TidbClusterConfig, node string) ( | |
} | ||
|
||
func (oa *operatorActions) CheckFailoverOrDie(clusters []*TidbClusterConfig, faultNode string) { | ||
if err := wait.Poll(1*time.Minute, 30*time.Minute, func() (bool, error) { | ||
if err := wait.Poll(1*time.Minute, 60*time.Minute, func() (bool, error) { | ||
var passes []bool | ||
for i := range clusters { | ||
pass, err := oa.CheckFailover(clusters[i], faultNode) | ||
|
@@ -409,7 +410,7 @@ func (oa *operatorActions) tidbFailover(pod *corev1.Pod, tc *v1alpha1.TidbCluste | |
failure := false | ||
for _, failureMember := range tc.Status.TiDB.FailureMembers { | ||
if failureMember.PodName == pod.GetName() { | ||
glog.Infof("tidbCluster:[%s/%s]'s store pod:[%s] have not become failuremember", tc.Namespace, tc.Name, pod.Name) | ||
glog.Infof("tidbCluster:[%s/%s]'s store pod:[%s] have become failuremember", tc.Namespace, tc.Name, pod.Name) | ||
failure = true | ||
break | ||
} | ||
|
@@ -472,8 +473,33 @@ func (oa *operatorActions) GetNodeMap(info *TidbClusterConfig, component string) | |
return nodeMap, nil | ||
} | ||
|
||
func (oa *operatorActions) CheckOneEtcdDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig, faultNode string) { | ||
glog.Infof("check k8s/operator/tidbCluster status when one etcd down") | ||
func (oa *operatorActions) CheckKubeletDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig, faultNode string) { | ||
glog.Infof("check k8s/operator/tidbCluster status when kubelet down") | ||
time.Sleep(10 * time.Minute) | ||
KeepOrDie(3*time.Second, 10*time.Minute, func() error { | ||
err := oa.CheckK8sAvailable(nil, nil) | ||
if err != nil { | ||
return err | ||
} | ||
glog.V(4).Infof("k8s cluster is available.") | ||
err = oa.CheckOperatorAvailable(operatorConfig) | ||
if err != nil { | ||
return err | ||
} | ||
glog.V(4).Infof("tidb operator is available.") | ||
err = oa.CheckTidbClustersAvailable(clusters) | ||
if err != nil { | ||
return err | ||
} | ||
glog.V(4).Infof("all clusters are available") | ||
return nil | ||
}) | ||
} | ||
|
||
func (oa *operatorActions) CheckEtcdDownOrDie(operatorConfig *OperatorConfig, clusters []*TidbClusterConfig, faultNode string) { | ||
glog.Infof("check k8s/operator/tidbCluster status when etcd down") | ||
// kube-apiserver may block 15 min | ||
time.Sleep(20 * time.Minute) | ||
KeepOrDie(3*time.Second, 10*time.Minute, func() error { | ||
err := oa.CheckK8sAvailable(nil, nil) | ||
if err != nil { | ||
|
@@ -687,22 +713,33 @@ func (oa *operatorActions) CheckK8sAvailable(excludeNodes map[string]string, exc | |
} | ||
|
||
func (oa *operatorActions) CheckOperatorAvailable(operatorConfig *OperatorConfig) error { | ||
return wait.Poll(3*time.Second, 3*time.Minute, func() (bool, error) { | ||
var errCount int | ||
var e error | ||
return wait.Poll(10*time.Second, 3*time.Minute, func() (bool, error) { | ||
if errCount >= 10 { | ||
return true, e | ||
} | ||
controllerDeployment, err := oa.kubeCli.AppsV1().Deployments(operatorConfig.Namespace).Get(tidbControllerName, metav1.GetOptions{}) | ||
if err != nil { | ||
glog.Errorf("failed to get deployment:%s failed,error:%v", tidbControllerName, err) | ||
return false, nil | ||
} | ||
if controllerDeployment.Status.AvailableReplicas != *controllerDeployment.Spec.Replicas { | ||
return false, fmt.Errorf("the %s is not available", tidbControllerName) | ||
e = fmt.Errorf("the %s is not available", tidbControllerName) | ||
glog.Error(e) | ||
errCount++ | ||
return false, nil | ||
} | ||
schedulerDeployment, err := oa.kubeCli.AppsV1().Deployments(operatorConfig.Namespace).Get(tidbSchedulerName, metav1.GetOptions{}) | ||
if err != nil { | ||
glog.Errorf("failed to get deployment:%s failed,error:%v", tidbSchedulerName, err) | ||
return false, nil | ||
} | ||
if schedulerDeployment.Status.AvailableReplicas != *schedulerDeployment.Spec.Replicas { | ||
return false, fmt.Errorf("the %s is not available", tidbSchedulerName) | ||
e = fmt.Errorf("the %s is not available", tidbSchedulerName) | ||
glog.Error(e) | ||
errCount++ | ||
return false, nil | ||
} | ||
return true, nil | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
There may be two schedulers at the same time