mirror of https://github.com/portainer/portainer
fix(api/endpoint): refresh kubernetes client cache on endpoint update (#6752)
parent
f707c90cd3
commit
aac2aca912
|
@ -257,6 +257,7 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *
|
||||||
}
|
}
|
||||||
|
|
||||||
if payload.URL != nil || payload.TLS != nil || endpoint.Type == portainer.AzureEnvironment {
|
if payload.URL != nil || payload.TLS != nil || endpoint.Type == portainer.AzureEnvironment {
|
||||||
|
handler.ProxyManager.DeleteEndpointProxy(endpoint.ID)
|
||||||
_, err = handler.ProxyManager.CreateAndRegisterEndpointProxy(endpoint)
|
_, err = handler.ProxyManager.CreateAndRegisterEndpointProxy(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to register HTTP proxy for the environment", err}
|
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to register HTTP proxy for the environment", err}
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (manager *Manager) GetEndpointProxy(endpoint *portainer.Endpoint) http.Hand
|
||||||
|
|
||||||
// DeleteEndpointProxy deletes the proxy associated to a key
|
// DeleteEndpointProxy deletes the proxy associated to a key
|
||||||
// and cleans the k8s environment(endpoint) client cache. DeleteEndpointProxy
|
// and cleans the k8s environment(endpoint) client cache. DeleteEndpointProxy
|
||||||
// is currently only called for edge connection clean up.
|
// is currently only called for edge connection clean up and when endpoint is updated
|
||||||
func (manager *Manager) DeleteEndpointProxy(endpointID portainer.EndpointID) {
|
func (manager *Manager) DeleteEndpointProxy(endpointID portainer.EndpointID) {
|
||||||
manager.endpointProxies.Remove(fmt.Sprint(endpointID))
|
manager.endpointProxies.Remove(fmt.Sprint(endpointID))
|
||||||
manager.k8sClientFactory.RemoveKubeClient(endpointID)
|
manager.k8sClientFactory.RemoveKubeClient(endpointID)
|
||||||
|
|
Loading…
Reference in New Issue