1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

fix(namespaces): remove the stacks from the data store when deleting their corresponding Kubernetes namespace EE-1872 (#5885)

* fix(namespaces): remove the stacks from the data store when deleting their corresponding Kubernetes namespace EE-1872

* add endpoint ID checking

Co-authored-by: andres-portainer <andres-portainer@users.noreply.github.com>
Co-authored-by: ArrisLee <arris_li@hotmail.com>
This commit is contained in:
andres-portainer 2021-10-14 19:15:04 -03:00 committed by GitHub
parent f544d4447c
commit dfe0b3f69d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,5 +46,19 @@ func (transport *baseTransport) proxyNamespaceDeleteOperation(request *http.Requ
}
}
}
stacks, err := transport.dataStore.Stack().Stacks()
if err != nil {
return nil, err
}
for _, s := range stacks {
if s.Namespace == namespace && s.EndpointID == transport.endpoint.ID {
if err := transport.dataStore.Stack().DeleteStack(s.ID); err != nil {
return nil, err
}
}
}
return transport.executeKubernetesRequest(request)
}