fix deletion of containers

(was deleting *all* containers after upgrading the client library...)
parent 399d98a8
...@@ -184,7 +184,7 @@ function getOrCreatePod(podName, repl, shouldCreate, next) { ...@@ -184,7 +184,7 @@ function getOrCreatePod(podName, repl, shouldCreate, next) {
next(error, null) next(error, null)
} else if (pod.status && ['Error', 'Failed', 'Succeeded'].includes(pod.status.phase)) { } else if (pod.status && ['Error', 'Failed', 'Succeeded'].includes(pod.status.phase)) {
if (shouldCreate) { if (shouldCreate) {
k8.api.v1.ns(config.k8component.namespace).pods.delete({ name: podName }).then(function (delResult) { k8.api.v1.ns(config.k8component.namespace).pod(podName).delete().then(function (delResult) {
logger.info(`Deleted stopped pod ${podName} to restart it`) logger.info(`Deleted stopped pod ${podName} to restart it`)
createPod(podName, repl, next) // wait & return 'pod shutting down' instead? createPod(podName, repl, next) // wait & return 'pod shutting down' instead?
}, function(err) { }, function(err) {
...@@ -327,7 +327,7 @@ function guaranteeResolvePod(repl, res, next){ ...@@ -327,7 +327,7 @@ function guaranteeResolvePod(repl, res, next){
function deletePod(podName, next) { function deletePod(podName, next) {
k8.api.v1.ns(config.k8component.namespace).pods.delete({ name: podName }).then(function (result) { k8.api.v1.ns(config.k8component.namespace).pod(podName).delete().then(function (result) {
resolveCache.set(podName, undefined) resolveCache.set(podName, undefined)
logger.info(`deleted pod ${podName}`) logger.info(`deleted pod ${podName}`)
next(null, result.body) next(null, result.body)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment