Skip to content
This repository was archived by the owner on Oct 7, 2026. It is now read-only.

Commit 7dee48c

Browse files
authored
Drop k8s_gpu logic (#1110)
Details: Let us finally be done with this! Watch out: - .env changes Testing: - covered by automated tests - manual testing TODO
1 parent 0fea8ec commit 7dee48c

14 files changed

Lines changed: 26 additions & 159 deletions

File tree

‎docs/llms-ctx-full.txt‎

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

‎docs/llms-ctx.txt‎

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

‎docs/reference/config.md‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,6 @@ You can configure Vivaria to run task environments and agent containers in:
108108
| `VIVARIA_AWS_ACCESS_KEY_ID_FOR_EKS` | If using EKS, an AWS access key ID for an IAM user with permission to create and delete Pods in the EKS cluster. |
109109
| `VIVARIA_AWS_SECRET_ACCESS_KEY_FOR_EKS` | If using EKS, the AWS secret access key for the IAM user with permission to create and delete Pods in the EKS cluster. |
110110

111-
### Kubernetes cluster with GPUs
112-
113-
| Variable Name | Description |
114-
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
115-
| `VIVARIA_K8S_GPU_CLUSTER_URL` | The URL of the Kubernetes cluster with GPUs used by Vivaria. |
116-
| `VIVARIA_K8S_GPU_CLUSTER_CA_DATA` | Vivaria uses this to verify the Kubernetes cluster's identity, to prevent man-in-the-middle attacks. Vivaria puts this in the cluster's `certificate-authority-data` field in its kubeconfig object. |
117-
| `VIVARIA_K8S_GPU_CLUSTER_NAMESPACE` | The namespace in the Kubernetes cluster with GPUs where Vivaria will create resources. Defaults to 'default'. |
118-
| `VIVARIA_K8S_GPU_CLUSTER_IMAGE_PULL_SECRET_NAME` | If you're pulling images from a private registry, put credentials for the registry in a Kubernetes secret as specified here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ Then, set this to the name of the secret. |
119-
| `VIVARIA_K8S_GPU_CLUSTER_CLIENT_CERTIFICATE_DATA` | The client certificate for the Kubernetes cluster with GPUs. Vivaria puts this in the `client-certificate-data` field of the user it uses to authenticate to the cluster. |
120-
| `VIVARIA_K8S_GPU_CLUSTER_CLIENT_KEY_DATA` | The client key for the Kubernetes cluster with GPUs. Vivaria puts this in the `client-key-data` field of the user it uses to authenticate to the cluster. |
121-
| `VIVARIA_API_IP_FOR_K8S_GPU_CLUSTER` | An IP address or hostname at which pods in the Kubernetes cluster with GPUs can find the Vivaria server. |
122-
123111
## Agent sandboxing
124112

125113
| Variable Name | Description |

‎server/src/RunQueue.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ export class RunAllocator {
348348
async getHostInfo(runId: RunId): Promise<{ host: Host; taskInfo: TaskInfo }> {
349349
const run = await this.dbRuns.get(runId)
350350
const taskInfo = await this.dbRuns.getTaskInfo(runId)
351-
const host = run.isK8s ? await this.k8sHostFactory.createForTask(taskInfo) : this.vmHost.primary
351+
const host = run.isK8s ? this.k8sHostFactory.createDefault() : this.vmHost.primary
352352
return { host, taskInfo }
353353
}
354354
}

‎server/src/core/remote.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,3 @@ export class PrimaryVmHost {
286286
}
287287

288288
export const K8S_HOST_MACHINE_ID = 'eks'
289-
export const K8S_GPU_HOST_MACHINE_ID = 'k8s-gpu'

‎server/src/routes/raw_routes.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class TaskAllocator {
130130
isK8s: boolean,
131131
): Promise<{ taskInfo: TaskInfo; host: Host }> {
132132
const taskInfo = await this.makeTaskInfo(taskId, source, isK8s)
133-
const host = isK8s ? await this.k8sHostFactory.createForTask(taskInfo) : this.vmHost.primary
133+
const host = isK8s ? this.k8sHostFactory.createDefault() : this.vmHost.primary
134134
return { taskInfo, host }
135135
}
136136

‎server/src/services/Config.test.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, test } from 'vitest'
2-
import { Host, K8S_GPU_HOST_MACHINE_ID, K8S_HOST_MACHINE_ID } from '../core/remote'
2+
import { Host, K8S_HOST_MACHINE_ID } from '../core/remote'
33
import { Config } from './Config'
44

