From 089b046059e4d1ff532a1161691e2015ebef2085 Mon Sep 17 00:00:00 2001 From: shepherd cheung <1220798123@qq.com> Date: Tue, 27 Aug 2024 21:24:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=20Modification=E3=80=91=E4=BF=AE=E5=A4=8Dpod=E7=BA=A7?= =?UTF-8?q?=E9=87=8D=E8=B0=83=E5=BA=A6=E4=B8=8B=E6=97=A0=E6=B3=95=E7=94=9F?= =?UTF-8?q?=E6=88=90ranktable=20=E3=80=90=E4=BF=AE=E6=94=B9=E4=BA=BA=20Mod?= =?UTF-8?q?ifier=E3=80=91Atlas=5Fzxp=20=E3=80=90=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E4=BA=BA=20Reviewer=E3=80=91Atlas=5Fkfa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/ring-controller/ranktable/v2/ranktable.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/ring-controller/ranktable/v2/ranktable.go b/pkg/ring-controller/ranktable/v2/ranktable.go index b527603..10599f1 100644 --- a/pkg/ring-controller/ranktable/v2/ranktable.go +++ b/pkg/ring-controller/ranktable/v2/ranktable.go @@ -19,6 +19,7 @@ import ( "fmt" "sort" "strconv" + "sync" apiCoreV1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" @@ -115,6 +116,6 @@ func (r *RankTable) GetPodNum() int { } // DeletePod delete pod in server when pod is deleted -func (r *RankTable) DeletePod(podID types.UID) { - r.Servers.Delete(podID) +func (r *RankTable) DeletePod(_ types.UID) { + r.Servers = &sync.Map{} } -- Gitee From aa58ad91cbfb411d77c962c0436d5ac7c82ab90c Mon Sep 17 00:00:00 2001 From: shepherd cheung <1220798123@qq.com> Date: Fri, 11 Oct 2024 11:26:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=20Modification=E3=80=91deploy=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=B6=E5=81=B6=E5=8F=91panic=20bugfix=20=E3=80=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=BA=20Modifier=E3=80=91Atlas=5Fzxp=20=E3=80=90?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E4=BA=BA=20Reviewer=E3=80=91Atlas=5Fkfa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/ring-controller/agent/deploymentworker.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/ring-controller/agent/deploymentworker.go b/pkg/ring-controller/agent/deploymentworker.go index 69f830e..0408452 100644 --- a/pkg/ring-controller/agent/deploymentworker.go +++ b/pkg/ring-controller/agent/deploymentworker.go @@ -16,6 +16,7 @@ package agent import ( "fmt" + "sync" "time" "huawei.com/npu-exporter/v5/common-utils/hwlog" @@ -39,6 +40,7 @@ func NewDeploymentWorker(agent *BusinessAgent, deploy DeployInfo, ranktable rank configmapData: ranktable, statisticStopped: false, cachedPodNum: 0, + cachedPods: &sync.Map{}, taskReplicasTotal: replicasTotal, cachedIndex: newCachedIndex(int(replicasTotal)), }, -- Gitee From 72e2fc611e72dd8d6fa98e53e430ba00412def8f Mon Sep 17 00:00:00 2001 From: shepherd cheung <1220798123@qq.com> Date: Fri, 11 Oct 2024 16:44:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=20Modification=E3=80=91deploy=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=B6=E5=81=B6=E5=8F=91panic=20bugfix=20=E3=80=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=BA=20Modifier=E3=80=91Atlas=5Fzxp=20=E3=80=90?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E4=BA=BA=20Reviewer=E3=80=91Atlas=5Fkfa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/ring-controller/agent/vcjobworker.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/ring-controller/agent/vcjobworker.go b/pkg/ring-controller/agent/vcjobworker.go index c9c8206..308626c 100644 --- a/pkg/ring-controller/agent/vcjobworker.go +++ b/pkg/ring-controller/agent/vcjobworker.go @@ -460,7 +460,9 @@ func (b *WorkerInfo) handleDeleteEvent(podInfo *podIdentifier) error { b.cachedIndex.Store(rankIndex, false) } hwlog.RunLog.Infof("data of pod %s/%s is removed", podInfo.namespace, podInfo.name) - b.cachedPods.Delete(podInfo.uid) + if b.cachedPods != nil { + b.cachedPods.Delete(podInfo.uid) + } b.configmapData.DeletePod(podInfo.uid) b.modifyStatistics(-1) return nil -- Gitee