Skip to content

Commit

Permalink
moving ud containers logs as default
Browse files Browse the repository at this point in the history
Signed-off-by: veds-g <[email protected]>
  • Loading branch information
veds-g committed Feb 3, 2025
1 parent afc16ac commit 0ff6b56
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions ui/src/utils/fetcherHooks/podsViewFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@ export const usePodsViewFetch = (
const containers: string[] = [];
const containerSpecMap = new Map<string, PodContainerSpec>();

const containersList = JSON.parse(
JSON.stringify(pod?.spec?.containers)
);
const containersList: any[] = [];
pod?.spec?.initContainers
?.filter((initContainer: any) => initContainer?.restartPolicy === "Always")
?.filter(
(initContainer: any) =>
initContainer?.restartPolicy === "Always"
)
?.forEach((container: any) => containersList.push(container));

const specContainers = JSON.parse(
JSON.stringify(pod?.spec?.containers)
);

containersList.push(...specContainers);

containersList?.forEach((container: any) => {
const cpu = container?.resources?.requests?.cpu;
let cpuParsed: undefined | number;
Expand Down Expand Up @@ -130,7 +137,7 @@ export const usePodsViewFetch = (

useEffect(() => {
fetchPods();
},[vertexId, requestKey, host]);
}, [vertexId, requestKey, host]);

useEffect(() => {
if (pods?.length) {
Expand Down Expand Up @@ -243,10 +250,10 @@ export const usePodsViewFetch = (
// Retry fetching pods details if there is an error
useEffect(() => {
const currentTime = Date.now();
if (podsDetailsErr && (currentTime - lastRetryTime > 5000)) {
if (podsDetailsErr && currentTime - lastRetryTime > 5000) {
const retryFetch = setTimeout(() => {
fetchPodDetails();
setLastRetryTime(currentTime);
fetchPodDetails();
setLastRetryTime(currentTime);
}, 5000);

return () => clearTimeout(retryFetch);
Expand Down

0 comments on commit 0ff6b56

Please sign in to comment.