55
describe('Config', () => {
@@ -46,11 +46,10 @@ describe('Config', () => {
4646
}
4747

4848
test.each`
49-
isK8sHost | machineId | hasGPUs | isLocal | expected
50-
${true} | ${K8S_HOST_MACHINE_ID} | ${true} | ${false} | ${'http://api-ip:8080'}
51-
${true} | ${K8S_GPU_HOST_MACHINE_ID} | ${true} | ${false} | ${'http://vivaria-api-ip-for-k8s-gpu-cluster:8080'}
52-
${true} | ${'unknown-machine-id'} | ${true} | ${false} | ${new Error('Unknown machine ID for k8s host: unknown-machine-id')}
53-
${false} | ${'local-machine-id'} | ${false} | ${true} | ${'http://api-ip:8080'}
49+
isK8sHost | machineId | hasGPUs | isLocal | expected
50+
${true} | ${K8S_HOST_MACHINE_ID} | ${true} | ${false} | ${'http://api-ip:8080'}
51+
${true} | ${'unknown-machine-id'} | ${true} | ${false} | ${new Error('Unknown machine ID for k8s host: unknown-machine-id')}
52+
${false} | ${'local-machine-id'} | ${false} | ${true} | ${'http://api-ip:8080'}
5453
`(
5554
'returns the correct URL for isK8sHost=$isK8sHost, machineId=$machineId, hasGPUs=$hasGPUs, isLocal=$isLocal',
5655
({

‎server/src/services/Config.ts‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { readFileSync } from 'node:fs'
22
import { ClientConfig } from 'pg'
33
import { floatOrNull, intOr, throwErr } from 'shared'
4-
import { GpuMode, K8S_GPU_HOST_MACHINE_ID, K8S_HOST_MACHINE_ID, K8sHost, Location, type Host } from '../core/remote'
4+
import { GpuMode, K8S_HOST_MACHINE_ID, K8sHost, Location, type Host } from '../core/remote'
55
import { getApiOnlyNetworkName } from '../docker/util'
66
/**
77
* Organized into alphabetized groups, with miscellaneous vars at the end.
@@ -154,15 +154,6 @@ class RawConfig {
154154
readonly VIVARIA_K8S_RUN_QUEUE_BATCH_SIZE = intOr(this.env.VIVARIA_K8S_RUN_QUEUE_BATCH_SIZE, 5)
155155
readonly VIVARIA_K8S_RUN_QUEUE_INTERVAL_MS = intOr(this.env.VIVARIA_K8S_RUN_QUEUE_INTERVAL_MS, 250)
156156

157-
/************ Kubernetes cluster with GPUs ***********/
158-
readonly VIVARIA_K8S_GPU_CLUSTER_URL = this.env.VIVARIA_K8S_GPU_CLUSTER_URL
159-
readonly VIVARIA_K8S_GPU_CLUSTER_CA_DATA = this.env.VIVARIA_K8S_GPU_CLUSTER_CA_DATA
160-
readonly VIVARIA_K8S_GPU_CLUSTER_NAMESPACE = this.env.VIVARIA_K8S_GPU_CLUSTER_NAMESPACE ?? 'default'
161-
readonly VIVARIA_K8S_GPU_CLUSTER_IMAGE_PULL_SECRET_NAME = this.env.VIVARIA_K8S_GPU_CLUSTER_IMAGE_PULL_SECRET_NAME
162-
readonly VIVARIA_K8S_GPU_CLUSTER_CLIENT_CERTIFICATE_DATA = this.env.VIVARIA_K8S_GPU_CLUSTER_CLIENT_CERTIFICATE_DATA
163-
readonly VIVARIA_K8S_GPU_CLUSTER_CLIENT_KEY_DATA = this.env.VIVARIA_K8S_GPU_CLUSTER_CLIENT_KEY_DATA
164-
readonly VIVARIA_API_IP_FOR_K8S_GPU_CLUSTER = this.env.VIVARIA_API_IP_FOR_K8S_GPU_CLUSTER
165-
166157
//************ Inspect Importer ***********/
167158
readonly INSPECT_IMPORT_CHUNK_SIZE = parseInt(this.env.INSPECT_IMPORT_CHUNK_SIZE ?? '5')
168159

@@ -213,8 +204,6 @@ class RawConfig {
213204
// environment variables. It should include a list of host configs and each host config should have an API IP.
214205
if (host instanceof K8sHost) {
215206
switch (host.machineId) {
216-
case K8S_GPU_HOST_MACHINE_ID:
217-
return this.VIVARIA_API_IP_FOR_K8S_GPU_CLUSTER ?? throwErr('VIVARIA_API_IP_FOR_K8S_GPU_CLUSTER not set')
218207
case K8S_HOST_MACHINE_ID:
219208
return this.API_IP ?? throwErr('API_IP not set')
220209
default:
@@ -313,7 +302,7 @@ class RawConfig {
313302
assertHasGpuSupport(): void {
314303
if (this.gpuMode === GpuMode.NONE) {
315304
throw new Error(
316-
`Task requires GPUs but this Vivaria instance doesn't support them: MP4_DOCKER_USE_GPUS and ENABLE_VP are both falsy, and at least one of VIVARIA_K8S_GPU_CLUSTER_URL and VIVARIA_K8S_GPU_CLUSTER_CA_DATA is not set.`,
305+
`Task requires GPUs but this Vivaria instance doesn't support them: MP4_DOCKER_USE_GPUS and ENABLE_VP are both falsy.`,
317306
)
318307
}
319308
}
@@ -325,9 +314,6 @@ class RawConfig {
325314
if (this.VIVARIA_K8S_CLUSTER_URL != null && this.VIVARIA_K8S_CLUSTER_CA_DATA != null) {
326315
return GpuMode.REMOTE
327316
}
328-
if (this.VIVARIA_K8S_GPU_CLUSTER_URL != null && this.VIVARIA_K8S_GPU_CLUSTER_CA_DATA != null) {
329-
return GpuMode.REMOTE
330-
}
331317
return GpuMode.NONE
332318
}
333319

‎server/src/services/Hosts.test.ts‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ContainerIdentifierType } from 'shared'
22
import { describe, expect, test } from 'vitest'
33
import { TestHelper } from '../../test-util/testHelper'
44
import { insertRunAndUser } from '../../test-util/testUtil'
5-
import { K8S_GPU_HOST_MACHINE_ID, K8S_HOST_MACHINE_ID, K8sHost, PrimaryVmHost } from '../core/remote'
5+
import { K8S_HOST_MACHINE_ID, K8sHost, PrimaryVmHost } from '../core/remote'
66
import { VmHost } from '../docker/VmHost'
77
import { DBRuns } from './db/DBRuns'
88
import { DBTaskEnvironments } from './db/DBTaskEnvironments'
@@ -15,7 +15,6 @@ describe.skipIf(process.env.INTEGRATION_TESTING == null)('Hosts', () => {
1515
const baseConfigOverrides = {
1616
VIVARIA_K8S_CLUSTER_URL: 'k8s-cluster-url',
1717
VIVARIA_K8S_CLUSTER_CA_DATA: 'k8s-cluster-ca-data',
18-
VIVARIA_K8S_GPU_CLUSTER_URL: 'k8s-gpu-cluster-url',
1918
VIVARIA_K8S_GPU_CLUSTER_CA_DATA: 'k8s-gpu-cluster-ca-data',
2019
}
2120

@@ -24,7 +23,6 @@ describe.skipIf(process.env.INTEGRATION_TESTING == null)('Hosts', () => {
2423
hostId | isK8sHost | hasGPUs
2524
${PrimaryVmHost.MACHINE_ID} | ${false} | ${false}
2625
${K8S_HOST_MACHINE_ID} | ${true} | ${true}
27-
${K8S_GPU_HOST_MACHINE_ID} | ${true} | ${true}
2826
`('returns the correct host for $hostId', async ({ hostId, isK8sHost, hasGPUs }) => {
2927
await using helper = new TestHelper({ configOverrides: baseConfigOverrides })
3028
const hosts = helper.get(Hosts)
@@ -169,7 +167,6 @@ describe.skipIf(process.env.INTEGRATION_TESTING == null)('Hosts', () => {
169167
configOverrides: {
170168
...baseConfigOverrides,
171169
VIVARIA_K8S_CLUSTER_URL: 'k8s-cluster-url',
172-
VIVARIA_K8S_GPU_CLUSTER_URL: undefined,
173170
},
174171
})
175172
const hosts = helper.get(Hosts)
@@ -183,28 +180,5 @@ describe.skipIf(process.env.INTEGRATION_TESTING == null)('Hosts', () => {
183180
expect(k8sHosts).toHaveLength(1)
184181
expect(k8sHosts[0].machineId).toEqual(K8S_HOST_MACHINE_ID)
185182
})
186-
187-
test('returns both k8s hosts if both k8s hosts are enabled', async () => {
188-
await using helper = new TestHelper({
189-
configOverrides: {
190-
...baseConfigOverrides,
191-
VIVARIA_K8S_CLUSTER_URL: 'k8s-cluster-url',
192-
VIVARIA_K8S_GPU_CLUSTER_URL: 'k8s-gpu-cluster-url',
193-
},
194-
})
195-
196-
const hosts = helper.get(Hosts)
197-
const vmHost = helper.get(VmHost)
198-
199-
const activeHosts = await hosts.getActiveHosts()
200-
expect(activeHosts).toHaveLength(3)
201-
expect(activeHosts).toContain(vmHost.primary)
202-
203-
const k8sHosts = activeHosts.filter(host => host instanceof K8sHost)
204-
expect(k8sHosts).toHaveLength(2)
205-
expect(k8sHosts.map(host => host.machineId)).toEqual(
206-
expect.arrayContaining([K8S_HOST_MACHINE_ID, K8S_GPU_HOST_MACHINE_ID]),
207-
)
208-
})
209183
})
210184
})

0 commit comments

Comments
 (0)