@norskvideo/ctl-product-template-schema 0.1.81 → 0.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +58 -0
- package/index.js +31 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -115,6 +115,22 @@ export declare const ProductTemplateAcceleratorSchema: z.ZodEnum<{
|
|
|
115
115
|
}>;
|
|
116
116
|
export type ProductTemplateAccelerator = z.infer<typeof ProductTemplateAcceleratorSchema>;
|
|
117
117
|
export declare const ProductTemplateRequirementsSchema: z.ZodObject<{
|
|
118
|
+
vcpus: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
mode: z.ZodEnum<{
|
|
120
|
+
default: "default";
|
|
121
|
+
fixed: "fixed";
|
|
122
|
+
required: "required";
|
|
123
|
+
}>;
|
|
124
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
pinnedCores: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
mode: z.ZodEnum<{
|
|
128
|
+
default: "default";
|
|
129
|
+
fixed: "fixed";
|
|
130
|
+
required: "required";
|
|
131
|
+
}>;
|
|
132
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
}, z.core.$strip>>;
|
|
118
134
|
capacity: z.ZodOptional<z.ZodObject<{
|
|
119
135
|
mode: z.ZodEnum<{
|
|
120
136
|
default: "default";
|
|
@@ -184,6 +200,16 @@ export declare const ProductTemplateRequirementsSchema: z.ZodObject<{
|
|
|
184
200
|
}, z.core.$strip>>;
|
|
185
201
|
}, z.core.$strip>;
|
|
186
202
|
export type ProductTemplateRequirements = z.infer<typeof ProductTemplateRequirementsSchema>;
|
|
203
|
+
/** The vCPU dimension a manifest declares, under its name or its old one. */
|
|
204
|
+
export declare function requirementVcpus(r: ProductTemplateRequirements | undefined): {
|
|
205
|
+
mode: "default" | "fixed" | "required";
|
|
206
|
+
value?: number | undefined;
|
|
207
|
+
} | undefined;
|
|
208
|
+
/** The pinned-cores dimension a manifest declares, under its name or its old one. */
|
|
209
|
+
export declare function requirementPinnedCores(r: ProductTemplateRequirements | undefined): {
|
|
210
|
+
mode: "default" | "fixed" | "required";
|
|
211
|
+
value?: number | undefined;
|
|
212
|
+
} | undefined;
|
|
187
213
|
export declare const PRODUCT_TEMPLATE_MIGRATION_STRATEGIES: readonly ["overlap", "stopThenStart", "handover"];
|
|
188
214
|
export type MigrationStrategy = (typeof PRODUCT_TEMPLATE_MIGRATION_STRATEGIES)[number];
|
|
189
215
|
export declare const DEFAULT_MIGRATION_STRATEGY: MigrationStrategy;
|
|
@@ -302,6 +328,22 @@ export declare const ProductTemplateManifestSchema: z.ZodObject<{
|
|
|
302
328
|
}, z.core.$strip>>;
|
|
303
329
|
}, z.core.$strip>>;
|
|
304
330
|
requirements: z.ZodOptional<z.ZodObject<{
|
|
331
|
+
vcpus: z.ZodOptional<z.ZodObject<{
|
|
332
|
+
mode: z.ZodEnum<{
|
|
333
|
+
default: "default";
|
|
334
|
+
fixed: "fixed";
|
|
335
|
+
required: "required";
|
|
336
|
+
}>;
|
|
337
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
338
|
+
}, z.core.$strip>>;
|
|
339
|
+
pinnedCores: z.ZodOptional<z.ZodObject<{
|
|
340
|
+
mode: z.ZodEnum<{
|
|
341
|
+
default: "default";
|
|
342
|
+
fixed: "fixed";
|
|
343
|
+
required: "required";
|
|
344
|
+
}>;
|
|
345
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
346
|
+
}, z.core.$strip>>;
|
|
305
347
|
capacity: z.ZodOptional<z.ZodObject<{
|
|
306
348
|
mode: z.ZodEnum<{
|
|
307
349
|
default: "default";
|
|
@@ -604,6 +646,22 @@ export declare const ProductTemplateMaterialsSchema: z.ZodObject<{
|
|
|
604
646
|
}, z.core.$strip>>;
|
|
605
647
|
}, z.core.$strip>>;
|
|
606
648
|
requirements: z.ZodOptional<z.ZodObject<{
|
|
649
|
+
vcpus: z.ZodOptional<z.ZodObject<{
|
|
650
|
+
mode: z.ZodEnum<{
|
|
651
|
+
default: "default";
|
|
652
|
+
fixed: "fixed";
|
|
653
|
+
required: "required";
|
|
654
|
+
}>;
|
|
655
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
656
|
+
}, z.core.$strip>>;
|
|
657
|
+
pinnedCores: z.ZodOptional<z.ZodObject<{
|
|
658
|
+
mode: z.ZodEnum<{
|
|
659
|
+
default: "default";
|
|
660
|
+
fixed: "fixed";
|
|
661
|
+
required: "required";
|
|
662
|
+
}>;
|
|
663
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
664
|
+
}, z.core.$strip>>;
|
|
607
665
|
capacity: z.ZodOptional<z.ZodObject<{
|
|
608
666
|
mode: z.ZodEnum<{
|
|
609
667
|
default: "default";
|
package/index.js
CHANGED
|
@@ -408,11 +408,17 @@ const ProductTemplateGpuRequirementSchema = z.object({
|
|
|
408
408
|
export const ProductTemplateAcceleratorSchema = z.enum(["none", "nvidia", "quadra"]);
|
|
409
409
|
export const ProductTemplateRequirementsSchema = z
|
|
410
410
|
.object({
|
|
411
|
+
vcpus: requirementDimension(z.number().positive()).optional().meta({
|
|
412
|
+
description: "vCPUs: the runtime's share of a node's CPU, the primary placement dimension. Every runtime has one; absent, the operator's value or 1.",
|
|
413
|
+
}),
|
|
414
|
+
pinnedCores: requirementDimension(z.number().int().positive()).optional().meta({
|
|
415
|
+
description: "Whole cores pinned to the runtime (cpuset), out of its vCPUs: never more than `vcpus`.",
|
|
416
|
+
}),
|
|
411
417
|
capacity: requirementDimension(z.number().positive()).optional().meta({
|
|
412
|
-
description: "
|
|
418
|
+
description: "Deprecated: the old name for `vcpus`, still read. Give one or the other.",
|
|
413
419
|
}),
|
|
414
420
|
cores: requirementDimension(z.number().int().positive()).optional().meta({
|
|
415
|
-
description: "
|
|
421
|
+
description: "Deprecated: the old name for `pinnedCores`, still read. Give one or the other.",
|
|
416
422
|
}),
|
|
417
423
|
gpu: requirementDimension(ProductTemplateGpuRequirementSchema, (v) => v.capacity !== undefined || v.model !== undefined)
|
|
418
424
|
.optional()
|
|
@@ -440,8 +446,31 @@ export const ProductTemplateRequirementsSchema = z
|
|
|
440
446
|
st2110Nics: z.object({ count: z.number().int().positive() }).optional().meta({
|
|
441
447
|
description: "How many ST 2110 NICs an instance must claim. For a product that cannot know which NICs a host has: the operator picks them at launch (advanced.st2110Nics names a default).",
|
|
442
448
|
}),
|
|
449
|
+
})
|
|
450
|
+
.superRefine((r, ctx) => {
|
|
451
|
+
// The old names are read, but never beside the new: which would win?
|
|
452
|
+
if (r.capacity !== undefined && r.vcpus !== undefined)
|
|
453
|
+
ctx.addIssue({
|
|
454
|
+
code: "custom",
|
|
455
|
+
path: ["capacity"],
|
|
456
|
+
message: "give `vcpus` or its old name `capacity`, not both",
|
|
457
|
+
});
|
|
458
|
+
if (r.cores !== undefined && r.pinnedCores !== undefined)
|
|
459
|
+
ctx.addIssue({
|
|
460
|
+
code: "custom",
|
|
461
|
+
path: ["cores"],
|
|
462
|
+
message: "give `pinnedCores` or its old name `cores`, not both",
|
|
463
|
+
});
|
|
443
464
|
})
|
|
444
465
|
.meta({ id: "ProductTemplateRequirements", outputId: "ProductTemplateRequirements" });
|
|
466
|
+
/** The vCPU dimension a manifest declares, under its name or its old one. */
|
|
467
|
+
export function requirementVcpus(r) {
|
|
468
|
+
return r?.vcpus ?? r?.capacity;
|
|
469
|
+
}
|
|
470
|
+
/** The pinned-cores dimension a manifest declares, under its name or its old one. */
|
|
471
|
+
export function requirementPinnedCores(r) {
|
|
472
|
+
return r?.pinnedCores ?? r?.cores;
|
|
473
|
+
}
|
|
445
474
|
// How a running instance of the product may be moved between nodes
|
|
446
475
|
// (norsk-mgr/docs/internal/design/job-migration.md §6). The manifest
|
|
447
476
|
// declares the strongest promise the product keeps; a migrate request may
|