From 32ab450fef4451a29dcc636af071f31fa5527ffa Mon Sep 17 00:00:00 2001 From: dongming Date: Sun, 8 Jan 2023 20:14:01 +0800 Subject: [PATCH] =?UTF-8?q?l-110=20bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/msbdeployment_controller.go | 10 +- test/e2e/e2e.xml | 130 ++++++++++++------------ 2 files changed, 71 insertions(+), 69 deletions(-) diff --git a/controllers/msbdeployment_controller.go b/controllers/msbdeployment_controller.go index 64d6ed3..3f26f80 100644 --- a/controllers/msbdeployment_controller.go +++ b/controllers/msbdeployment_controller.go @@ -286,7 +286,7 @@ func (r *MsbDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&myAppsv1.MsbDeployment{}). Owns(&appsv1.Deployment{}). // 监控 deployment 类型,变更就触发 reconciler - Owns(&corev1.Service{}). // 监控 service 类型,变更就触发 reconciler + Owns(&corev1.Service{}). // 监控 service 类型,变更就触发 reconciler Owns(&networkv1.Ingress{}). // 监控 ingress 类型,变更就触发 reconciler Complete(r) } @@ -475,11 +475,13 @@ func createCondition(conditionType, message, status, reason string) myAppsv1.Con // 只是删除对应的Condition不做更多的操作 func (r *MsbDeploymentReconciler) deleteStatus(md *myAppsv1.MsbDeployment, conditionType string) { // 1. 遍历conditions - for i := range md.Status.Conditions { + var tmp []myAppsv1.Condition + copy(tmp, md.Status.Conditions) + for i := range tmp { // 2. 找到要删除的对象 - if md.Status.Conditions[i].Type == conditionType { + if tmp[i].Type == conditionType { // 3. 执行删除 - md.Status.Conditions = deleteCondition(md.Status.Conditions, i) + md.Status.Conditions = deleteCondition(tmp, i) } } } diff --git a/test/e2e/e2e.xml b/test/e2e/e2e.xml index 8b71da9..bd184bf 100644 --- a/test/e2e/e2e.xml +++ b/test/e2e/e2e.xml @@ -1,67 +1,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file