mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Merge pull request #4329 from smarterclayton/bindings_incorrectly_removed
Bindings were not correctly removed across namespaces on pod update and delete
This commit is contained in:
@@ -264,8 +264,9 @@ func (r *Registry) UpdatePod(ctx api.Context, pod *api.Pod) error {
|
||||
return r.AtomicUpdate(containerKey, &api.BoundPods{}, true, func(in runtime.Object) (runtime.Object, error) {
|
||||
boundPods := in.(*api.BoundPods)
|
||||
for ix := range boundPods.Items {
|
||||
if boundPods.Items[ix].Name == pod.Name {
|
||||
boundPods.Items[ix].Spec = pod.Spec
|
||||
item := &boundPods.Items[ix]
|
||||
if item.Name == pod.Name && item.Namespace == pod.Namespace {
|
||||
item.Spec = pod.Spec
|
||||
return boundPods, nil
|
||||
}
|
||||
}
|
||||
@@ -303,9 +304,9 @@ func (r *Registry) DeletePod(ctx api.Context, podID string) error {
|
||||
pods := in.(*api.BoundPods)
|
||||
newPods := make([]api.BoundPod, 0, len(pods.Items))
|
||||
found := false
|
||||
for _, pod := range pods.Items {
|
||||
if pod.Name != podID {
|
||||
newPods = append(newPods, pod)
|
||||
for _, item := range pods.Items {
|
||||
if item.Name != pod.Name || item.Namespace != pod.Namespace {
|
||||
newPods = append(newPods, item)
|
||||
} else {
|
||||
found = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user