shorten index container names
This commit is contained in:
@@ -81,7 +81,7 @@ class DockerTaskOperations implements TaskOperations {
|
||||
async index(opts: TaskOperationsIndexOptions) {
|
||||
await this.#initialize();
|
||||
|
||||
const containerName = this.#getIndexContainerName(opts.contentHash);
|
||||
const containerName = this.#getIndexContainerName(opts.shortCode);
|
||||
|
||||
logger.log(`Indexing task ${opts.imageRef}`, {
|
||||
host: COORDINATOR_HOST,
|
||||
@@ -200,12 +200,12 @@ class DockerTaskOperations implements TaskOperations {
|
||||
logger.log("noop: get");
|
||||
}
|
||||
|
||||
#getIndexContainerName(contentHash: string) {
|
||||
return `task-index-${contentHash}`;
|
||||
#getIndexContainerName(suffix: string) {
|
||||
return `task-index-${suffix}`;
|
||||
}
|
||||
|
||||
#getRunContainerName(attemptId: string) {
|
||||
return `task-run-${attemptId}`;
|
||||
#getRunContainerName(suffix: string) {
|
||||
return `task-run-${suffix}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class KubernetesTaskOperations implements TaskOperations {
|
||||
await this.#createJob(
|
||||
{
|
||||
metadata: {
|
||||
name: this.#getIndexContainerName(opts.contentHash),
|
||||
name: this.#getIndexContainerName(opts.shortCode),
|
||||
namespace: this.#namespace.metadata.name,
|
||||
},
|
||||
spec: {
|
||||
@@ -63,7 +63,7 @@ class KubernetesTaskOperations implements TaskOperations {
|
||||
],
|
||||
containers: [
|
||||
{
|
||||
name: opts.contentHash,
|
||||
name: this.#getIndexContainerName(opts.shortCode),
|
||||
image: opts.imageRef,
|
||||
ports: [
|
||||
{
|
||||
@@ -159,7 +159,7 @@ class KubernetesTaskOperations implements TaskOperations {
|
||||
],
|
||||
containers: [
|
||||
{
|
||||
name: opts.attemptId,
|
||||
name: this.#getRunContainerName(opts.attemptId),
|
||||
image: opts.image,
|
||||
ports: [
|
||||
{
|
||||
@@ -309,12 +309,12 @@ class KubernetesTaskOperations implements TaskOperations {
|
||||
await this.#getPod(opts.runId, this.#namespace);
|
||||
}
|
||||
|
||||
#getIndexContainerName(contentHash: string) {
|
||||
return `task-index-${contentHash}`;
|
||||
#getIndexContainerName(suffix: string) {
|
||||
return `task-index-${suffix}`;
|
||||
}
|
||||
|
||||
#getRunContainerName(attemptId: string) {
|
||||
return `task-run-${attemptId}`;
|
||||
#getRunContainerName(suffix: string) {
|
||||
return `task-run-${suffix}`;
|
||||
}
|
||||
|
||||
#createK8sApi() {
|
||||
|
||||
@@ -45,7 +45,7 @@ export class IndexDeploymentService extends BaseService {
|
||||
try {
|
||||
const responses = await socketIo.providerNamespace.timeout(10_000).emitWithAck("INDEX", {
|
||||
version: "v1",
|
||||
contentHash: deployment.contentHash,
|
||||
shortCode: deployment.shortCode,
|
||||
imageTag: deployment.imageReference,
|
||||
envId: deployment.environmentId,
|
||||
apiKey: deployment.environment.apiKey,
|
||||
|
||||
@@ -22,7 +22,7 @@ const PLATFORM_SECRET = process.env.PLATFORM_SECRET || "provider-secret";
|
||||
const logger = new SimpleLogger(`[${MACHINE_NAME}]`);
|
||||
|
||||
export interface TaskOperationsIndexOptions {
|
||||
contentHash: string;
|
||||
shortCode: string;
|
||||
imageRef: string;
|
||||
envId: string;
|
||||
apiKey: string;
|
||||
@@ -164,7 +164,7 @@ export class ProviderShell implements Provider {
|
||||
INDEX: async (message) => {
|
||||
try {
|
||||
await this.tasks.index({
|
||||
contentHash: message.contentHash,
|
||||
shortCode: message.shortCode,
|
||||
imageRef: message.imageTag,
|
||||
envId: message.envId,
|
||||
apiKey: message.apiKey,
|
||||
|
||||
@@ -67,7 +67,7 @@ export const PlatformToProviderMessages = {
|
||||
message: z.object({
|
||||
version: z.literal("v1").default("v1"),
|
||||
imageTag: z.string(),
|
||||
contentHash: z.string(),
|
||||
shortCode: z.string(),
|
||||
envId: z.string(),
|
||||
apiKey: z.string(),
|
||||
apiUrl: z.string(),
|
||||
|
||||
Reference in New Issue
Block a user