Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async createPod(name: string,
image: string,
serviceAccount: string,
restartPolicy: string,
pullPolicy: string,
configMapEnvSource: string,
namespace: string) {
const k8sCoreApi = this.kc.makeApiClient(CoreV1Api)
let pod = new V1Pod()
pod.metadata = new V1ObjectMeta()
pod.metadata.name = name
pod.metadata.labels = { app: name }
pod.metadata.namespace = namespace
pod.spec = new V1PodSpec()
pod.spec.containers
pod.spec.restartPolicy = restartPolicy
pod.spec.serviceAccountName = serviceAccount
let opContainer = new V1Container()
opContainer.name = name
opContainer.image = image
opContainer.imagePullPolicy = pullPolicy
let envFromSource = new V1EnvFromSource()
envFromSource.configMapRef = new V1ConfigMapEnvSource()
envFromSource.configMapRef.name = configMapEnvSource
opContainer.envFrom = [envFromSource]
function newRunnerPod(
podname: string,
brigadeImage: string,
imageForcePull: boolean,
serviceAccount: string,
resourceRequests: jobs.JobResourceRequest,
resourceLimits: jobs.JobResourceLimit,
jobAnnotations: { [key: string]: string },
jobShell: string
): kubernetes.V1Pod {
let pod = new kubernetes.V1Pod();
pod.metadata = new kubernetes.V1ObjectMeta();
pod.metadata.name = podname;
pod.metadata.labels = {
heritage: "brigade",
component: "job"
};
pod.metadata.annotations = jobAnnotations;
let c1 = new kubernetes.V1Container();
c1.name = "brigaderun";
c1.image = brigadeImage;
if (jobShell == "") {
jobShell = "/bin/sh";
}
c1.command = [jobShell, "/hook/main.sh"];