Skip to content

Commit

Permalink
fix(k8s): include imagePullSecrets when running task and test Pods
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Feb 7, 2020
1 parent 86174f9 commit 10df10e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { gardenAnnotationKey } from "../../../util/string"
import { RuntimeContext } from "../../../runtime-context"
import { resolve } from "path"
import { killPortForwards } from "../port-forward"
import { ensureSecret, prepareImagePullSecrets } from "../secrets"
import { prepareImagePullSecrets } from "../secrets"

export const DEFAULT_CPU_REQUEST = "10m"
export const DEFAULT_MEMORY_REQUEST = "64Mi"
Expand Down
5 changes: 3 additions & 2 deletions garden-service/src/plugins/kubernetes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { prepareEnvVars, makePodName } from "./util"
import { deline } from "../../util/string"
import { ArtifactSpec } from "../../config/validation"
import cpy from "cpy"
import { prepareImagePullSecrets } from "./secrets"

export async function runAndCopy({
ctx,
Expand Down Expand Up @@ -64,6 +65,7 @@ export async function runAndCopy({
namespace: string
}): Promise<RunResult> {
const provider = <KubernetesProvider>ctx.provider
const api = await KubeApi.factory(log, provider)

// Prepare environment variables
envVars = { ...runtimeContext.envVars, ...envVars }
Expand All @@ -88,6 +90,7 @@ export async function runAndCopy({
volumeMounts: [],
},
],
imagePullSecrets: await prepareImagePullSecrets({ api, provider, namespace, log }),
}

if (!description) {
Expand Down Expand Up @@ -121,8 +124,6 @@ export async function runAndCopy({
}
}

const api = await KubeApi.factory(log, provider)

if (!podName) {
podName = makePodName("run", module.name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { emptyRuntimeContext } from "../../../../../../src/runtime-context"
import { KubeApi } from "../../../../../../src/plugins/kubernetes/api"
import { createWorkloadManifest } from "../../../../../../src/plugins/kubernetes/container/deployment"
import { KubernetesProvider } from "../../../../../../src/plugins/kubernetes/config"
import { ensureSecret } from "../../../../../../src/plugins/kubernetes/secrets"
import { V1Secret } from "@kubernetes/client-node"
import { KubernetesResource } from "../../../../../../src/plugins/kubernetes/types"
import { cloneDeep } from "lodash"
Expand Down

0 comments on commit 10df10e

Please sign in to comment.