Liveness probe added in ContainerCard component (#25958)

* Liveness probe added in ContainerCard component

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

* liveness probe shows only if available

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

* changed return object from variable

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>

---------

Signed-off-by: Deepankumar Loganathan <deepan0433@gmail.com>
This commit is contained in:
Deepankumar
2024-08-15 10:10:48 +02:00
committed by GitHub
parent a820f7e85c
commit 954a5939db
3 changed files with 22 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kubernetes-react': patch
---
`Liveness Probe` added in ContainerCard Component of PodDrawer
@@ -40,6 +40,7 @@ describe('ContainerCard', () => {
},
containerSpec: {
readinessProbe: {},
livenessProbe: {},
},
containerStatus: {
name: 'some-name',
@@ -35,20 +35,25 @@ const getContainerHealthChecks = (
containerSpec: IContainer,
containerStatus: IContainerStatus,
): { [key: string]: boolean } => {
if (containerStatus.state?.terminated?.reason === 'Completed') {
return {
'not waiting to start': containerStatus.state?.waiting === undefined,
'no restarts': containerStatus.restartCount === 0,
};
}
return {
const healthCheck = {
'not waiting to start': containerStatus.state?.waiting === undefined,
started: !!containerStatus.started,
ready: containerStatus.ready,
'no restarts': containerStatus.restartCount === 0,
'readiness probe set':
containerSpec && containerSpec?.readinessProbe !== undefined,
};
if (containerStatus.state?.terminated?.reason === 'Completed') {
return healthCheck;
}
Object.assign(
healthCheck,
{ started: !!containerStatus.started },
{ ready: containerStatus.ready },
{ 'readiness probe set': containerSpec?.readinessProbe !== undefined },
);
if (containerSpec && containerSpec?.livenessProbe !== undefined) {
Object.assign(healthCheck, {
'liveness probe set': containerSpec.livenessProbe,
});
}
return healthCheck;
};
const getCurrentState = (containerStatus: IContainerStatus): string => {