Skip to content

Commit c19a898

Browse files
Merge pull request #1032 from devtron-labs/fix/list-init-container
feat: add support for init containers in Pod nodes and update iNode interface
2 parents d829671 + 85ab226 commit c19a898

4 files changed

Lines changed: 28 additions & 13 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.23.4",
3+
"version": "1.23.5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Store/IndexStore.tsx

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,33 @@ export function getiNodesByRootNodeWithChildNodes(
116116
})
117117
})
118118

119-
// Add containers to Pod type nodes
119+
// Add init containers and containers to Pod type nodes
120120
children
121121
.filter((_child) => _child.kind.toLowerCase() == Nodes.Pod.toLowerCase())
122122
.map((_pn) => {
123+
const podMeta = (podMetadata || _appDetailsSubject.getValue().resourceTree?.podMetadata)?.filter(
124+
(_pmd) => _pmd.uid === _pn.uid,
125+
)[0]
126+
127+
const initNodes: iNode[] = (podMeta?.initContainers || []).map((_c: string) => {
128+
const initNode = {} as iNode
129+
initNode.kind = Nodes.Containers
130+
initNode.name = _c
131+
initNode.pNode = _pn
132+
initNode.isInitContainer = true
133+
return initNode
134+
})
135+
136+
const containerNodes: iNode[] = (podMeta?.containers || []).map((_c: string) => {
137+
const childNode = {} as iNode
138+
childNode.kind = Nodes.Containers
139+
childNode.name = _c
140+
childNode.pNode = _pn
141+
return childNode
142+
})
143+
123144
// eslint-disable-next-line no-param-reassign
124-
_pn.childNodes = (podMetadata || _appDetailsSubject.getValue().resourceTree?.podMetadata)
125-
?.filter((_pmd) => _pmd.uid === _pn.uid)[0]
126-
?.containers?.map((_c) => {
127-
const childNode = {} as iNode
128-
childNode.kind = Nodes.Containers
129-
childNode.pNode = _pn
130-
childNode.name = _c
131-
return childNode
132-
})
145+
_pn.childNodes = [...initNodes, ...containerNodes]
133146
})
134147
children = children.flatMap((_node) => _node.childNodes ?? [])
135148
}

src/Shared/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ export interface iNode extends Node {
174174
type: NodeType
175175
status: string
176176
pNode?: iNode
177+
/** Marks a node as an init container, used for display purposes in the resource tree. */
178+
isInitContainer?: boolean
177179
}
178180

179181
export interface HelmReleaseStatus {

0 commit comments

Comments
 (0)