MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / KubernetesTaskOperations

Class KubernetesTaskOperations

apps/kubernetes-provider/src/index.ts:33–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31};
32
33class KubernetesTaskOperations implements TaskOperations {
34 #namespace: Namespace;
35 #k8sApi: {
36 core: k8s.CoreV1Api;
37 batch: k8s.BatchV1Api;
38 };
39
40 constructor(namespace = "default") {
41 this.#namespace = {
42 metadata: {
43 name: namespace,
44 },
45 };
46
47 this.#k8sApi = this.#createK8sApi();
48 }
49
50 async index(opts: TaskOperationsIndexOptions) {
51 await this.#createJob(
52 {
53 metadata: {
54 name: this.#getIndexContainerName(opts.shortCode),
55 namespace: this.#namespace.metadata.name,
56 },
57 spec: {
58 completions: 1,
59 backoffLimit: 0,
60 ttlSecondsAfterFinished: 300,
61 template: {
62 metadata: {
63 labels: {
64 ...this.#getSharedLabels(opts),
65 app: "task-index",
66 "app.kubernetes.io/part-of": "trigger-worker",
67 "app.kubernetes.io/component": "index",
68 deployment: opts.deploymentId,
69 },
70 },
71 spec: {
72 ...this.#defaultPodSpec,
73 containers: [
74 {
75 name: this.#getIndexContainerName(opts.shortCode),
76 image: opts.imageRef,
77 ports: [
78 {
79 containerPort: 8000,
80 },
81 ],
82 resources: {
83 limits: {
84 cpu: "1",
85 memory: "1G",
86 "ephemeral-storage": "2Gi",
87 },
88 },
89 lifecycle: {
90 preStop: {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…