From 80595a1332de79fd2c519c51cdc9d1ab69e5fb88 Mon Sep 17 00:00:00 2001 From: junqian Date: Thu, 21 Oct 2021 15:36:29 +0800 Subject: [PATCH] fix for map --- pkg/tapp/controller.go | 5 +++-- pkg/tapp/instance.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/tapp/controller.go b/pkg/tapp/controller.go index ee51694..fb25cce 100644 --- a/pkg/tapp/controller.go +++ b/pkg/tapp/controller.go @@ -393,16 +393,17 @@ func (c *Controller) Sync(key string) error { if err != nil { return err } - tapp, err := c.tappLister.TApps(namespace).Get(name) + curTapp, err := c.tappLister.TApps(namespace).Get(name) if errors.IsNotFound(err) { klog.Infof("TApp has been deleted %v", key) return nil } if err != nil { - klog.Errorf("Unable to retrieve tapp %s from store: %v", util.GetTAppFullName(tapp), err) + klog.Errorf("Unable to retrieve tapp %s from store: %v", util.GetTAppFullName(curTapp), err) return err } + tapp := curTapp.DeepCopy() err = c.preprocessTApp(tapp) if err != nil { klog.Errorf("Failed to preprocess tapp %s: %v", util.GetTAppFullName(tapp), err) diff --git a/pkg/tapp/instance.go b/pkg/tapp/instance.go index 9cee0e9..80939e8 100644 --- a/pkg/tapp/instance.go +++ b/pkg/tapp/instance.go @@ -442,7 +442,7 @@ func (p *ApiServerInstanceClient) Update(current *Instance, expected *Instance) var err, e error pod := current.pod - for i, cp := 0, current.pod; i <= updateRetries; i++ { + for i, cp := 0, current.pod.DeepCopy(); i <= updateRetries; i++ { mergePod(cp, expected.pod) klog.V(2).Infof("Updating pod %s, pod meta:%+v, pod spec:%+v", getPodFullName(cp), cp.ObjectMeta, cp.Spec)