Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix deployment status properly #3495

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 (
<>
<StandardListItem
Expand All @@ -49,10 +56,7 @@ export const ExpandableListItem = ({
)}
{header}
{status && (
<StatusBadge
type={status === 'True' ? 'Success' : 'Error'}
className={'header__status-badge'}
>
<StatusBadge type={statusType} className={'header__status-badge'}>
{status}
</StatusBadge>
)}
Expand Down
Loading