From c88af24fd3d20f732a47646645e59fe3eecae821 Mon Sep 17 00:00:00 2001 From: Thorarinn Sigurdsson Date: Tue, 10 Sep 2019 14:52:04 +0200 Subject: [PATCH] fix(k8s): ensure sys metadata ns exists for tests When storing or getting test results, ensure that the `garden-system--metadata` namespace exists. This fixes an issue when using minikube, where this namespace wouldn't automatically be created during init, leading to errors when tests were run. --- garden-service/src/plugins/kubernetes/test-results.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/garden-service/src/plugins/kubernetes/test-results.ts b/garden-service/src/plugins/kubernetes/test-results.ts index 49ddd2c45c..9500ed23e5 100644 --- a/garden-service/src/plugins/kubernetes/test-results.ts +++ b/garden-service/src/plugins/kubernetes/test-results.ts @@ -21,6 +21,7 @@ import * as hasha from "hasha" import { gardenAnnotationKey } from "../../util/string" import { upsertConfigMap } from "./util" import { trimRunOutput } from "./helm/common" +import { ensureNamespace } from "./namespace" const testResultNamespace = systemMetadataNamespace @@ -29,6 +30,7 @@ export async function getTestResult( ): Promise { const k8sCtx = ctx const api = await KubeApi.factory(log, k8sCtx.provider) + await ensureNamespace(api, testResultNamespace) const resultKey = getTestResultKey(k8sCtx, module, testName, testVersion) try { @@ -83,6 +85,7 @@ export async function storeTestResult( ): Promise { const k8sCtx = ctx const api = await KubeApi.factory(log, k8sCtx.provider) + await ensureNamespace(api, testResultNamespace) const data: TestResult = trimRunOutput(result)