Skip to content

Commit

Permalink
improvement(k8s): also delete metadata namespace when cleaning up
Browse files Browse the repository at this point in the history
Closes #1266
  • Loading branch information
edvald committed Oct 15, 2019
1 parent 21ad8f2 commit f3af877
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions garden-service/src/plugins/kubernetes/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { KubeApi, KubernetesError } from "./api"
import { getAppNamespace, prepareNamespaces, deleteNamespaces } from "./namespace"
import { getAppNamespace, prepareNamespaces, deleteNamespaces, getMetadataNamespace } from "./namespace"
import { KubernetesPluginContext, KubernetesConfig } from "./config"
import { checkTillerStatus, installTiller } from "./helm/tiller"
import {
Expand Down Expand Up @@ -233,13 +233,14 @@ export async function cleanupEnvironment({ ctx, log }: CleanupEnvironmentParams)
const k8sCtx = <KubernetesPluginContext>ctx
const api = await KubeApi.factory(log, k8sCtx.provider)
const namespace = await getAppNamespace(k8sCtx, log, k8sCtx.provider)
const metadataNamespace = await getMetadataNamespace(k8sCtx, log, k8sCtx.provider)
const entry = log.info({
section: "kubernetes",
msg: `Deleting namespace ${namespace} (this may take a while)`,
status: "active",
})

await deleteNamespaces([namespace], api, entry)
await deleteNamespaces([namespace, metadataNamespace], api, entry)

return {}
}
Expand Down

0 comments on commit f3af877

Please sign in to comment.