fix: fix interrupt proxy mode but not rollout deploy bug

This commit is contained in:
fengcaiwen
2025-10-21 23:47:57 +08:00
committed by naison
parent cc1f08033e
commit e85b8b7451
2 changed files with 10 additions and 4 deletions

View File

@@ -189,12 +189,16 @@ func (c *ConnectOptions) CreateRemoteInboundPod(ctx context.Context, namespace s
if err != nil {
return
}
c.proxyWorkloads.Add(c.Namespace, &Proxy{
var mapper *Mapper
if util.IsK8sService(object) {
mapper = NewMapper(c.clientset, namespace, labels.SelectorFromSet(templateSpec.Labels).String(), headers, workload)
}
c.proxyWorkloads.Add(&Proxy{
headers: headers,
portMap: portMap,
workload: workload,
namespace: namespace,
portMapper: util.If(util.IsK8sService(object), NewMapper(c.clientset, namespace, labels.SelectorFromSet(templateSpec.Labels).String(), headers, workload), nil),
portMapper: mapper,
})
nodeID := fmt.Sprintf("%s.%s", object.Mapping.Resource.GroupResource().String(), object.Name)
@@ -212,6 +216,9 @@ func (c *ConnectOptions) CreateRemoteInboundPod(ctx context.Context, namespace s
plog.G(ctx).Errorf("Injecting inbound sidecar for %s in namespace %s failed: %s", workload, namespace, err.Error())
return err
}
if mapper != nil {
go mapper.Run(c.Namespace)
}
}
return
}

View File

@@ -47,8 +47,7 @@ func (l *ProxyList) Remove(ns, workload string) {
}
}
func (l *ProxyList) Add(managerNamespace string, proxy *Proxy) {
go proxy.portMapper.Run(managerNamespace)
func (l *ProxyList) Add(proxy *Proxy) {
*l = append(*l, proxy)
}