Skip to content

Commit d231071

Browse files
committed
PR feedback
2 parents 3efb715 + 0c82a58 commit d231071

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

dist/index.js

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/build-parameters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class BuildParameters {
6767
public kubeConfig!: string;
6868
public containerMemory!: string;
6969
public containerCpu!: string;
70+
public containerNamespace!: string;
7071
public kubeVolumeSize!: string;
7172
public kubeVolume!: string;
7273
public kubeStorageClass!: string;
@@ -195,6 +196,7 @@ class BuildParameters {
195196
kubeConfig: CloudRunnerOptions.kubeConfig,
196197
containerMemory: CloudRunnerOptions.containerMemory,
197198
containerCpu: CloudRunnerOptions.containerCpu,
199+
containerNamespace: CloudRunnerOptions.containerNamespace,
198200
kubeVolumeSize: CloudRunnerOptions.kubeVolumeSize,
199201
kubeVolume: CloudRunnerOptions.kubeVolume,
200202
postBuildContainerHooks: CloudRunnerOptions.postBuildContainerHooks,

src/model/cloud-runner/options/cloud-runner-options.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ class CloudRunnerOptions {
135135
return CloudRunnerOptions.getInput('containerMemory') || `3072`;
136136
}
137137

138+
static get containerNamespace(): string {
139+
return CloudRunnerOptions.getInput('containerNamespace') || `default`;
140+
}
141+
138142
static get customJob(): string {
139143
return CloudRunnerOptions.getInput('customJob') || '';
140144
}

src/model/cloud-runner/providers/k8s/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class Kubernetes implements ProviderInterface {
3737
public serviceAccountName: string = '';
3838
public ip: string = '';
3939

40-
// eslint-disable-next-line no-unused-vars
4140
constructor(buildParameters: BuildParameters) {
4241
Kubernetes.Instance = this;
4342
this.kubeConfig = new k8s.KubeConfig();
@@ -46,7 +45,7 @@ class Kubernetes implements ProviderInterface {
4645
this.kubeClientApps = this.kubeConfig.makeApiClient(k8s.AppsV1Api);
4746
this.kubeClientBatch = this.kubeConfig.makeApiClient(k8s.BatchV1Api);
4847
this.rbacAuthorizationV1Api = this.kubeConfig.makeApiClient(k8s.RbacAuthorizationV1Api);
49-
this.namespace = 'default';
48+
this.namespace = buildParameters.containerNamespace ? buildParameters.containerNamespace : 'default';
5049
CloudRunnerLogger.log('Loaded default Kubernetes configuration for this environment');
5150
}
5251

src/model/cloud-runner/providers/k8s/kubernetes-task-runner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class KubernetesTaskRunner {
3030
);
3131
let extraFlags = ``;
3232
extraFlags += (await KubernetesPods.IsPodRunning(podName, namespace, kubeClient))
33-
? ` -f -c ${containerName}`
34-
: ` --previous`;
33+
? ` -f -c ${containerName} -n ${namespace}`
34+
: ` --previous -n ${namespace}`;
3535

3636
const callback = (outputChunk: string) => {
3737
output += outputChunk;

0 commit comments

Comments
 (0)