hammerkit 2.0.0 → 2.1.0-next.2
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/build.schema.json +87 -10
- package/dist/docker/item-network.js +6 -5
- package/dist/docker/remove-orphaned-containers.js +5 -4
- package/dist/executer/check-readiness.js +8 -4
- package/dist/executer/docker-healthcheck.js +73 -0
- package/dist/executer/docker-service.js +21 -15
- package/dist/kubernetes/ensure-kubernetes-deployment-exists.js +62 -14
- package/dist/kubernetes/kept-claims.js +12 -9
- package/dist/network/healthcheck-request.js +38 -0
- package/dist/optimizer/work-task-cache-description.js +2 -1
- package/dist/planner/service-definition.js +2 -1
- package/dist/planner/utils/append-work-service.js +12 -4
- package/dist/planner/work-healthcheck.js +23 -2
- package/dist/planner/work-service.js +2 -2
- package/dist/remote/remote-status.js +1 -1
- package/dist/schema/build-file-service-container-healthcheck.js +25 -7
- package/dist/server/borrowed-quota.js +216 -0
- package/dist/server/capacity.js +18 -6
- package/dist/server/kubernetes-backend.js +114 -28
- package/dist/server/runs.js +4 -6
- package/dist/server/server-config.js +59 -2
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectPlatform = exports.getSecretCatalog = exports.readServerConfig = exports.getServerAccounts = exports.getSandboxRuntimes = exports.serverConfigSchema = exports.sourceSchema = exports.entitlementSchema = exports.endpointGrantSchema = exports.endpointLevelSchema = exports.sandboxGrantSchema = exports.sandboxBranchTypeSchema = exports.buildsLevelSchema = exports.accountLevelSchema = exports.getMaxVolumeSize = exports.DEFAULT_MAX_VOLUME_SIZE = exports.DEFAULT_DENIED_EGRESS = exports.kubernetesPoolSchema = exports.accountSchema = exports.issuerSchema = exports.serverPlatformSchema = void 0;
|
|
3
|
+
exports.getMaxQuotaIssues = exports.detectPlatform = exports.getSecretCatalog = exports.readServerConfig = exports.getServerAccounts = exports.getSandboxRuntimes = exports.serverConfigSchema = exports.sourceSchema = exports.entitlementSchema = exports.endpointGrantSchema = exports.endpointLevelSchema = exports.sandboxGrantSchema = exports.sandboxBranchTypeSchema = exports.buildsLevelSchema = exports.accountLevelSchema = exports.getMaxVolumeSize = exports.DEFAULT_MAX_VOLUME_SIZE = exports.DEFAULT_DENIED_EGRESS = exports.kubernetesPoolSchema = exports.accountSchema = exports.issuerSchema = exports.serverPlatformSchema = void 0;
|
|
4
4
|
const run_source_envs_1 = require("../environment/run-source-envs");
|
|
5
5
|
const net_1 = require("net");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
7
|
const yaml_1 = require("yaml");
|
|
8
8
|
const log_1 = require("../log");
|
|
9
9
|
const units_1 = require("../utils/units");
|
|
10
|
+
const borrowed_quota_1 = require("./borrowed-quota");
|
|
10
11
|
const version_1 = require("../version");
|
|
11
12
|
const network_schema_1 = require("../schema/network-schema");
|
|
12
13
|
const capabilities_schema_1 = require("../schema/capabilities-schema");
|
|
@@ -275,8 +276,12 @@ const kubernetesBackendSchema = zod_1.z
|
|
|
275
276
|
})
|
|
276
277
|
.strict())
|
|
277
278
|
.default({}),
|
|
278
|
-
// the ResourceQuota of every caller's namespace, such as `requests.cpu: '8'
|
|
279
|
+
// the ResourceQuota of every caller's namespace, such as `requests.cpu: '8'`: what each
|
|
280
|
+
// caller is promised
|
|
279
281
|
quota: zod_1.z.record(zod_1.z.union([zod_1.z.string().min(1), zod_1.z.number()]).transform(String)).optional(),
|
|
282
|
+
// how far the CPU and memory of a caller's quota rise above `quota` while the nodes of the
|
|
283
|
+
// pools have room no other caller is promised (see BorrowedQuotas); never when left out
|
|
284
|
+
maxQuota: zod_1.z.record(zod_1.z.union([zod_1.z.string().min(1), zod_1.z.number()]).transform(String)).optional(),
|
|
280
285
|
// what a container without `resources` requests (a LimitRange), so it is
|
|
281
286
|
// admitted under a quota that limits compute
|
|
282
287
|
defaultResources: zod_1.z
|
|
@@ -854,6 +859,13 @@ exports.serverConfigSchema = zod_1.z
|
|
|
854
859
|
}
|
|
855
860
|
}
|
|
856
861
|
}
|
|
862
|
+
for (const issue of getMaxQuotaIssues(backend.quota, backend.maxQuota)) {
|
|
863
|
+
ctx.addIssue({
|
|
864
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
865
|
+
path: ['backend', 'maxQuota', ...issue.path],
|
|
866
|
+
message: issue.message,
|
|
867
|
+
});
|
|
868
|
+
}
|
|
857
869
|
if (backend.maxVolumeSize && (0, units_1.parseSize)(backend.volumeSize) > (0, units_1.parseSize)(backend.maxVolumeSize)) {
|
|
858
870
|
ctx.addIssue({
|
|
859
871
|
code: zod_1.z.ZodIssueCode.custom,
|
|
@@ -1071,4 +1083,49 @@ function detectPlatform() {
|
|
|
1071
1083
|
return { os, arch };
|
|
1072
1084
|
}
|
|
1073
1085
|
exports.detectPlatform = detectPlatform;
|
|
1086
|
+
// What is wrong with `backend.maxQuota`: a key a caller may borrow (CPU and memory, see
|
|
1087
|
+
// BORROWED_RESOURCES) that `quota` has too, no less than there, and a limit only with the
|
|
1088
|
+
// requests of its resource, which say how much room the caller takes of the nodes.
|
|
1089
|
+
function getMaxQuotaIssues(quota, maxQuota) {
|
|
1090
|
+
if (!maxQuota) {
|
|
1091
|
+
return [];
|
|
1092
|
+
}
|
|
1093
|
+
if (!quota) {
|
|
1094
|
+
return [{ path: [], message: 'a caller borrows above backend.quota, which is not set' }];
|
|
1095
|
+
}
|
|
1096
|
+
const issues = [];
|
|
1097
|
+
for (const [key, value] of Object.entries(maxQuota)) {
|
|
1098
|
+
const resource = (0, borrowed_quota_1.getBorrowedResource)(key);
|
|
1099
|
+
if (!resource) {
|
|
1100
|
+
issues.push({
|
|
1101
|
+
path: [key],
|
|
1102
|
+
message: `${key} can't be borrowed, only ${Object.values(borrowed_quota_1.BORROWED_RESOURCES)
|
|
1103
|
+
.flatMap((keys) => [...keys.requests, ...keys.limits])
|
|
1104
|
+
.join(', ')}`,
|
|
1105
|
+
});
|
|
1106
|
+
continue;
|
|
1107
|
+
}
|
|
1108
|
+
if (quota[key] === undefined) {
|
|
1109
|
+
issues.push({ path: [key], message: `${key} is not in backend.quota, the share it rises from` });
|
|
1110
|
+
continue;
|
|
1111
|
+
}
|
|
1112
|
+
const max = (0, units_1.parseQuantity)(value);
|
|
1113
|
+
const share = (0, units_1.parseQuantity)(quota[key]);
|
|
1114
|
+
if (max === undefined) {
|
|
1115
|
+
issues.push({ path: [key], message: `expected a quantity such as 8, 500m or 16Gi` });
|
|
1116
|
+
}
|
|
1117
|
+
else if (share !== undefined && max < share) {
|
|
1118
|
+
issues.push({ path: [key], message: `${value} is less than ${quota[key]} of backend.quota` });
|
|
1119
|
+
}
|
|
1120
|
+
const requests = borrowed_quota_1.BORROWED_RESOURCES[resource].requests;
|
|
1121
|
+
if (!requests.includes(key) && !requests.some((other) => maxQuota[other] !== undefined)) {
|
|
1122
|
+
issues.push({
|
|
1123
|
+
path: [key],
|
|
1124
|
+
message: `${key} rises with the requests of ${resource}, add ${requests[0]} to backend.maxQuota`,
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
return issues;
|
|
1129
|
+
}
|
|
1130
|
+
exports.getMaxQuotaIssues = getMaxQuotaIssues;
|
|
1074
1131
|
//# sourceMappingURL=server-config.js.map
|
package/package.json
CHANGED