From f8cb12d7572ba33a180a8843f0d0455a39f5bf4d Mon Sep 17 00:00:00 2001 From: Naineel Soyantar Date: Tue, 22 Oct 2024 17:24:21 +0530 Subject: [PATCH 1/8] =?UTF-8?q?=E2=9A=92=EF=B8=8F=20wip:=20started=20with?= =?UTF-8?q?=20addition=20of=20replicaset=20in=20deployments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cyclops-ctrl/internal/models/dto/k8s.go | 31 ++++++++++++----- cyclops-ctrl/pkg/cluster/k8sclient/mapper.go | 23 ++++++++----- cyclops-ctrl/pkg/cluster/k8sclient/modules.go | 33 +++++++++++++++++++ 3 files changed, 70 insertions(+), 17 deletions(-) diff --git a/cyclops-ctrl/internal/models/dto/k8s.go b/cyclops-ctrl/internal/models/dto/k8s.go index f3f880d3..22bfc89a 100644 --- a/cyclops-ctrl/internal/models/dto/k8s.go +++ b/cyclops-ctrl/internal/models/dto/k8s.go @@ -19,15 +19,16 @@ type Resource interface { } type Deployment struct { - Group string `json:"group"` - Version string `json:"version"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` - Replicas int `json:"replicas"` - Pods []Pod `json:"pods"` - Status string `json:"status"` - Deleted bool `json:"deleted"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Replicas int `json:"replicas"` + ReplicaSet []ReplicaSet `json:"replicaset"` + Pods []Pod `json:"pods"` + Status string `json:"status"` + Deleted bool `json:"deleted"` } func (d *Deployment) GetGroupVersionKind() string { @@ -202,6 +203,18 @@ type ContainerStatus struct { Running bool `json:"running"` } +type ReplicaSet struct { + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Replicas int32 `json:"replicas"` + FullyLabeledReplicas int32 `json:"fullyLabeledReplicas"` + ReadyReplicas int32 `json:"readyReplicas"` + AvailableReplicas int32 `json:"availableReplicas"` +} + type Pod struct { Group string `json:"group"` Version string `json:"version"` diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go index 743eac68..c0206ec5 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go @@ -17,20 +17,27 @@ func (k *KubernetesClient) mapDeployment(group, version, kind, name, namespace s return nil, err } + // map replicaset here + replicaSets, err := k.getReplicaset(*deployment) + if err != nil { + return nil, err + } + pods, err := k.getPods(*deployment) if err != nil { return nil, err } return &dto.Deployment{ - Group: group, - Version: version, - Kind: kind, - Name: deployment.Name, - Namespace: deployment.Namespace, - Replicas: int(*deployment.Spec.Replicas), - Pods: pods, - Status: getDeploymentStatus(deployment), + Group: group, + Version: version, + Kind: kind, + Name: deployment.Name, + Namespace: deployment.Namespace, + Replicas: int(*deployment.Spec.Replicas), + ReplicaSet: replicaSets, + Pods: pods, + Status: getDeploymentStatus(deployment), }, nil } diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go index e7902a09..17fcaf53 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go @@ -477,6 +477,39 @@ func (k *KubernetesClient) getResourceStatus(o unstructured.Unstructured) (strin return statusUnknown, nil } +func (k *KubernetesClient) getReplicaset(deployment appsv1.Deployment) ([]dto.ReplicaSet, error) { + rsList, err := k.clientset.AppsV1().ReplicaSets(deployment.Namespace).List(context.Background(), + metav1.ListOptions{ + LabelSelector: labels.Set(deployment.Spec.Selector.MatchLabels).String(), + }) + if err != nil { + return nil, err + } + + if len(rsList.Items) == 0 { + return nil, nil + } + + out := make([]dto.ReplicaSet, 0, len(rsList.Items)) + for _, rs := range rsList.Items { + if metav1.IsControlledBy(&rs, &deployment) { + out = append(out, dto.ReplicaSet{ + Group: rs.GroupVersionKind().Group, + Version: rs.GroupVersionKind().Version, + Kind: rs.GroupVersionKind().Kind, + Name: rs.GetName(), + Namespace: rs.GetNamespace(), + Replicas: rs.Status.Replicas, + AvailableReplicas: rs.Status.AvailableReplicas, + ReadyReplicas: rs.Status.ReadyReplicas, + FullyLabeledReplicas: rs.Status.FullyLabeledReplicas, + }) + } + } + + return out, nil +} + func (k *KubernetesClient) getPods(deployment appsv1.Deployment) ([]dto.Pod, error) { pods, err := k.clientset.CoreV1().Pods(deployment.Namespace).List(context.Background(), metav1.ListOptions{ LabelSelector: labels.Set(deployment.Spec.Selector.MatchLabels).String(), From 8434ac56a30a94606ae92883e3fb48770527d734 Mon Sep 17 00:00:00 2001 From: Naineel Soyantar Date: Fri, 25 Oct 2024 16:14:55 +0530 Subject: [PATCH 2/8] feat(cyclops-ui): adds replicaset to module deployment page --- cyclops-ctrl/internal/models/dto/k8s.go | 40 ++++++++++--------- cyclops-ctrl/pkg/cluster/k8sclient/mapper.go | 18 ++++----- cyclops-ctrl/pkg/cluster/k8sclient/modules.go | 11 +++-- .../components/k8s-resources/Deployment.tsx | 36 +++++++++++++++-- .../components/k8s-resources/ReplicaSet.tsx | 33 +++++++++++++++ .../src/components/pages/ModuleDetails.tsx | 40 +++++++++---------- cyclops-ui/src/utils/replicaset.tsx | 12 ++++++ 7 files changed, 135 insertions(+), 55 deletions(-) create mode 100644 cyclops-ui/src/components/k8s-resources/ReplicaSet.tsx create mode 100644 cyclops-ui/src/utils/replicaset.tsx diff --git a/cyclops-ctrl/internal/models/dto/k8s.go b/cyclops-ctrl/internal/models/dto/k8s.go index 22bfc89a..215309b9 100644 --- a/cyclops-ctrl/internal/models/dto/k8s.go +++ b/cyclops-ctrl/internal/models/dto/k8s.go @@ -19,16 +19,16 @@ type Resource interface { } type Deployment struct { - Group string `json:"group"` - Version string `json:"version"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` - Replicas int `json:"replicas"` - ReplicaSet []ReplicaSet `json:"replicaset"` - Pods []Pod `json:"pods"` - Status string `json:"status"` - Deleted bool `json:"deleted"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Replicas int `json:"replicas"` + ReplicaSets []ReplicaSet `json:"replicaSets"` + Pods []Pod `json:"pods"` + Status string `json:"status"` + Deleted bool `json:"deleted"` } func (d *Deployment) GetGroupVersionKind() string { @@ -204,15 +204,17 @@ type ContainerStatus struct { } type ReplicaSet struct { - Group string `json:"group"` - Version string `json:"version"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` - Replicas int32 `json:"replicas"` - FullyLabeledReplicas int32 `json:"fullyLabeledReplicas"` - ReadyReplicas int32 `json:"readyReplicas"` - AvailableReplicas int32 `json:"availableReplicas"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Replicas int32 `json:"replicas"` + FullyLabeledReplicas int32 `json:"fullyLabeledReplicas"` + ReadyReplicas int32 `json:"readyReplicas"` + AvailableReplicas int32 `json:"availableReplicas"` + Started metav1.Time `json:"started"` + Deleted bool `json:"deleted"` } type Pod struct { diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go index c0206ec5..70cc6d15 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go @@ -29,15 +29,15 @@ func (k *KubernetesClient) mapDeployment(group, version, kind, name, namespace s } return &dto.Deployment{ - Group: group, - Version: version, - Kind: kind, - Name: deployment.Name, - Namespace: deployment.Namespace, - Replicas: int(*deployment.Spec.Replicas), - ReplicaSet: replicaSets, - Pods: pods, - Status: getDeploymentStatus(deployment), + Group: group, + Version: version, + Kind: kind, + Name: deployment.Name, + Namespace: deployment.Namespace, + Replicas: int(*deployment.Spec.Replicas), + ReplicaSets: replicaSets, + Pods: pods, + Status: getDeploymentStatus(deployment), }, nil } diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go index 17fcaf53..c3ef18c4 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go @@ -486,11 +486,8 @@ func (k *KubernetesClient) getReplicaset(deployment appsv1.Deployment) ([]dto.Re return nil, err } - if len(rsList.Items) == 0 { - return nil, nil - } + out := []dto.ReplicaSet{} - out := make([]dto.ReplicaSet, 0, len(rsList.Items)) for _, rs := range rsList.Items { if metav1.IsControlledBy(&rs, &deployment) { out = append(out, dto.ReplicaSet{ @@ -503,6 +500,8 @@ func (k *KubernetesClient) getReplicaset(deployment appsv1.Deployment) ([]dto.Re AvailableReplicas: rs.Status.AvailableReplicas, ReadyReplicas: rs.Status.ReadyReplicas, FullyLabeledReplicas: rs.Status.FullyLabeledReplicas, + Started: rs.GetCreationTimestamp(), + Deleted: isReplicaSetDeleted(rs), }) } } @@ -974,3 +973,7 @@ func isStatefulSetProgressing(status appsv1.StatefulSetStatus, desiredReplicas * return status.ReadyReplicas < *desiredReplicas || status.UpdatedReplicas < *desiredReplicas } + +func isReplicaSetDeleted(rs appsv1.ReplicaSet) bool { + return rs.DeletionTimestamp != nil +} diff --git a/cyclops-ui/src/components/k8s-resources/Deployment.tsx b/cyclops-ui/src/components/k8s-resources/Deployment.tsx index e94cc92e..65e3e84f 100644 --- a/cyclops-ui/src/components/k8s-resources/Deployment.tsx +++ b/cyclops-ui/src/components/k8s-resources/Deployment.tsx @@ -1,9 +1,10 @@ -import React, { useCallback, useEffect, useState } from "react"; -import { Col, Divider, Row, Alert } from "antd"; +import { Alert, Col, Divider, Row } from "antd"; import axios from "axios"; +import { useCallback, useEffect, useState } from "react"; +import { isStreamingEnabled } from "../../utils/api/common"; import { mapResponseError } from "../../utils/api/errors"; import PodTable from "./common/PodTable/PodTable"; -import { isStreamingEnabled } from "../../utils/api/common"; +import ReplicaSet from "./ReplicaSet"; interface Props { name: string; @@ -15,6 +16,7 @@ const Deployment = ({ name, namespace, workload }: Props) => { const [deployment, setDeployment] = useState({ status: "", pods: [], + replicaSets: [], }); const [error, setError] = useState({ message: "", @@ -61,6 +63,24 @@ const Deployment = ({ name, namespace, workload }: Props) => { return deployment.pods; } + function getReplicaSets() { + if (workload && isStreamingEnabled()) { + return workload.replicaSets; + } + + return deployment.replicaSets; + } + + function sortReplicaSets(replicaSets: any[]) { + return replicaSets.sort((a, b) => { + if (a.replicas === b.replicas) { + return new Date(b.started).getTime() - new Date(a.started).getTime(); // descending on started time + } + + return b.replicas - a.replicas; // descending on replicas + }); + } + function getPodsLength() { let pods = getPods(); @@ -89,6 +109,16 @@ const Deployment = ({ name, namespace, workload }: Props) => { /> )} + + Replica Sets: {getReplicaSets().length} + + + + { + return ( +
+ + + + + + { + return <>{formatReplicaSetAge(value)}; + }} + /> +
+
+ ); +}; + +export default ReplicaSet; diff --git a/cyclops-ui/src/components/pages/ModuleDetails.tsx b/cyclops-ui/src/components/pages/ModuleDetails.tsx index 18073c09..788e7060 100644 --- a/cyclops-ui/src/components/pages/ModuleDetails.tsx +++ b/cyclops-ui/src/components/pages/ModuleDetails.tsx @@ -1,4 +1,15 @@ -import React, { useEffect, useState, useCallback } from "react"; +import { + BookOutlined, + CheckCircleTwoTone, + ClockCircleTwoTone, + CloseSquareTwoTone, + CopyOutlined, + DeleteOutlined, + EditOutlined, + FileTextOutlined, + UndoOutlined, +} from "@ant-design/icons"; +import "ace-builds/src-noconflict/ace"; import { Alert, Button, @@ -13,40 +24,29 @@ import { Tooltip, Typography, } from "antd"; -import "ace-builds/src-noconflict/ace"; -import { useParams } from "react-router-dom"; import axios from "axios"; -import { - BookOutlined, - CheckCircleTwoTone, - ClockCircleTwoTone, - CloseSquareTwoTone, - CopyOutlined, - DeleteOutlined, - EditOutlined, - FileTextOutlined, - UndoOutlined, -} from "@ant-design/icons"; +import { useCallback, useEffect, useState } from "react"; +import { useParams } from "react-router-dom"; import "./custom.css"; import "ace-builds/src-noconflict/mode-jsx"; import ReactAce from "react-ace"; -import { - moduleTemplateReferenceView, - templateRef, -} from "../../utils/templateRef"; -import { mapResponseError } from "../../utils/api/errors"; import YAML from "yaml"; import { isStreamingEnabled } from "../../utils/api/common"; +import { mapResponseError } from "../../utils/api/errors"; import { resourcesStream } from "../../utils/api/sse/resources"; +import { Workload } from "../../utils/k8s/workload"; import { isWorkload, ResourceRef, resourceRefKey, } from "../../utils/resourceRef"; +import { + moduleTemplateReferenceView, + templateRef, +} from "../../utils/templateRef"; import ResourceList from "../k8s-resources/ResourceList/ResourceList"; -import { Workload } from "../../utils/k8s/workload"; const languages = [ "javascript", diff --git a/cyclops-ui/src/utils/replicaset.tsx b/cyclops-ui/src/utils/replicaset.tsx new file mode 100644 index 00000000..398e052d --- /dev/null +++ b/cyclops-ui/src/utils/replicaset.tsx @@ -0,0 +1,12 @@ +import { formatDistanceToNow } from "date-fns"; + +export const formatReplicaSetAge = (creationTimestamp: string) => { + if (creationTimestamp === null || creationTimestamp === "") { + return ""; + } + + const parsedDate = new Date(creationTimestamp); + return formatDistanceToNow(parsedDate, { + addSuffix: true, + }); +}; From aa95e8a95c186e478992ab4ff570ddee5cf806ea Mon Sep 17 00:00:00 2001 From: Naineel Soyantar <112230479+naineel1209@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:51:14 +0000 Subject: [PATCH 3/8] feat: added replicaset as a progress bar in PodTable.tsx --- cyclops-ctrl/internal/models/dto/k8s.go | 2 -- cyclops-ctrl/pkg/cluster/k8sclient/modules.go | 20 +++++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/cyclops-ctrl/internal/models/dto/k8s.go b/cyclops-ctrl/internal/models/dto/k8s.go index 4cd2acfc..7f9cc37c 100644 --- a/cyclops-ctrl/internal/models/dto/k8s.go +++ b/cyclops-ctrl/internal/models/dto/k8s.go @@ -217,8 +217,6 @@ type ReplicaSet struct { Name string `json:"name"` Namespace string `json:"namespace"` Replicas int32 `json:"replicas"` - FullyLabeledReplicas int32 `json:"fullyLabeledReplicas"` - ReadyReplicas int32 `json:"readyReplicas"` AvailableReplicas int32 `json:"availableReplicas"` Started metav1.Time `json:"started"` Deleted bool `json:"deleted"` diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go index c3ef18c4..81775f47 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go @@ -491,17 +491,15 @@ func (k *KubernetesClient) getReplicaset(deployment appsv1.Deployment) ([]dto.Re for _, rs := range rsList.Items { if metav1.IsControlledBy(&rs, &deployment) { out = append(out, dto.ReplicaSet{ - Group: rs.GroupVersionKind().Group, - Version: rs.GroupVersionKind().Version, - Kind: rs.GroupVersionKind().Kind, - Name: rs.GetName(), - Namespace: rs.GetNamespace(), - Replicas: rs.Status.Replicas, - AvailableReplicas: rs.Status.AvailableReplicas, - ReadyReplicas: rs.Status.ReadyReplicas, - FullyLabeledReplicas: rs.Status.FullyLabeledReplicas, - Started: rs.GetCreationTimestamp(), - Deleted: isReplicaSetDeleted(rs), + Group: rs.GroupVersionKind().Group, + Version: rs.GroupVersionKind().Version, + Kind: rs.GroupVersionKind().Kind, + Name: rs.GetName(), + Namespace: rs.GetNamespace(), + Replicas: rs.Status.Replicas, + AvailableReplicas: rs.Status.AvailableReplicas, + Started: rs.GetCreationTimestamp(), + Deleted: isReplicaSetDeleted(rs), }) } } From 8bbdd0d8db04e0d5f923307d5d219014176969af Mon Sep 17 00:00:00 2001 From: Naineel Soyantar <112230479+naineel1209@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:51:14 +0000 Subject: [PATCH 4/8] feat: added replicaset as a progress bar in PodTable.tsx --- cyclops-ctrl/internal/models/dto/k8s.go | 2 - cyclops-ctrl/pkg/cluster/k8sclient/modules.go | 20 +++++----- .../components/k8s-resources/Deployment.tsx | 12 +----- .../components/k8s-resources/ReplicaSet.tsx | 33 --------------- .../common/PodTable/PodTable.tsx | 12 +++++- .../common/ReplicaSetProgress.tsx | 40 +++++++++++++++++++ 6 files changed, 61 insertions(+), 58 deletions(-) delete mode 100644 cyclops-ui/src/components/k8s-resources/ReplicaSet.tsx create mode 100644 cyclops-ui/src/components/k8s-resources/common/ReplicaSetProgress.tsx diff --git a/cyclops-ctrl/internal/models/dto/k8s.go b/cyclops-ctrl/internal/models/dto/k8s.go index 4cd2acfc..7f9cc37c 100644 --- a/cyclops-ctrl/internal/models/dto/k8s.go +++ b/cyclops-ctrl/internal/models/dto/k8s.go @@ -217,8 +217,6 @@ type ReplicaSet struct { Name string `json:"name"` Namespace string `json:"namespace"` Replicas int32 `json:"replicas"` - FullyLabeledReplicas int32 `json:"fullyLabeledReplicas"` - ReadyReplicas int32 `json:"readyReplicas"` AvailableReplicas int32 `json:"availableReplicas"` Started metav1.Time `json:"started"` Deleted bool `json:"deleted"` diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go index c3ef18c4..81775f47 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go @@ -491,17 +491,15 @@ func (k *KubernetesClient) getReplicaset(deployment appsv1.Deployment) ([]dto.Re for _, rs := range rsList.Items { if metav1.IsControlledBy(&rs, &deployment) { out = append(out, dto.ReplicaSet{ - Group: rs.GroupVersionKind().Group, - Version: rs.GroupVersionKind().Version, - Kind: rs.GroupVersionKind().Kind, - Name: rs.GetName(), - Namespace: rs.GetNamespace(), - Replicas: rs.Status.Replicas, - AvailableReplicas: rs.Status.AvailableReplicas, - ReadyReplicas: rs.Status.ReadyReplicas, - FullyLabeledReplicas: rs.Status.FullyLabeledReplicas, - Started: rs.GetCreationTimestamp(), - Deleted: isReplicaSetDeleted(rs), + Group: rs.GroupVersionKind().Group, + Version: rs.GroupVersionKind().Version, + Kind: rs.GroupVersionKind().Kind, + Name: rs.GetName(), + Namespace: rs.GetNamespace(), + Replicas: rs.Status.Replicas, + AvailableReplicas: rs.Status.AvailableReplicas, + Started: rs.GetCreationTimestamp(), + Deleted: isReplicaSetDeleted(rs), }) } } diff --git a/cyclops-ui/src/components/k8s-resources/Deployment.tsx b/cyclops-ui/src/components/k8s-resources/Deployment.tsx index 65e3e84f..d2283b43 100644 --- a/cyclops-ui/src/components/k8s-resources/Deployment.tsx +++ b/cyclops-ui/src/components/k8s-resources/Deployment.tsx @@ -4,7 +4,6 @@ import { useCallback, useEffect, useState } from "react"; import { isStreamingEnabled } from "../../utils/api/common"; import { mapResponseError } from "../../utils/api/errors"; import PodTable from "./common/PodTable/PodTable"; -import ReplicaSet from "./ReplicaSet"; interface Props { name: string; @@ -109,16 +108,6 @@ const Deployment = ({ name, namespace, workload }: Props) => { /> )} - - Replica Sets: {getReplicaSets().length} - - - - { {}} /> diff --git a/cyclops-ui/src/components/k8s-resources/ReplicaSet.tsx b/cyclops-ui/src/components/k8s-resources/ReplicaSet.tsx deleted file mode 100644 index 06284512..00000000 --- a/cyclops-ui/src/components/k8s-resources/ReplicaSet.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Table } from "antd"; -import { formatReplicaSetAge } from "../../utils/replicaset"; - -interface ReplicaSetType { - replicaSets: any[]; -} - -const ReplicaSet = ({ replicaSets }: ReplicaSetType) => { - return ( -
- - - - - - { - return <>{formatReplicaSetAge(value)}; - }} - /> -
-
- ); -}; - -export default ReplicaSet; diff --git a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx index 23ed1f50..56976d7b 100644 --- a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx +++ b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx @@ -15,6 +15,7 @@ import axios from "axios"; import { useState } from "react"; import { mapResponseError } from "../../../../utils/api/errors"; import { formatPodAge } from "../../../../utils/pods"; +import ReplicaSetProgress from "../ReplicaSetProgress"; import PodLogs from "./PodLogs"; import PodManifest from "./PodManifest"; import styles from "./styles.module.css"; @@ -22,6 +23,7 @@ import styles from "./styles.module.css"; interface Props { namespace: string; pods: any[]; + replicaSets?: any[]; updateResourceData: () => void; } @@ -33,7 +35,12 @@ interface Pod { namespace: any; } -const PodTable = ({ pods, namespace, updateResourceData }: Props) => { +const PodTable = ({ + pods, + namespace, + replicaSets, + updateResourceData, +}: Props) => { const [deletePodRef, setDeletePodRef] = useState<{ on: boolean; podDetails: Pod; @@ -136,6 +143,9 @@ const PodTable = ({ pods, namespace, updateResourceData }: Props) => { return (
+ {replicaSets && replicaSets.length > 0 && ( + + )} { + // Active replicas / Total Replicas + const totalAvailableReplicas = replicaSets.reduce((acc, rs) => { + return acc + rs.replicas; + }, 0); + + const activeAvailableReplicas = replicaSets[0]?.replicas || 0; + const activeAvailableReplicasPercent = + (activeAvailableReplicas / totalAvailableReplicas) * 100; + const remainingReplicasPercent = 100 - activeAvailableReplicasPercent; + + return ( +
+ + + `${activeAvailableReplicas} / ${totalAvailableReplicas}` + } + /> + +
+ ); +}; + +export default ReplicaSetProgress; From 6b13499c69151d91cce24c716650e3c4c0bcec82 Mon Sep 17 00:00:00 2001 From: Naineel Soyantar <112230479+naineel1209@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:59:05 +0000 Subject: [PATCH 5/8] remove not required utils functions --- cyclops-ui/src/utils/replicaset.tsx | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 cyclops-ui/src/utils/replicaset.tsx diff --git a/cyclops-ui/src/utils/replicaset.tsx b/cyclops-ui/src/utils/replicaset.tsx deleted file mode 100644 index 398e052d..00000000 --- a/cyclops-ui/src/utils/replicaset.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { formatDistanceToNow } from "date-fns"; - -export const formatReplicaSetAge = (creationTimestamp: string) => { - if (creationTimestamp === null || creationTimestamp === "") { - return ""; - } - - const parsedDate = new Date(creationTimestamp); - return formatDistanceToNow(parsedDate, { - addSuffix: true, - }); -}; From a952656cce032976535ded82acb50fb10a3fe3dd Mon Sep 17 00:00:00 2001 From: Naineel Soyantar <112230479+naineel1209@users.noreply.github.com> Date: Tue, 5 Nov 2024 06:33:03 +0000 Subject: [PATCH 6/8] added `activeReplicaSet` field in deployment and applies recommended changes --- cyclops-ctrl/internal/models/dto/k8s.go | 39 ++++++++-------- cyclops-ctrl/pkg/cluster/k8sclient/mapper.go | 45 +++++++++++++++---- .../components/k8s-resources/Deployment.tsx | 16 +++---- .../common/PodTable/PodTable.tsx | 9 +++- .../common/ReplicaSetProgress.tsx | 26 +++++++---- 5 files changed, 89 insertions(+), 46 deletions(-) diff --git a/cyclops-ctrl/internal/models/dto/k8s.go b/cyclops-ctrl/internal/models/dto/k8s.go index 7f9cc37c..a14c8093 100644 --- a/cyclops-ctrl/internal/models/dto/k8s.go +++ b/cyclops-ctrl/internal/models/dto/k8s.go @@ -19,16 +19,17 @@ type Resource interface { } type Deployment struct { - Group string `json:"group"` - Version string `json:"version"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` - Replicas int `json:"replicas"` - ReplicaSets []ReplicaSet `json:"replicaSets"` - Pods []Pod `json:"pods"` - Status string `json:"status"` - Deleted bool `json:"deleted"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Replicas int `json:"replicas"` + ReplicaSets []ReplicaSet `json:"replicaSets"` + Pods []Pod `json:"pods"` + Status string `json:"status"` + Deleted bool `json:"deleted"` + ActiveReplicaSet string `json:"activeReplicaSet"` } func (d *Deployment) GetGroupVersionKind() string { @@ -211,15 +212,15 @@ type ContainerStatus struct { } type ReplicaSet struct { - Group string `json:"group"` - Version string `json:"version"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` - Replicas int32 `json:"replicas"` - AvailableReplicas int32 `json:"availableReplicas"` - Started metav1.Time `json:"started"` - Deleted bool `json:"deleted"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Replicas int32 `json:"replicas"` + AvailableReplicas int32 `json:"availableReplicas"` + Started metav1.Time `json:"started"` + Deleted bool `json:"deleted"` } type Pod struct { diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go index 19559a3a..4ec191a1 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go @@ -2,6 +2,9 @@ package k8sclient import ( "context" + "strings" + + appsv1 "k8s.io/api/apps/v1" apiv1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -28,15 +31,16 @@ func (k *KubernetesClient) mapDeployment(group, version, kind, name, namespace s } return &dto.Deployment{ - Group: group, - Version: version, - Kind: kind, - Name: deployment.Name, - Namespace: deployment.Namespace, - Replicas: int(*deployment.Spec.Replicas), - ReplicaSets: replicaSets, - Pods: pods, - Status: getDeploymentStatus(deployment), + Group: group, + Version: version, + Kind: kind, + Name: deployment.Name, + Namespace: deployment.Namespace, + Replicas: int(*deployment.Spec.Replicas), + ReplicaSets: replicaSets, + Pods: pods, + Status: getDeploymentStatus(deployment), + ActiveReplicaSet: getActiveReplicaSet(deployment.Status.Conditions), }, nil } @@ -462,3 +466,26 @@ func mapIPBlock(block *networkingv1.IPBlock) *dto.IPBlock { Except: block.Except, } } + +func getActiveReplicaSet(conditions []appsv1.DeploymentCondition) string { + var latestProgressingCondition *appsv1.DeploymentCondition + + for _, condition := range conditions { + if condition.Type == appsv1.DeploymentProgressing { + if latestProgressingCondition == nil || condition.LastTransitionTime.After(latestProgressingCondition.LastTransitionTime.Time) { + latestProgressingCondition = &condition + } + } + } + + if latestProgressingCondition != nil { + if strings.Contains(latestProgressingCondition.Message, "ReplicaSet") { + parts := strings.Split(latestProgressingCondition.Message, "\"") + if len(parts) > 1 { + return parts[1] // ReplicaSet \".+\" is progressing. status: Progressing + } + } + } + + return "" +} diff --git a/cyclops-ui/src/components/k8s-resources/Deployment.tsx b/cyclops-ui/src/components/k8s-resources/Deployment.tsx index d2283b43..d6a14357 100644 --- a/cyclops-ui/src/components/k8s-resources/Deployment.tsx +++ b/cyclops-ui/src/components/k8s-resources/Deployment.tsx @@ -16,6 +16,7 @@ const Deployment = ({ name, namespace, workload }: Props) => { status: "", pods: [], replicaSets: [], + activeReplicaSet: "", }); const [error, setError] = useState({ message: "", @@ -70,14 +71,12 @@ const Deployment = ({ name, namespace, workload }: Props) => { return deployment.replicaSets; } - function sortReplicaSets(replicaSets: any[]) { - return replicaSets.sort((a, b) => { - if (a.replicas === b.replicas) { - return new Date(b.started).getTime() - new Date(a.started).getTime(); // descending on started time - } + function getActiveReplicaSet() { + if (workload && isStreamingEnabled()) { + return workload.activeReplicaSet; + } - return b.replicas - a.replicas; // descending on replicas - }); + return deployment.activeReplicaSet; } function getPodsLength() { @@ -119,7 +118,8 @@ const Deployment = ({ name, namespace, workload }: Props) => { {}} /> diff --git a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx index 56976d7b..63140d9d 100644 --- a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx +++ b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx @@ -24,6 +24,7 @@ interface Props { namespace: string; pods: any[]; replicaSets?: any[]; + activeReplicaSet?: string; updateResourceData: () => void; } @@ -39,6 +40,7 @@ const PodTable = ({ pods, namespace, replicaSets, + activeReplicaSet, updateResourceData, }: Props) => { const [deletePodRef, setDeletePodRef] = useState<{ @@ -143,8 +145,11 @@ const PodTable = ({ return (
- {replicaSets && replicaSets.length > 0 && ( - + {replicaSets && activeReplicaSet && replicaSets.length > 0 && ( + )}
{ +const ReplicaSetProgress = ({ + replicaSets, + activeReplicaSet, +}: ReplicaSetType) => { // Active replicas / Total Replicas const totalAvailableReplicas = replicaSets.reduce((acc, rs) => { - return acc + rs.replicas; + return acc + rs.availableReplicas; }, 0); - const activeAvailableReplicas = replicaSets[0]?.replicas || 0; + const activeAvailableReplicas = replicaSets.filter( + (rs) => rs.name === activeReplicaSet, + )[0].availableReplicas; const activeAvailableReplicasPercent = (activeAvailableReplicas / totalAvailableReplicas) * 100; - const remainingReplicasPercent = 100 - activeAvailableReplicasPercent; return (
{ title={`${activeAvailableReplicas} active / ${totalAvailableReplicas - activeAvailableReplicas} non-active / ${totalAvailableReplicas} total`} > - `${activeAvailableReplicas} / ${totalAvailableReplicas}` - } + format={() => { + return activeAvailableReplicasPercent === 100 ? ( + + ) : ( + + ); + }} />
From 30da911456180fe440dfbb97596b8d6937edb483 Mon Sep 17 00:00:00 2001 From: Naineel Soyantar Date: Thu, 7 Nov 2024 14:28:20 +0530 Subject: [PATCH 7/8] wip: applying recommended changes --- cyclops-ctrl/internal/models/dto/k8s.go | 34 +++++--------- cyclops-ctrl/pkg/cluster/k8sclient/mapper.go | 7 --- cyclops-ctrl/pkg/cluster/k8sclient/modules.go | 45 +++++-------------- .../components/k8s-resources/Deployment.tsx | 11 +++-- .../common/PodTable/PodTable.tsx | 9 ++-- .../common/ReplicaSetProgress.tsx | 37 ++++++++------- 6 files changed, 53 insertions(+), 90 deletions(-) diff --git a/cyclops-ctrl/internal/models/dto/k8s.go b/cyclops-ctrl/internal/models/dto/k8s.go index a14c8093..91bc93cf 100644 --- a/cyclops-ctrl/internal/models/dto/k8s.go +++ b/cyclops-ctrl/internal/models/dto/k8s.go @@ -19,17 +19,16 @@ type Resource interface { } type Deployment struct { - Group string `json:"group"` - Version string `json:"version"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` - Replicas int `json:"replicas"` - ReplicaSets []ReplicaSet `json:"replicaSets"` - Pods []Pod `json:"pods"` - Status string `json:"status"` - Deleted bool `json:"deleted"` - ActiveReplicaSet string `json:"activeReplicaSet"` + Group string `json:"group"` + Version string `json:"version"` + Kind string `json:"kind"` + Name string `json:"name"` + Namespace string `json:"namespace"` + Replicas int `json:"replicas"` + Pods []Pod `json:"pods"` + Status string `json:"status"` + Deleted bool `json:"deleted"` + ActiveReplicaSet string `json:"activeReplicaSet"` } func (d *Deployment) GetGroupVersionKind() string { @@ -211,18 +210,6 @@ type ContainerStatus struct { Running bool `json:"running"` } -type ReplicaSet struct { - Group string `json:"group"` - Version string `json:"version"` - Kind string `json:"kind"` - Name string `json:"name"` - Namespace string `json:"namespace"` - Replicas int32 `json:"replicas"` - AvailableReplicas int32 `json:"availableReplicas"` - Started metav1.Time `json:"started"` - Deleted bool `json:"deleted"` -} - type Pod struct { Group string `json:"group"` Version string `json:"version"` @@ -236,6 +223,7 @@ type Pod struct { Status bool `json:"status"` Started *metav1.Time `json:"started"` Deleted bool `json:"deleted"` + ReplicaSet string `json:"replicaSet"` } func (p *Pod) GetGroupVersionKind() string { diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go index 4ec191a1..5455b7ed 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/mapper.go @@ -19,12 +19,6 @@ func (k *KubernetesClient) mapDeployment(group, version, kind, name, namespace s return nil, err } - // map replicaset here - replicaSets, err := k.getReplicaset(*deployment) - if err != nil { - return nil, err - } - pods, err := k.getPods(*deployment) if err != nil { return nil, err @@ -37,7 +31,6 @@ func (k *KubernetesClient) mapDeployment(group, version, kind, name, namespace s Name: deployment.Name, Namespace: deployment.Namespace, Replicas: int(*deployment.Spec.Replicas), - ReplicaSets: replicaSets, Pods: pods, Status: getDeploymentStatus(deployment), ActiveReplicaSet: getActiveReplicaSet(deployment.Status.Conditions), diff --git a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go index 7c2db9ca..e4db3637 100644 --- a/cyclops-ctrl/pkg/cluster/k8sclient/modules.go +++ b/cyclops-ctrl/pkg/cluster/k8sclient/modules.go @@ -478,36 +478,6 @@ func (k *KubernetesClient) getResourceStatus(o unstructured.Unstructured) (strin return statusUnknown, nil } -func (k *KubernetesClient) getReplicaset(deployment appsv1.Deployment) ([]dto.ReplicaSet, error) { - rsList, err := k.clientset.AppsV1().ReplicaSets(deployment.Namespace).List(context.Background(), - metav1.ListOptions{ - LabelSelector: labels.Set(deployment.Spec.Selector.MatchLabels).String(), - }) - if err != nil { - return nil, err - } - - out := []dto.ReplicaSet{} - - for _, rs := range rsList.Items { - if metav1.IsControlledBy(&rs, &deployment) { - out = append(out, dto.ReplicaSet{ - Group: rs.GroupVersionKind().Group, - Version: rs.GroupVersionKind().Version, - Kind: rs.GroupVersionKind().Kind, - Name: rs.GetName(), - Namespace: rs.GetNamespace(), - Replicas: rs.Status.Replicas, - AvailableReplicas: rs.Status.AvailableReplicas, - Started: rs.GetCreationTimestamp(), - Deleted: isReplicaSetDeleted(rs), - }) - } - } - - return out, nil -} - func (k *KubernetesClient) getPods(deployment appsv1.Deployment) ([]dto.Pod, error) { pods, err := k.clientset.CoreV1().Pods(deployment.Namespace).List(context.Background(), metav1.ListOptions{ LabelSelector: labels.Set(deployment.Spec.Selector.MatchLabels).String(), @@ -554,6 +524,7 @@ func (k *KubernetesClient) getPods(deployment appsv1.Deployment) ([]dto.Pod, err Node: item.Spec.NodeName, PodPhase: string(item.Status.Phase), Started: item.Status.StartTime, + ReplicaSet: getReplicaSetOwner(&item), }) } @@ -858,6 +829,16 @@ func containerStatus(status apiv1.ContainerStatus) dto.ContainerStatus { } } +func getReplicaSetOwner(pod *apiv1.Pod) string { + for _, reference := range pod.OwnerReferences { + if reference.Kind == "ReplicaSet" { + return reference.Name + } + } + + return "" +} + func getDeploymentStatus(deployment *appsv1.Deployment) string { if isDeploymentProgressing(deployment.Status.Conditions) { return statusProgressing @@ -972,7 +953,3 @@ func isStatefulSetProgressing(status appsv1.StatefulSetStatus, desiredReplicas * return status.ReadyReplicas < *desiredReplicas || status.UpdatedReplicas < *desiredReplicas } - -func isReplicaSetDeleted(rs appsv1.ReplicaSet) bool { - return rs.DeletionTimestamp != nil -} diff --git a/cyclops-ui/src/components/k8s-resources/Deployment.tsx b/cyclops-ui/src/components/k8s-resources/Deployment.tsx index d6a14357..24496656 100644 --- a/cyclops-ui/src/components/k8s-resources/Deployment.tsx +++ b/cyclops-ui/src/components/k8s-resources/Deployment.tsx @@ -15,7 +15,7 @@ const Deployment = ({ name, namespace, workload }: Props) => { const [deployment, setDeployment] = useState({ status: "", pods: [], - replicaSets: [], + replicas: 0, activeReplicaSet: "", }); const [error, setError] = useState({ @@ -63,14 +63,13 @@ const Deployment = ({ name, namespace, workload }: Props) => { return deployment.pods; } - function getReplicaSets() { + function getNoOfReplicas() { if (workload && isStreamingEnabled()) { - return workload.replicaSets; + return workload.replicas; } - return deployment.replicaSets; + return deployment.replicas; } - function getActiveReplicaSet() { if (workload && isStreamingEnabled()) { return workload.activeReplicaSet; @@ -117,8 +116,8 @@ const Deployment = ({ name, namespace, workload }: Props) => {
{}} /> diff --git a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx index 63140d9d..4d9a8553 100644 --- a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx +++ b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx @@ -23,7 +23,7 @@ import styles from "./styles.module.css"; interface Props { namespace: string; pods: any[]; - replicaSets?: any[]; + replicas?: number; activeReplicaSet?: string; updateResourceData: () => void; } @@ -39,7 +39,7 @@ interface Pod { const PodTable = ({ pods, namespace, - replicaSets, + replicas, activeReplicaSet, updateResourceData, }: Props) => { @@ -145,9 +145,10 @@ const PodTable = ({ return (
- {replicaSets && activeReplicaSet && replicaSets.length > 0 && ( + {replicas && activeReplicaSet && ( )} diff --git a/cyclops-ui/src/components/k8s-resources/common/ReplicaSetProgress.tsx b/cyclops-ui/src/components/k8s-resources/common/ReplicaSetProgress.tsx index 8815e89f..31e03ec3 100644 --- a/cyclops-ui/src/components/k8s-resources/common/ReplicaSetProgress.tsx +++ b/cyclops-ui/src/components/k8s-resources/common/ReplicaSetProgress.tsx @@ -2,24 +2,31 @@ import { CheckCircleOutlined, SyncOutlined } from "@ant-design/icons"; import { Progress, Tooltip } from "antd"; interface ReplicaSetType { - replicaSets: any[]; + pods: any[]; + replicas: number; activeReplicaSet: string; } const ReplicaSetProgress = ({ - replicaSets, + pods, + replicas, activeReplicaSet, }: ReplicaSetType) => { - // Active replicas / Total Replicas - const totalAvailableReplicas = replicaSets.reduce((acc, rs) => { - return acc + rs.availableReplicas; - }, 0); + // Healthy Replicas (matching replicasets pods) / Total Replicas (defined in the deployment) + const totalReplicas = replicas; - const activeAvailableReplicas = replicaSets.filter( - (rs) => rs.name === activeReplicaSet, - )[0].availableReplicas; - const activeAvailableReplicasPercent = - (activeAvailableReplicas / totalAvailableReplicas) * 100; + const healthyReplicas = pods.filter((elem) => { + return elem.podPhase === "Running" && elem.replicaSet === activeReplicaSet; + }).length; + + const healthyReplicasPercent = (healthyReplicas / totalReplicas) * 100; + + console.log( + activeReplicaSet, + healthyReplicas, + totalReplicas, + healthyReplicasPercent, + ); return (
- + { - return activeAvailableReplicasPercent === 100 ? ( + return healthyReplicasPercent === 100 ? ( ) : ( From d33aaf137b772439826a58c8c4d7773cb525a4fb Mon Sep 17 00:00:00 2001 From: naineel1209 Date: Thu, 21 Nov 2024 21:58:39 +0530 Subject: [PATCH 8/8] move `ReplicaSetProgress.tsx` to Deployment component --- .../components/k8s-resources/Deployment.tsx | 31 ++++++------------- .../common/PodTable/PodTable.tsx | 18 +---------- .../common/ReplicaSetProgress.tsx | 7 ----- 3 files changed, 11 insertions(+), 45 deletions(-) diff --git a/cyclops-ui/src/components/k8s-resources/Deployment.tsx b/cyclops-ui/src/components/k8s-resources/Deployment.tsx index 24496656..39cd25b8 100644 --- a/cyclops-ui/src/components/k8s-resources/Deployment.tsx +++ b/cyclops-ui/src/components/k8s-resources/Deployment.tsx @@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from "react"; import { isStreamingEnabled } from "../../utils/api/common"; import { mapResponseError } from "../../utils/api/errors"; import PodTable from "./common/PodTable/PodTable"; +import ReplicaSetProgress from "./common/ReplicaSetProgress"; interface Props { name: string; @@ -45,10 +46,6 @@ const Deployment = ({ name, namespace, workload }: Props) => { useEffect(() => { fetchDeployment(); - if (isStreamingEnabled()) { - return; - } - const interval = setInterval(() => fetchDeployment(), 15000); return () => { clearInterval(interval); @@ -63,21 +60,6 @@ const Deployment = ({ name, namespace, workload }: Props) => { return deployment.pods; } - function getNoOfReplicas() { - if (workload && isStreamingEnabled()) { - return workload.replicas; - } - - return deployment.replicas; - } - function getActiveReplicaSet() { - if (workload && isStreamingEnabled()) { - return workload.activeReplicaSet; - } - - return deployment.activeReplicaSet; - } - function getPodsLength() { let pods = getPods(); @@ -88,6 +70,8 @@ const Deployment = ({ name, namespace, workload }: Props) => { return 0; } + const { pods, replicas, activeReplicaSet } = deployment; + return (
{error.message.length !== 0 && ( @@ -114,11 +98,16 @@ const Deployment = ({ name, namespace, workload }: Props) => { Replicas: {getPodsLength()}
+ {replicas && activeReplicaSet && ( + + )} {}} /> diff --git a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx index 4d9a8553..23ed1f50 100644 --- a/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx +++ b/cyclops-ui/src/components/k8s-resources/common/PodTable/PodTable.tsx @@ -15,7 +15,6 @@ import axios from "axios"; import { useState } from "react"; import { mapResponseError } from "../../../../utils/api/errors"; import { formatPodAge } from "../../../../utils/pods"; -import ReplicaSetProgress from "../ReplicaSetProgress"; import PodLogs from "./PodLogs"; import PodManifest from "./PodManifest"; import styles from "./styles.module.css"; @@ -23,8 +22,6 @@ import styles from "./styles.module.css"; interface Props { namespace: string; pods: any[]; - replicas?: number; - activeReplicaSet?: string; updateResourceData: () => void; } @@ -36,13 +33,7 @@ interface Pod { namespace: any; } -const PodTable = ({ - pods, - namespace, - replicas, - activeReplicaSet, - updateResourceData, -}: Props) => { +const PodTable = ({ pods, namespace, updateResourceData }: Props) => { const [deletePodRef, setDeletePodRef] = useState<{ on: boolean; podDetails: Pod; @@ -145,13 +136,6 @@ const PodTable = ({ return (
- {replicas && activeReplicaSet && ( - - )}