yangwwei commented on a change in pull request #208:
URL:
https://github.com/apache/incubator-yunikorn-k8shim/pull/208#discussion_r533090307
##########
File path: pkg/cache/placeholder_manager.go
##########
@@ -97,3 +98,22 @@ func (mgr *PlaceholderManager)
setMockedClients(mockedClients *client.Clients) {
defer mgr.Unlock()
mgr.clients = mockedClients
}
+
+func (mgr *PlaceholderManager) cleanOrphanPlaceholders() {
Review comment:
this needs proper locking, otherwise, it would cause data race as the
orphan pod map could get R/W simultaneously
##########
File path: pkg/cache/placeholder_manager.go
##########
@@ -97,3 +98,22 @@ func (mgr *PlaceholderManager)
setMockedClients(mockedClients *client.Clients) {
defer mgr.Unlock()
mgr.clients = mockedClients
}
+
+func (mgr *PlaceholderManager) cleanOrphanPlaceholders() {
+ for taskID, pod := range mgr.orphanPod {
+ err := mgr.clients.KubeClient.Delete(pod)
Review comment:
Need to add logging while it starts to delete the pod, and when it fails
to delete the pod.
Start to delete could be DEBUG level, if it fails to do so, it needs to be
at least a WARN level.
##########
File path: pkg/cache/placeholder_manager.go
##########
@@ -97,3 +98,22 @@ func (mgr *PlaceholderManager)
setMockedClients(mockedClients *client.Clients) {
defer mgr.Unlock()
mgr.clients = mockedClients
}
+
+func (mgr *PlaceholderManager) cleanOrphanPlaceholders() {
+ for taskID, pod := range mgr.orphanPod {
+ err := mgr.clients.KubeClient.Delete(pod)
+ if err == nil {
+ delete(mgr.orphanPod, taskID)
+ }
+ }
+}
+
+func (mgr *PlaceholderManager) Start() {
Review comment:
we need a stop function for this too.
to stop this, you probably need a stop chan to help
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]