Skip to content
Snippets Groups Projects
Commit 3f8e5fd3 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

fix deletion of containers

(was deleting *all* containers after upgrading the client library...)
parent 399d98a8
No related branches found
No related tags found
No related merge requests found
...@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment