-
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
fix some orphan pods cleaner bugs #878
Conversation
|
||
// Start informer factories after all controller are initializated. | ||
informerFactory.Start(controllerCtx.Done()) | ||
kubeInformerFactory.Start(controllerCtx.Done()) |
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.
Start
will start a new goroutine, so no need to use go ...
here.
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
@@ -89,6 +118,9 @@ func (opc *orphanPodsCleaner) Clean(tc *v1alpha1.TidbCluster) (map[string]string | |||
return skipReason, err | |||
} | |||
|
|||
// if the PVC is not found in apiserver (also informer cache) and the | |||
// phrase of the Pod is Pending, delete it and let the stateful | |||
// controller to create the pod and its PVC(s) again | |||
err = opc.podControl.DeletePod(tc, pod) |
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.
only delete pod if the pod status is Pending
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.
sorry, I forgot it...added in 9791178
/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 |
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
// if the PVC is not found in apiserver (also informer cache) and the | ||
// phase of the Pod is Pending, delete it and let the stateful | ||
// controller to create the pod and its PVC(s) again | ||
apiPod, err := opc.kubeCli.CoreV1().Pods(pod.Namespace).Get(pod.Name, metav1.GetOptions{}) |
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.
Use ns
and podName
instead of pod.Namespace
and pod.Name
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-in-kind |
return skipReason, err | ||
} | ||
// try our best to avoid deleting wrong object in apiserver | ||
// TODO upgrade to use deleteOption.Preconditions.ResourceVersion in client-go 1.14+ |
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.
/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
/run-e2e-in-kind |
/run-e2e-tests |
/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 |
/run-e2e-tests |
1 similar comment
/run-e2e-tests |
cherry pick to release-1.0 failed |
* fix some orphan pods cleaner bugs * pod pending check * reword * fix typo * fast path * double check pod in apiserver
* fix some orphan pods cleaner bugs * pod pending check * reword * fix typo * fast path * double check pod in apiserver
What problem does this PR solve?
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?: