@neat.is/core 0.9.12 → 0.9.13

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.
@@ -25,7 +25,7 @@ import {
25
25
  startStalenessLoop,
26
26
  touchLastSeen,
27
27
  writeAtomically
28
- } from "./chunk-RBZNXA5L.js";
28
+ } from "./chunk-RL6H3VVD.js";
29
29
  import {
30
30
  assertBindAuthority,
31
31
  buildOtelReceiver,
@@ -212,6 +212,7 @@ var IMAGE_PULL_REASONS = /* @__PURE__ */ new Set(["ImagePullBackOff", "ErrImageP
212
212
  var CRASH_LOOP_REASON = "CrashLoopBackOff";
213
213
  var FIELD_SEP = "\0";
214
214
  var K8S_TARGET_KIND = "k8s-workload";
215
+ var K8S_DEPLOY_STATE = "deploy-state";
215
216
  function packK8sTargetName(identity) {
216
217
  return [identity.serviceName, identity.fault].join(FIELD_SEP);
217
218
  }
@@ -343,11 +344,40 @@ function mapDeploymentToSignal(deployment, pods, config) {
343
344
  }
344
345
  };
345
346
  }
347
+ function observedDeployState(deployment, pods) {
348
+ const readyReplicas = typeof deployment.status?.readyReplicas === "number" ? deployment.status.readyReplicas : 0;
349
+ let image;
350
+ for (const pod of podsForDeployment(deployment, pods)) {
351
+ for (const cs of pod.status?.containerStatuses ?? []) {
352
+ if (cs.state?.running && typeof cs.image === "string" && cs.image.length > 0) {
353
+ image = cs.image;
354
+ break;
355
+ }
356
+ }
357
+ if (image) break;
358
+ }
359
+ return image !== void 0 ? { image, readyReplicas } : { readyReplicas };
360
+ }
361
+ function deployStateSignal(deployment, pods, config) {
362
+ const name = deployment.metadata?.name;
363
+ if (typeof name !== "string" || name.length === 0) return null;
364
+ const serviceName = serviceNameFor(deployment, config);
365
+ return {
366
+ targetKind: K8S_TARGET_KIND,
367
+ targetName: packK8sTargetName({ serviceName, fault: K8S_DEPLOY_STATE }),
368
+ callCount: 0,
369
+ errorCount: 0,
370
+ lastObservedIso: nowIso(),
371
+ deployState: observedDeployState(deployment, pods)
372
+ };
373
+ }
346
374
  function mapWorkloadsToSignals(deployments, pods, config) {
347
375
  const out = [];
348
376
  for (const deployment of deployments) {
349
- const signal = mapDeploymentToSignal(deployment, pods, config);
350
- if (signal) out.push(signal);
377
+ const deployState = deployStateSignal(deployment, pods, config);
378
+ if (deployState) out.push(deployState);
379
+ const incident = mapDeploymentToSignal(deployment, pods, config);
380
+ if (incident) out.push(incident);
351
381
  }
352
382
  return out;
353
383
  }
@@ -1340,6 +1370,7 @@ async function startDaemon(opts = {}) {
1340
1370
  }
1341
1371
 
1342
1372
  export {
1373
+ startK8sSubstratePolling,
1343
1374
  readDaemonRecord,
1344
1375
  resolveNeatVersion,
1345
1376
  writeDaemonRecord,
@@ -1350,4 +1381,4 @@ export {
1350
1381
  resolveHost,
1351
1382
  startDaemon
1352
1383
  };
1353
- //# sourceMappingURL=chunk-WE3AFQYL.js.map
1384
+ //# sourceMappingURL=chunk-BKSM2YLV.js.map