Skip to content

Commit

Permalink
fix: Fix deployment status properly (kyma-project#3495)
Browse files Browse the repository at this point in the history
* Fix deployment status properly on deployments list,
 details and incluster overview

* Fix deployments card
  • Loading branch information
akucharska authored and pbochynski committed Dec 6, 2024
1 parent 4245ca0 commit 58c0632
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/resources/Deployments/DeploymentDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ export function DeploymentDetails(props) {
const statusConditions = deployment => {
return deployment?.status?.conditions?.map(condition => {
return {
header: { titleText: condition.type, status: condition.status },
header: {
titleText: condition.type,
status: condition.status,
overrideStatusType:
condition.type === 'ReplicaFailure' ? 'False' : condition.status,
},
message: condition.message,
};
});
Expand Down
2 changes: 1 addition & 1 deletion src/resources/Deployments/DeploymentStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RunningPodsStatus } from 'shared/components/RunningPodsStatus';

export function DeploymentStatus({ deployment }) {
const running = deployment.status.readyReplicas || 0;
const expected = deployment.status.replicas || 0;
const expected = deployment.status.replicas || deployment.spec.replicas || 0;

return <RunningPodsStatus running={running} expected={expected} />;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { calculatePodState } from 'resources/Pods/PodStatus';

export function getHealthyReplicasCount(resource) {
return resource?.filter(r => r.status.replicas === r.status.readyReplicas)
?.length;
return resource?.filter(r => {
const running = r.status.readyReplicas || 0;
const expected = r.status.replicas || r.spec.replicas || 0;

return running === expected;
})?.length;
}

export const PodStatusCounterKey = {
Expand Down
2 changes: 2 additions & 0 deletions src/shared/components/ConditionList/ConditionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type ConditionItem = {
type ConditionHeader = {
titleText: string | ReactNode;
status?: string;
overrideStatusType?: string;
};

export const ConditionList = ({
Expand All @@ -34,6 +35,7 @@ export const ConditionList = ({
key={index}
header={cond.header?.titleText}
status={cond.header?.status}
overrideStatusType={cond.header?.overrideStatusType}
content={cond.message}
customContent={cond.customContent}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import './ExpandableListItem.scss';
type ExpandableListItemProps = {
header: string | ReactNode;
status?: string;
overrideStatusType?: string;
content?: string;
customContent?: CustomContent[];
};
Expand All @@ -21,12 +22,18 @@ export type CustomContent = {
export const ExpandableListItem = ({
header,
status,
overrideStatusType,
content,
customContent,
}: ExpandableListItemProps) => {
const { t } = useTranslation();
const [expanded, setExpanded] = useState(false);

let statusType = status === 'True' ? 'Success' : 'Error';
if (overrideStatusType !== undefined) {
statusType = overrideStatusType === 'True' ? 'Success' : 'Error';
}

return (
<>
<ListItemStandard
Expand Down

0 comments on commit 58c0632

Please sign in to comment.