|
|
@ -13,6 +13,7 @@ import (
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
|
|
|
"github.com/portainer/portainer/api/git/update"
|
|
|
|
"github.com/portainer/portainer/api/git/update"
|
|
|
|
"github.com/portainer/portainer/api/internal/endpointutils"
|
|
|
|
"github.com/portainer/portainer/api/internal/endpointutils"
|
|
|
|
|
|
|
|
"github.com/portainer/portainer/api/internal/registryutils"
|
|
|
|
k "github.com/portainer/portainer/api/kubernetes"
|
|
|
|
k "github.com/portainer/portainer/api/kubernetes"
|
|
|
|
"github.com/portainer/portainer/api/stacks/deployments"
|
|
|
|
"github.com/portainer/portainer/api/stacks/deployments"
|
|
|
|
"github.com/portainer/portainer/api/stacks/stackbuilders"
|
|
|
|
"github.com/portainer/portainer/api/stacks/stackbuilders"
|
|
|
@ -176,6 +177,14 @@ func (handler *Handler) createKubernetesStackFromFileContent(w http.ResponseWrit
|
|
|
|
handler.KubernetesDeployer,
|
|
|
|
handler.KubernetesDeployer,
|
|
|
|
user)
|
|
|
|
user)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Refresh ECR registry secret if needed
|
|
|
|
|
|
|
|
// RefreshEcrSecret method checks if the namespace has any ECR registry
|
|
|
|
|
|
|
|
// otherwise return nil
|
|
|
|
|
|
|
|
cli, err := handler.KubernetesClientFactory.GetKubeClient(endpoint)
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
|
|
|
|
registryutils.RefreshEcrSecret(cli, endpoint, handler.DataStore, payload.Namespace)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
stackBuilderDirector := stackbuilders.NewStackBuilderDirector(k8sStackBuilder)
|
|
|
|
stackBuilderDirector := stackbuilders.NewStackBuilderDirector(k8sStackBuilder)
|
|
|
|
_, httpErr := stackBuilderDirector.Build(&stackPayload, endpoint)
|
|
|
|
_, httpErr := stackBuilderDirector.Build(&stackPayload, endpoint)
|
|
|
|
if httpErr != nil {
|
|
|
|
if httpErr != nil {
|
|
|
|