@oneuptime/common 14.0.100 → 14.0.101
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/Models/AnalyticsModels/NetworkTrafficUsage.js +30 -10
- package/Models/DatabaseModels/KubernetesResource.d.mts +1 -0
- package/Models/DatabaseModels/KubernetesResource.d.ts +1 -0
- package/Models/DatabaseModels/KubernetesResource.js +36 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.d.mts +3 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.d.ts +3 -0
- package/Types/AutoRemediation/AiRemediationCommandPlan.js +11 -2
- package/Types/AutoRemediation/RemediationTrackRecord.d.mts +26 -0
- package/Types/AutoRemediation/RemediationTrackRecord.d.ts +26 -0
- package/Types/AutoRemediation/RemediationTrackRecord.js +137 -0
- package/Types/AutoRemediation/RemediationTrackRecord.mjs +8 -0
- package/Types/AutoRemediation/RemediationTrackRecordWords.d.mts +10 -0
- package/Types/AutoRemediation/RemediationTrackRecordWords.d.ts +10 -0
- package/Types/AutoRemediation/RemediationTrackRecordWords.js +86 -0
- package/Types/AutoRemediation/RemediationTrackRecordWords.mjs +9 -0
- package/Types/Kubernetes/KubernetesHealth.d.mts +92 -0
- package/Types/Kubernetes/KubernetesHealth.d.ts +92 -0
- package/Types/Kubernetes/KubernetesHealth.js +1273 -0
- package/Types/Kubernetes/KubernetesHealth.mjs +32 -0
- package/Types/Kubernetes/KubernetesInventoryExtractor.d.mts +2 -0
- package/Types/Kubernetes/KubernetesInventoryExtractor.d.ts +2 -0
- package/Types/Kubernetes/KubernetesInventoryExtractor.js +7 -0
- package/Types/Kubernetes/KubernetesObjectParser.d.mts +30 -0
- package/Types/Kubernetes/KubernetesObjectParser.d.ts +30 -0
- package/Types/Kubernetes/KubernetesObjectParser.js +164 -38
- package/Types/Kubernetes/KubernetesObjectParser.mjs +3 -0
- package/Types/Monitor/KubernetesAlertTemplates.js +238 -0
- package/Types/Monitor/KubernetesMetricCatalog.js +57 -0
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.d.mts +1 -0
- package/Types/Monitor/MetricMonitor/MetricMonitorResponse.d.ts +1 -0
- package/Types/NetFlow/NetworkTrafficUsage.d.mts +40 -1
- package/Types/NetFlow/NetworkTrafficUsage.d.ts +40 -1
- package/Types/NetFlow/NetworkTrafficUsage.js +58 -6
- package/Types/NetFlow/NetworkTrafficUsage.mjs +1 -0
- package/Utils/AI/InvestigationReport.d.mts +9 -0
- package/Utils/AI/InvestigationReport.d.ts +9 -0
- package/Utils/AI/InvestigationReport.js +122 -10
- package/Utils/AI/InvestigationReport.mjs +3 -0
- package/Utils/AiRemediation/CloudChangeWords.d.mts +32 -0
- package/Utils/AiRemediation/CloudChangeWords.d.ts +32 -0
- package/Utils/AiRemediation/CloudChangeWords.js +242 -0
- package/Utils/AiRemediation/CloudChangeWords.mjs +8 -0
- package/Utils/AiRemediation/RemediationChangeKey.d.mts +2 -0
- package/Utils/AiRemediation/RemediationChangeKey.d.ts +2 -0
- package/Utils/AiRemediation/RemediationChangeKey.js +132 -0
- package/Utils/AiRemediation/RemediationChangeKey.mjs +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import commonJsModule from "./KubernetesHealth.js";
|
|
2
|
+
export const KUBERNETES_ATTENTION_KIND_ORDER = commonJsModule.KUBERNETES_ATTENTION_KIND_ORDER;
|
|
3
|
+
export const KUBERNETES_FAILING_WAIT_REASONS = commonJsModule.KUBERNETES_FAILING_WAIT_REASONS;
|
|
4
|
+
export const KUBERNETES_HEALTH_GRACE_MS = commonJsModule.KUBERNETES_HEALTH_GRACE_MS;
|
|
5
|
+
export const KUBERNETES_HEALTH_RECENT_MS = commonJsModule.KUBERNETES_HEALTH_RECENT_MS;
|
|
6
|
+
export const KUBERNETES_REASON_AS_WRITTEN = commonJsModule.KUBERNETES_REASON_AS_WRITTEN;
|
|
7
|
+
export const KubernetesHealthSeverity = commonJsModule.KubernetesHealthSeverity;
|
|
8
|
+
export const assessKubernetesAutoscaler = commonJsModule.assessKubernetesAutoscaler;
|
|
9
|
+
export const assessKubernetesCronJob = commonJsModule.assessKubernetesCronJob;
|
|
10
|
+
export const assessKubernetesCronJobWithRuns = commonJsModule.assessKubernetesCronJobWithRuns;
|
|
11
|
+
export const assessKubernetesDaemonSet = commonJsModule.assessKubernetesDaemonSet;
|
|
12
|
+
export const assessKubernetesDeployment = commonJsModule.assessKubernetesDeployment;
|
|
13
|
+
export const assessKubernetesDeploymentConfig = commonJsModule.assessKubernetesDeploymentConfig;
|
|
14
|
+
export const assessKubernetesJob = commonJsModule.assessKubernetesJob;
|
|
15
|
+
export const assessKubernetesNamespace = commonJsModule.assessKubernetesNamespace;
|
|
16
|
+
export const assessKubernetesNode = commonJsModule.assessKubernetesNode;
|
|
17
|
+
export const assessKubernetesPod = commonJsModule.assessKubernetesPod;
|
|
18
|
+
export const assessKubernetesResource = commonJsModule.assessKubernetesResource;
|
|
19
|
+
export const assessKubernetesStatefulSet = commonJsModule.assessKubernetesStatefulSet;
|
|
20
|
+
export const assessKubernetesVolume = commonJsModule.assessKubernetesVolume;
|
|
21
|
+
export const assessKubernetesVolumeClaim = commonJsModule.assessKubernetesVolumeClaim;
|
|
22
|
+
export const getDeploymentConfigNameFromReplicationController = commonJsModule.getDeploymentConfigNameFromReplicationController;
|
|
23
|
+
export const getDeploymentNameFromReplicaSet = commonJsModule.getDeploymentNameFromReplicaSet;
|
|
24
|
+
export const getKubernetesAttentionFindings = commonJsModule.getKubernetesAttentionFindings;
|
|
25
|
+
export const getKubernetesClusterHealth = commonJsModule.getKubernetesClusterHealth;
|
|
26
|
+
export const getKubernetesHealthSeverity = commonJsModule.getKubernetesHealthSeverity;
|
|
27
|
+
export const getKubernetesJobCronJob = commonJsModule.getKubernetesJobCronJob;
|
|
28
|
+
export const getKubernetesOwners = commonJsModule.getKubernetesOwners;
|
|
29
|
+
export const getKubernetesPodWorkload = commonJsModule.getKubernetesPodWorkload;
|
|
30
|
+
export const getNewestKubernetesJobs = commonJsModule.getNewestKubernetesJobs;
|
|
31
|
+
export const kubernetesObjectKey = commonJsModule.kubernetesObjectKey;
|
|
32
|
+
export const sortKubernetesAttentionFindings = commonJsModule.sortKubernetesAttentionFindings;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSONObject } from "../JSON.mjs";
|
|
2
2
|
import { KubernetesPodObject } from "./KubernetesObjectParser.mjs";
|
|
3
|
+
import { KubernetesHealthSeverity } from "./KubernetesHealth.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* Row-shaped payload for KubernetesContainer upserts. One row per
|
|
5
6
|
* container inside a Pod's spec.
|
|
@@ -38,6 +39,7 @@ export interface ParsedKubernetesResource {
|
|
|
38
39
|
status: JSONObject | null;
|
|
39
40
|
lastSeenAt: Date;
|
|
40
41
|
resourceCreationTimestamp: Date | null;
|
|
42
|
+
healthSeverity?: KubernetesHealthSeverity | null | undefined;
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* k8s.resource.name (plural, lowercase from the k8sobjects receiver)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSONObject } from "../JSON";
|
|
2
2
|
import { KubernetesPodObject } from "./KubernetesObjectParser";
|
|
3
|
+
import { KubernetesHealthSeverity } from "./KubernetesHealth";
|
|
3
4
|
/**
|
|
4
5
|
* Row-shaped payload for KubernetesContainer upserts. One row per
|
|
5
6
|
* container inside a Pod's spec.
|
|
@@ -38,6 +39,7 @@ export interface ParsedKubernetesResource {
|
|
|
38
39
|
status: JSONObject | null;
|
|
39
40
|
lastSeenAt: Date;
|
|
40
41
|
resourceCreationTimestamp: Date | null;
|
|
42
|
+
healthSeverity?: KubernetesHealthSeverity | null | undefined;
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* k8s.resource.name (plural, lowercase from the k8sobjects receiver)
|
|
@@ -6,6 +6,7 @@ exports.extractContainersFromPod = extractContainersFromPod;
|
|
|
6
6
|
exports.extractInventoryResource = extractInventoryResource;
|
|
7
7
|
const KubernetesObjectParser_1 = require("./KubernetesObjectParser");
|
|
8
8
|
const OpenShiftObjectParser_1 = require("./OpenShiftObjectParser");
|
|
9
|
+
const KubernetesHealth_1 = require("./KubernetesHealth");
|
|
9
10
|
/**
|
|
10
11
|
* k8s.resource.name (plural, lowercase from the k8sobjects receiver)
|
|
11
12
|
* → Kubernetes Kind (singular, PascalCase, used throughout the UI).
|
|
@@ -324,7 +325,13 @@ function extractInventoryResource(data) {
|
|
|
324
325
|
status: anyParsed.status || null,
|
|
325
326
|
lastSeenAt: data.lastSeenAt,
|
|
326
327
|
resourceCreationTimestamp: parseCreationTimestamp(metadata.creationTimestamp),
|
|
328
|
+
healthSeverity: null,
|
|
327
329
|
};
|
|
330
|
+
/*
|
|
331
|
+
* The verdict at the time the agent saw it - the same rules, and the
|
|
332
|
+
* same time, a page reading this row uses.
|
|
333
|
+
*/
|
|
334
|
+
resource.healthSeverity = (0, KubernetesHealth_1.getKubernetesHealthSeverity)(resource);
|
|
328
335
|
let containers = [];
|
|
329
336
|
if (kind === "Pod") {
|
|
330
337
|
containers = extractContainersFromPod({
|
|
@@ -20,6 +20,7 @@ export declare function getKvListAsRecord(kvList: JSONObject | undefined): Recor
|
|
|
20
20
|
* Convert an OTLP arrayValue to an array of JSONObjects (kvlistValues).
|
|
21
21
|
*/
|
|
22
22
|
export declare function getArrayValues(arrayValue: JSONObject | undefined): Array<JSONObject>;
|
|
23
|
+
export declare function countArrayValues(value: string | JSONObject | null): number;
|
|
23
24
|
/**
|
|
24
25
|
* Convert an OTLP kvlistValue (nested key-value structure) to a plain
|
|
25
26
|
* JavaScript object. This preserves the full original K8s manifest structure.
|
|
@@ -78,7 +79,15 @@ export interface KubernetesContainerStatus {
|
|
|
78
79
|
state: string;
|
|
79
80
|
reason: string;
|
|
80
81
|
image: string;
|
|
82
|
+
message?: string | undefined;
|
|
83
|
+
exitCode?: number | null | undefined;
|
|
84
|
+
startedAt?: string | undefined;
|
|
85
|
+
lastTerminationReason?: string | undefined;
|
|
86
|
+
lastTerminationExitCode?: number | null | undefined;
|
|
87
|
+
lastTerminatedAt?: string | undefined;
|
|
81
88
|
}
|
|
89
|
+
export declare const KUBERNETES_STATUS_MESSAGE_MAX_LENGTH: number;
|
|
90
|
+
export declare function shortenKubernetesMessage(message: string): string;
|
|
82
91
|
export interface KubernetesPodObject {
|
|
83
92
|
metadata: KubernetesObjectMetadata;
|
|
84
93
|
spec: {
|
|
@@ -107,10 +116,22 @@ export interface KubernetesPodObject {
|
|
|
107
116
|
conditions: Array<KubernetesCondition>;
|
|
108
117
|
containerStatuses: Array<KubernetesContainerStatus>;
|
|
109
118
|
initContainerStatuses: Array<KubernetesContainerStatus>;
|
|
119
|
+
reason?: string | undefined;
|
|
120
|
+
message?: string | undefined;
|
|
121
|
+
startTime?: string | undefined;
|
|
110
122
|
};
|
|
111
123
|
}
|
|
124
|
+
export interface KubernetesNodeTaint {
|
|
125
|
+
key: string;
|
|
126
|
+
value: string;
|
|
127
|
+
effect: string;
|
|
128
|
+
}
|
|
112
129
|
export interface KubernetesNodeObject {
|
|
113
130
|
metadata: KubernetesObjectMetadata;
|
|
131
|
+
spec?: {
|
|
132
|
+
unschedulable: boolean;
|
|
133
|
+
taints: Array<KubernetesNodeTaint>;
|
|
134
|
+
} | undefined;
|
|
114
135
|
status: {
|
|
115
136
|
conditions: Array<KubernetesCondition>;
|
|
116
137
|
nodeInfo: {
|
|
@@ -135,6 +156,7 @@ export interface KubernetesDeploymentObject {
|
|
|
135
156
|
replicas: number;
|
|
136
157
|
strategy: string;
|
|
137
158
|
selector: Record<string, string>;
|
|
159
|
+
paused?: boolean | undefined;
|
|
138
160
|
};
|
|
139
161
|
status: {
|
|
140
162
|
replicas: number;
|
|
@@ -142,6 +164,7 @@ export interface KubernetesDeploymentObject {
|
|
|
142
164
|
availableReplicas: number;
|
|
143
165
|
unavailableReplicas: number;
|
|
144
166
|
conditions: Array<KubernetesCondition>;
|
|
167
|
+
updatedReplicas?: number | undefined;
|
|
145
168
|
};
|
|
146
169
|
}
|
|
147
170
|
export interface KubernetesStatefulSetObject {
|
|
@@ -156,6 +179,10 @@ export interface KubernetesStatefulSetObject {
|
|
|
156
179
|
replicas: number;
|
|
157
180
|
readyReplicas: number;
|
|
158
181
|
currentReplicas: number;
|
|
182
|
+
updatedReplicas?: number | undefined;
|
|
183
|
+
availableReplicas?: number | undefined;
|
|
184
|
+
currentRevision?: string | undefined;
|
|
185
|
+
updateRevision?: string | undefined;
|
|
159
186
|
};
|
|
160
187
|
}
|
|
161
188
|
export interface KubernetesDaemonSetObject {
|
|
@@ -169,6 +196,8 @@ export interface KubernetesDaemonSetObject {
|
|
|
169
196
|
numberReady: number;
|
|
170
197
|
numberMisscheduled: number;
|
|
171
198
|
numberAvailable: number;
|
|
199
|
+
updatedNumberScheduled?: number | undefined;
|
|
200
|
+
numberUnavailable?: number | undefined;
|
|
172
201
|
};
|
|
173
202
|
}
|
|
174
203
|
export interface KubernetesJobObject {
|
|
@@ -199,6 +228,7 @@ export interface KubernetesCronJobObject {
|
|
|
199
228
|
status: {
|
|
200
229
|
lastScheduleTime: string;
|
|
201
230
|
activeCount: number;
|
|
231
|
+
lastSuccessfulTime?: string | undefined;
|
|
202
232
|
};
|
|
203
233
|
}
|
|
204
234
|
export interface KubernetesNamespaceObject {
|
|
@@ -20,6 +20,7 @@ export declare function getKvListAsRecord(kvList: JSONObject | undefined): Recor
|
|
|
20
20
|
* Convert an OTLP arrayValue to an array of JSONObjects (kvlistValues).
|
|
21
21
|
*/
|
|
22
22
|
export declare function getArrayValues(arrayValue: JSONObject | undefined): Array<JSONObject>;
|
|
23
|
+
export declare function countArrayValues(value: string | JSONObject | null): number;
|
|
23
24
|
/**
|
|
24
25
|
* Convert an OTLP kvlistValue (nested key-value structure) to a plain
|
|
25
26
|
* JavaScript object. This preserves the full original K8s manifest structure.
|
|
@@ -78,7 +79,15 @@ export interface KubernetesContainerStatus {
|
|
|
78
79
|
state: string;
|
|
79
80
|
reason: string;
|
|
80
81
|
image: string;
|
|
82
|
+
message?: string | undefined;
|
|
83
|
+
exitCode?: number | null | undefined;
|
|
84
|
+
startedAt?: string | undefined;
|
|
85
|
+
lastTerminationReason?: string | undefined;
|
|
86
|
+
lastTerminationExitCode?: number | null | undefined;
|
|
87
|
+
lastTerminatedAt?: string | undefined;
|
|
81
88
|
}
|
|
89
|
+
export declare const KUBERNETES_STATUS_MESSAGE_MAX_LENGTH: number;
|
|
90
|
+
export declare function shortenKubernetesMessage(message: string): string;
|
|
82
91
|
export interface KubernetesPodObject {
|
|
83
92
|
metadata: KubernetesObjectMetadata;
|
|
84
93
|
spec: {
|
|
@@ -107,10 +116,22 @@ export interface KubernetesPodObject {
|
|
|
107
116
|
conditions: Array<KubernetesCondition>;
|
|
108
117
|
containerStatuses: Array<KubernetesContainerStatus>;
|
|
109
118
|
initContainerStatuses: Array<KubernetesContainerStatus>;
|
|
119
|
+
reason?: string | undefined;
|
|
120
|
+
message?: string | undefined;
|
|
121
|
+
startTime?: string | undefined;
|
|
110
122
|
};
|
|
111
123
|
}
|
|
124
|
+
export interface KubernetesNodeTaint {
|
|
125
|
+
key: string;
|
|
126
|
+
value: string;
|
|
127
|
+
effect: string;
|
|
128
|
+
}
|
|
112
129
|
export interface KubernetesNodeObject {
|
|
113
130
|
metadata: KubernetesObjectMetadata;
|
|
131
|
+
spec?: {
|
|
132
|
+
unschedulable: boolean;
|
|
133
|
+
taints: Array<KubernetesNodeTaint>;
|
|
134
|
+
} | undefined;
|
|
114
135
|
status: {
|
|
115
136
|
conditions: Array<KubernetesCondition>;
|
|
116
137
|
nodeInfo: {
|
|
@@ -135,6 +156,7 @@ export interface KubernetesDeploymentObject {
|
|
|
135
156
|
replicas: number;
|
|
136
157
|
strategy: string;
|
|
137
158
|
selector: Record<string, string>;
|
|
159
|
+
paused?: boolean | undefined;
|
|
138
160
|
};
|
|
139
161
|
status: {
|
|
140
162
|
replicas: number;
|
|
@@ -142,6 +164,7 @@ export interface KubernetesDeploymentObject {
|
|
|
142
164
|
availableReplicas: number;
|
|
143
165
|
unavailableReplicas: number;
|
|
144
166
|
conditions: Array<KubernetesCondition>;
|
|
167
|
+
updatedReplicas?: number | undefined;
|
|
145
168
|
};
|
|
146
169
|
}
|
|
147
170
|
export interface KubernetesStatefulSetObject {
|
|
@@ -156,6 +179,10 @@ export interface KubernetesStatefulSetObject {
|
|
|
156
179
|
replicas: number;
|
|
157
180
|
readyReplicas: number;
|
|
158
181
|
currentReplicas: number;
|
|
182
|
+
updatedReplicas?: number | undefined;
|
|
183
|
+
availableReplicas?: number | undefined;
|
|
184
|
+
currentRevision?: string | undefined;
|
|
185
|
+
updateRevision?: string | undefined;
|
|
159
186
|
};
|
|
160
187
|
}
|
|
161
188
|
export interface KubernetesDaemonSetObject {
|
|
@@ -169,6 +196,8 @@ export interface KubernetesDaemonSetObject {
|
|
|
169
196
|
numberReady: number;
|
|
170
197
|
numberMisscheduled: number;
|
|
171
198
|
numberAvailable: number;
|
|
199
|
+
updatedNumberScheduled?: number | undefined;
|
|
200
|
+
numberUnavailable?: number | undefined;
|
|
172
201
|
};
|
|
173
202
|
}
|
|
174
203
|
export interface KubernetesJobObject {
|
|
@@ -199,6 +228,7 @@ export interface KubernetesCronJobObject {
|
|
|
199
228
|
status: {
|
|
200
229
|
lastScheduleTime: string;
|
|
201
230
|
activeCount: number;
|
|
231
|
+
lastSuccessfulTime?: string | undefined;
|
|
202
232
|
};
|
|
203
233
|
}
|
|
204
234
|
export interface KubernetesNamespaceObject {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KUBERNETES_STATUS_MESSAGE_MAX_LENGTH = void 0;
|
|
3
4
|
exports.getKvValue = getKvValue;
|
|
4
5
|
exports.getKvStringValue = getKvStringValue;
|
|
5
6
|
exports.getNestedKvValue = getNestedKvValue;
|
|
6
7
|
exports.getKvListAsRecord = getKvListAsRecord;
|
|
7
8
|
exports.getArrayValues = getArrayValues;
|
|
9
|
+
exports.countArrayValues = countArrayValues;
|
|
8
10
|
exports.kvListToPlainObject = kvListToPlainObject;
|
|
11
|
+
exports.shortenKubernetesMessage = shortenKubernetesMessage;
|
|
9
12
|
exports.parseMetadata = parseMetadata;
|
|
10
13
|
exports.parseConditions = parseConditions;
|
|
11
14
|
exports.parsePodObject = parsePodObject;
|
|
@@ -168,6 +171,14 @@ function getArrayValues(arrayValue) {
|
|
|
168
171
|
})
|
|
169
172
|
.filter(Boolean);
|
|
170
173
|
}
|
|
174
|
+
// How many items an OTLP arrayValue holds, whatever their type; 0 for none.
|
|
175
|
+
function countArrayValues(value) {
|
|
176
|
+
if (!value || typeof value === "string") {
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
const values = value["values"];
|
|
180
|
+
return Array.isArray(values) ? values.length : 0;
|
|
181
|
+
}
|
|
171
182
|
/**
|
|
172
183
|
* Recursively convert an OTLP value wrapper to a plain JavaScript value.
|
|
173
184
|
* Handles stringValue, intValue, boolValue, kvlistValue, and arrayValue.
|
|
@@ -247,6 +258,19 @@ function kvListToPlainObject(kvList) {
|
|
|
247
258
|
}
|
|
248
259
|
return result;
|
|
249
260
|
}
|
|
261
|
+
/*
|
|
262
|
+
* The longest message from the kubelet or the scheduler an object keeps: a
|
|
263
|
+
* pull error can run to kilobytes of registry response, and the pages show
|
|
264
|
+
* two lines of it.
|
|
265
|
+
*/
|
|
266
|
+
exports.KUBERNETES_STATUS_MESSAGE_MAX_LENGTH = 1024;
|
|
267
|
+
function shortenKubernetesMessage(message) {
|
|
268
|
+
const trimmed = message.trim();
|
|
269
|
+
if (trimmed.length <= exports.KUBERNETES_STATUS_MESSAGE_MAX_LENGTH) {
|
|
270
|
+
return trimmed;
|
|
271
|
+
}
|
|
272
|
+
return `${trimmed.substring(0, exports.KUBERNETES_STATUS_MESSAGE_MAX_LENGTH - 1)}…`;
|
|
273
|
+
}
|
|
250
274
|
/*
|
|
251
275
|
* ============================================================
|
|
252
276
|
* Parsers
|
|
@@ -417,6 +441,37 @@ function parseConditions(conditionsArrayValue) {
|
|
|
417
441
|
};
|
|
418
442
|
});
|
|
419
443
|
}
|
|
444
|
+
function parseContainerState(stateKv) {
|
|
445
|
+
if (!stateKv || typeof stateKv === "string") {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
const stateValues = stateKv["values"];
|
|
449
|
+
if (!stateValues || stateValues.length === 0 || !stateValues[0]) {
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
const state = stateValues[0]["key"] || "";
|
|
453
|
+
if (!state) {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
const stateDetail = stateValues[0]["value"];
|
|
457
|
+
const detail = stateDetail
|
|
458
|
+
? (stateDetail["kvlistValue"] || stateDetail["kvlist_value"])
|
|
459
|
+
: undefined;
|
|
460
|
+
const exitCodeText = detail
|
|
461
|
+
? getKvStringValue(detail, "exitCode")
|
|
462
|
+
: "";
|
|
463
|
+
const exitCode = parseInt(exitCodeText);
|
|
464
|
+
return {
|
|
465
|
+
state: state,
|
|
466
|
+
reason: detail ? getKvStringValue(detail, "reason") : "",
|
|
467
|
+
message: detail
|
|
468
|
+
? shortenKubernetesMessage(getKvStringValue(detail, "message"))
|
|
469
|
+
: "",
|
|
470
|
+
exitCode: exitCodeText && Number.isFinite(exitCode) ? exitCode : null,
|
|
471
|
+
startedAt: detail ? getKvStringValue(detail, "startedAt") : "",
|
|
472
|
+
finishedAt: detail ? getKvStringValue(detail, "finishedAt") : "",
|
|
473
|
+
};
|
|
474
|
+
}
|
|
420
475
|
function parseContainerStatuses(statusesArrayValue) {
|
|
421
476
|
if (!statusesArrayValue) {
|
|
422
477
|
return [];
|
|
@@ -424,28 +479,38 @@ function parseContainerStatuses(statusesArrayValue) {
|
|
|
424
479
|
const items = getArrayValues(statusesArrayValue);
|
|
425
480
|
return items.map((kvList) => {
|
|
426
481
|
// state is a kvlist with one key (running/waiting/terminated)
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
const stateDetail = stateValues[0]["value"];
|
|
436
|
-
if (stateDetail && stateDetail["kvlistValue"]) {
|
|
437
|
-
reason = getKvStringValue(stateDetail["kvlistValue"], "reason");
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
return {
|
|
482
|
+
const current = parseContainerState(getKvValue(kvList, "state"));
|
|
483
|
+
/*
|
|
484
|
+
* How the previous run ended. Only a terminated last state says
|
|
485
|
+
* anything: the kubelet keeps it until the container ends again.
|
|
486
|
+
*/
|
|
487
|
+
const last = parseContainerState(getKvValue(kvList, "lastState"));
|
|
488
|
+
const lastTerminated = last && last.state === "terminated" ? last : null;
|
|
489
|
+
const status = {
|
|
442
490
|
name: getKvStringValue(kvList, "name"),
|
|
443
491
|
ready: getKvStringValue(kvList, "ready") === "true",
|
|
444
492
|
restartCount: parseInt(getKvStringValue(kvList, "restartCount")) || 0,
|
|
445
|
-
state,
|
|
446
|
-
reason,
|
|
493
|
+
state: (current === null || current === void 0 ? void 0 : current.state) || "Unknown",
|
|
494
|
+
reason: (current === null || current === void 0 ? void 0 : current.reason) || "",
|
|
447
495
|
image: getKvStringValue(kvList, "image"),
|
|
448
496
|
};
|
|
497
|
+
if (current === null || current === void 0 ? void 0 : current.message) {
|
|
498
|
+
status.message = current.message;
|
|
499
|
+
}
|
|
500
|
+
if (current &&
|
|
501
|
+
current.state === "terminated" &&
|
|
502
|
+
current.exitCode !== null) {
|
|
503
|
+
status.exitCode = current.exitCode;
|
|
504
|
+
}
|
|
505
|
+
if (current === null || current === void 0 ? void 0 : current.startedAt) {
|
|
506
|
+
status.startedAt = current.startedAt;
|
|
507
|
+
}
|
|
508
|
+
if (lastTerminated) {
|
|
509
|
+
status.lastTerminationReason = lastTerminated.reason;
|
|
510
|
+
status.lastTerminationExitCode = lastTerminated.exitCode;
|
|
511
|
+
status.lastTerminatedAt = lastTerminated.finishedAt;
|
|
512
|
+
}
|
|
513
|
+
return status;
|
|
449
514
|
});
|
|
450
515
|
}
|
|
451
516
|
/**
|
|
@@ -543,6 +608,9 @@ function parsePodObject(objectKvList) {
|
|
|
543
608
|
let podIP = "";
|
|
544
609
|
let hostIP = "";
|
|
545
610
|
let qosClass = "";
|
|
611
|
+
let podReason = "";
|
|
612
|
+
let podMessage = "";
|
|
613
|
+
let startTime = "";
|
|
546
614
|
let conditions = [];
|
|
547
615
|
let containerStatuses = [];
|
|
548
616
|
let initContainerStatuses = [];
|
|
@@ -551,6 +619,9 @@ function parsePodObject(objectKvList) {
|
|
|
551
619
|
podIP = getKvStringValue(statusKv, "podIP");
|
|
552
620
|
hostIP = getKvStringValue(statusKv, "hostIP");
|
|
553
621
|
qosClass = getKvStringValue(statusKv, "qosClass");
|
|
622
|
+
podReason = getKvStringValue(statusKv, "reason");
|
|
623
|
+
podMessage = shortenKubernetesMessage(getKvStringValue(statusKv, "message"));
|
|
624
|
+
startTime = getKvStringValue(statusKv, "startTime");
|
|
554
625
|
const condArray = getKvValue(statusKv, "conditions");
|
|
555
626
|
conditions = parseConditions(condArray);
|
|
556
627
|
const csArray = getKvValue(statusKv, "containerStatuses");
|
|
@@ -558,6 +629,25 @@ function parsePodObject(objectKvList) {
|
|
|
558
629
|
const icsArray = getKvValue(statusKv, "initContainerStatuses");
|
|
559
630
|
initContainerStatuses = parseContainerStatuses(icsArray);
|
|
560
631
|
}
|
|
632
|
+
const podStatus = {
|
|
633
|
+
phase,
|
|
634
|
+
podIP,
|
|
635
|
+
hostIP,
|
|
636
|
+
qosClass,
|
|
637
|
+
conditions,
|
|
638
|
+
containerStatuses,
|
|
639
|
+
initContainerStatuses,
|
|
640
|
+
};
|
|
641
|
+
// Only when Kubernetes said them, so a stored pod keeps its old shape.
|
|
642
|
+
if (podReason) {
|
|
643
|
+
podStatus.reason = podReason;
|
|
644
|
+
}
|
|
645
|
+
if (podMessage) {
|
|
646
|
+
podStatus.message = podMessage;
|
|
647
|
+
}
|
|
648
|
+
if (startTime) {
|
|
649
|
+
podStatus.startTime = startTime;
|
|
650
|
+
}
|
|
561
651
|
return {
|
|
562
652
|
metadata,
|
|
563
653
|
spec: {
|
|
@@ -573,15 +663,7 @@ function parsePodObject(objectKvList) {
|
|
|
573
663
|
tolerations,
|
|
574
664
|
volumes,
|
|
575
665
|
},
|
|
576
|
-
status:
|
|
577
|
-
phase,
|
|
578
|
-
podIP,
|
|
579
|
-
hostIP,
|
|
580
|
-
qosClass,
|
|
581
|
-
conditions,
|
|
582
|
-
containerStatuses,
|
|
583
|
-
initContainerStatuses,
|
|
584
|
-
},
|
|
666
|
+
status: podStatus,
|
|
585
667
|
};
|
|
586
668
|
}
|
|
587
669
|
catch (_a) {
|
|
@@ -595,6 +677,7 @@ function parseNodeObject(objectKvList) {
|
|
|
595
677
|
return null;
|
|
596
678
|
}
|
|
597
679
|
const statusKv = getKvValue(objectKvList, "status");
|
|
680
|
+
const specKv = getKvValue(objectKvList, "spec");
|
|
598
681
|
let conditions = [];
|
|
599
682
|
let nodeInfo = {
|
|
600
683
|
osImage: "",
|
|
@@ -640,7 +723,7 @@ function parseNodeObject(objectKvList) {
|
|
|
640
723
|
});
|
|
641
724
|
}
|
|
642
725
|
}
|
|
643
|
-
|
|
726
|
+
const node = {
|
|
644
727
|
metadata: parseMetadata(metadataKv),
|
|
645
728
|
status: {
|
|
646
729
|
conditions,
|
|
@@ -650,6 +733,22 @@ function parseNodeObject(objectKvList) {
|
|
|
650
733
|
addresses,
|
|
651
734
|
},
|
|
652
735
|
};
|
|
736
|
+
if (specKv && typeof specKv !== "string") {
|
|
737
|
+
const taintsArray = getKvValue(specKv, "taints");
|
|
738
|
+
node.spec = {
|
|
739
|
+
unschedulable: getKvStringValue(specKv, "unschedulable") === "true",
|
|
740
|
+
taints: taintsArray && typeof taintsArray !== "string"
|
|
741
|
+
? getArrayValues(taintsArray).map((taint) => {
|
|
742
|
+
return {
|
|
743
|
+
key: getKvStringValue(taint, "key"),
|
|
744
|
+
value: getKvStringValue(taint, "value"),
|
|
745
|
+
effect: getKvStringValue(taint, "effect"),
|
|
746
|
+
};
|
|
747
|
+
})
|
|
748
|
+
: [],
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
return node;
|
|
653
752
|
}
|
|
654
753
|
catch (_a) {
|
|
655
754
|
return null;
|
|
@@ -666,8 +765,10 @@ function parseDeploymentObject(objectKvList) {
|
|
|
666
765
|
let replicas = 0;
|
|
667
766
|
let strategy = "";
|
|
668
767
|
let selector = {};
|
|
768
|
+
let paused = false;
|
|
669
769
|
if (specKv && typeof specKv !== "string") {
|
|
670
770
|
replicas = parseInt(getKvStringValue(specKv, "replicas")) || 0;
|
|
771
|
+
paused = getKvStringValue(specKv, "paused") === "true";
|
|
671
772
|
const strategyKv = getKvValue(specKv, "strategy");
|
|
672
773
|
if (strategyKv && typeof strategyKv !== "string") {
|
|
673
774
|
strategy = getKvStringValue(strategyKv, "type");
|
|
@@ -684,6 +785,7 @@ function parseDeploymentObject(objectKvList) {
|
|
|
684
785
|
let readyReplicas = 0;
|
|
685
786
|
let availableReplicas = 0;
|
|
686
787
|
let unavailableReplicas = 0;
|
|
788
|
+
let updatedReplicas = 0;
|
|
687
789
|
let conditions = [];
|
|
688
790
|
if (statusKv && typeof statusKv !== "string") {
|
|
689
791
|
statusReplicas = parseInt(getKvStringValue(statusKv, "replicas")) || 0;
|
|
@@ -693,18 +795,21 @@ function parseDeploymentObject(objectKvList) {
|
|
|
693
795
|
parseInt(getKvStringValue(statusKv, "availableReplicas")) || 0;
|
|
694
796
|
unavailableReplicas =
|
|
695
797
|
parseInt(getKvStringValue(statusKv, "unavailableReplicas")) || 0;
|
|
798
|
+
updatedReplicas =
|
|
799
|
+
parseInt(getKvStringValue(statusKv, "updatedReplicas")) || 0;
|
|
696
800
|
const condArray = getKvValue(statusKv, "conditions");
|
|
697
801
|
conditions = parseConditions(condArray);
|
|
698
802
|
}
|
|
699
803
|
return {
|
|
700
804
|
metadata: parseMetadata(metadataKv),
|
|
701
|
-
spec: { replicas, strategy, selector },
|
|
805
|
+
spec: { replicas, strategy, selector, paused },
|
|
702
806
|
status: {
|
|
703
807
|
replicas: statusReplicas,
|
|
704
808
|
readyReplicas,
|
|
705
809
|
availableReplicas,
|
|
706
810
|
unavailableReplicas,
|
|
707
811
|
conditions,
|
|
812
|
+
updatedReplicas,
|
|
708
813
|
},
|
|
709
814
|
};
|
|
710
815
|
}
|
|
@@ -733,19 +838,25 @@ function parseStatefulSetObject(objectKvList) {
|
|
|
733
838
|
updateStrategy = getKvStringValue(usKv, "type");
|
|
734
839
|
}
|
|
735
840
|
}
|
|
841
|
+
const readStatusNumber = (key) => {
|
|
842
|
+
return statusKv
|
|
843
|
+
? parseInt(getKvStringValue(statusKv, key)) || 0
|
|
844
|
+
: 0;
|
|
845
|
+
};
|
|
846
|
+
const readStatusString = (key) => {
|
|
847
|
+
return statusKv ? getKvStringValue(statusKv, key) : "";
|
|
848
|
+
};
|
|
736
849
|
return {
|
|
737
850
|
metadata: parseMetadata(metadataKv),
|
|
738
851
|
spec: { replicas, serviceName, podManagementPolicy, updateStrategy },
|
|
739
852
|
status: {
|
|
740
|
-
replicas:
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
? parseInt(getKvStringValue(statusKv, "currentReplicas")) || 0
|
|
748
|
-
: 0,
|
|
853
|
+
replicas: readStatusNumber("replicas"),
|
|
854
|
+
readyReplicas: readStatusNumber("readyReplicas"),
|
|
855
|
+
currentReplicas: readStatusNumber("currentReplicas"),
|
|
856
|
+
updatedReplicas: readStatusNumber("updatedReplicas"),
|
|
857
|
+
availableReplicas: readStatusNumber("availableReplicas"),
|
|
858
|
+
currentRevision: readStatusString("currentRevision"),
|
|
859
|
+
updateRevision: readStatusString("updateRevision"),
|
|
749
860
|
},
|
|
750
861
|
};
|
|
751
862
|
}
|
|
@@ -788,6 +899,12 @@ function parseDaemonSetObject(objectKvList) {
|
|
|
788
899
|
numberAvailable: statusKv
|
|
789
900
|
? parseInt(getKvStringValue(statusKv, "numberAvailable")) || 0
|
|
790
901
|
: 0,
|
|
902
|
+
updatedNumberScheduled: statusKv
|
|
903
|
+
? parseInt(getKvStringValue(statusKv, "updatedNumberScheduled")) || 0
|
|
904
|
+
: 0,
|
|
905
|
+
numberUnavailable: statusKv
|
|
906
|
+
? parseInt(getKvStringValue(statusKv, "numberUnavailable")) || 0
|
|
907
|
+
: 0,
|
|
791
908
|
},
|
|
792
909
|
};
|
|
793
910
|
}
|
|
@@ -874,9 +991,18 @@ function parseCronJobObject(objectKvList) {
|
|
|
874
991
|
lastScheduleTime: statusKv
|
|
875
992
|
? getKvStringValue(statusKv, "lastScheduleTime")
|
|
876
993
|
: "",
|
|
994
|
+
/*
|
|
995
|
+
* status.active is the list of the Jobs it runs now (object
|
|
996
|
+
* references), not a number: count them.
|
|
997
|
+
*/
|
|
877
998
|
activeCount: statusKv
|
|
878
|
-
?
|
|
999
|
+
? countArrayValues(getKvValue(statusKv, "active")) ||
|
|
1000
|
+
parseInt(getKvStringValue(statusKv, "active")) ||
|
|
1001
|
+
0
|
|
879
1002
|
: 0,
|
|
1003
|
+
lastSuccessfulTime: statusKv
|
|
1004
|
+
? getKvStringValue(statusKv, "lastSuccessfulTime")
|
|
1005
|
+
: "",
|
|
880
1006
|
},
|
|
881
1007
|
};
|
|
882
1008
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import commonJsModule from "./KubernetesObjectParser.js";
|
|
2
|
+
export const KUBERNETES_STATUS_MESSAGE_MAX_LENGTH = commonJsModule.KUBERNETES_STATUS_MESSAGE_MAX_LENGTH;
|
|
3
|
+
export const countArrayValues = commonJsModule.countArrayValues;
|
|
2
4
|
export const extractObjectFromLogBody = commonJsModule.extractObjectFromLogBody;
|
|
3
5
|
export const getArrayValues = commonJsModule.getArrayValues;
|
|
4
6
|
export const getKvListAsRecord = commonJsModule.getKvListAsRecord;
|
|
@@ -21,3 +23,4 @@ export const parsePodObject = commonJsModule.parsePodObject;
|
|
|
21
23
|
export const parseServiceObject = commonJsModule.parseServiceObject;
|
|
22
24
|
export const parseStatefulSetObject = commonJsModule.parseStatefulSetObject;
|
|
23
25
|
export const parseVPAObject = commonJsModule.parseVPAObject;
|
|
26
|
+
export const shortenKubernetesMessage = commonJsModule.shortenKubernetesMessage;
|