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

fix(registry): sync config on change [EE-5460] (#8955)

This commit is contained in:
Chaim Lev-Ari 2023-05-30 10:47:44 +07:00 committed by GitHub
parent d803d5f821
commit 61b568a738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 16 deletions

View file

@ -140,6 +140,8 @@ func (handler *Handler) registryUpdate(w http.ResponseWriter, r *http.Request) *
}
}
registry.ManagementConfiguration = syncConfig(registry)
if payload.URL != nil {
shouldUpdateSecrets = shouldUpdateSecrets || (*payload.URL != registry.URL)
@ -183,6 +185,21 @@ func (handler *Handler) registryUpdate(w http.ResponseWriter, r *http.Request) *
return response.JSON(w, registry)
}
func syncConfig(registry *portainer.Registry) *portainer.RegistryManagementConfiguration {
config := registry.ManagementConfiguration
if config == nil {
config = &portainer.RegistryManagementConfiguration{}
}
config.Authentication = registry.Authentication
config.Username = registry.Username
config.Password = registry.Password
config.Ecr = registry.Ecr
config.Type = registry.Type
return config
}
func (handler *Handler) updateEndpointRegistryAccess(endpoint *portainer.Endpoint, registry *portainer.Registry, endpointAccess portainer.RegistryAccessPolicies) error {
cli, err := handler.K8sClientFactory.GetKubeClient(endpoint)