in web/src/app/services/graph-converter.service.ts [62:127]
public getGraphDataAt(timelines: ResourceTimeline[], t: number): GraphData {
const mappedTimeline: MappedTimelineEntry = {};
for (const timeline of timelines) {
mappedTimeline[timeline.resourcePath] = timeline;
}
const nodes = this.getNodes(timelines);
const podNames = this.getPodGraphData(mappedTimeline, t);
this.sortPods(podNames);
const nodeData = nodes
.map((n) => this.getNodeGraphData(mappedTimeline, podNames, n, t))
.filter((a) => a != null) as GraphNode[];
const foundNodeNames = new Set(nodeData.map((n) => n.name));
// Add nodes not observed in node audit logs but observed in pod manifest
for (const key in podNames) {
if (foundNodeNames.has(key)) continue;
nodeData.push({
name: key,
podCIDR: '-',
taints: [],
pods: podNames[key] ?? [],
labels: {},
conditions: [],
internalIP: '-',
externalIP: '-',
});
}
const podOwners = {
daemonset: this._parsePodOwnerGraphObjects(
'daemonset',
nodeData,
mappedTimeline,
t,
),
job: this._parsePodOwnerGraphObjects('job', nodeData, mappedTimeline, t),
replicaset: this._parsePodOwnerGraphObjects(
'replicaset',
nodeData,
mappedTimeline,
t,
),
};
return {
nodes: nodeData,
services: this.getServiceGraphData(nodeData, mappedTimeline, t),
graphTime: LongTimestampFormatPipe.toLongDisplayTimestamp(
t,
this.$timeZoneShift.value,
),
podOwners,
podOwnerOwners: {
cronjob: this._parsePodOwnerOwnerGraphObjects(
'cronjob',
podOwners.job,
mappedTimeline,
t,
),
deployment: this._parsePodOwnerOwnerGraphObjects(
'deployment',
podOwners.replicaset,
mappedTimeline,
t,
),
},
};
}