mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 07:19:41 +02:00
fix(k8s): file content overridden when deployment failed with compose format EE-1548
This commit is contained in:
parent
ee213a6c4a
commit
47c32df77a
1 changed files with 6 additions and 7 deletions
|
@ -70,13 +70,6 @@ func (handler *Handler) updateKubernetesStack(r *http.Request, stack *portainer.
|
||||||
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid request payload", Err: err}
|
return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid request payload", Err: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
stackFolder := strconv.Itoa(int(stack.ID))
|
|
||||||
projectPath, err := handler.FileService.StoreStackFileFromBytes(stackFolder, stack.EntryPoint, []byte(payload.StackFileContent))
|
|
||||||
if err != nil {
|
|
||||||
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to persist Kubernetes manifest file on disk", Err: err}
|
|
||||||
}
|
|
||||||
stack.ProjectPath = projectPath
|
|
||||||
|
|
||||||
_, err = handler.deployKubernetesStack(r, endpoint, payload.StackFileContent, stack.IsComposeFormat, stack.Namespace, k.KubeAppLabels{
|
_, err = handler.deployKubernetesStack(r, endpoint, payload.StackFileContent, stack.IsComposeFormat, stack.Namespace, k.KubeAppLabels{
|
||||||
StackID: int(stack.ID),
|
StackID: int(stack.ID),
|
||||||
Name: stack.Name,
|
Name: stack.Name,
|
||||||
|
@ -88,5 +81,11 @@ func (handler *Handler) updateKubernetesStack(r *http.Request, stack *portainer.
|
||||||
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to deploy Kubernetes stack via file content", Err: err}
|
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to deploy Kubernetes stack via file content", Err: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stackFolder := strconv.Itoa(int(stack.ID))
|
||||||
|
_, err = handler.FileService.StoreStackFileFromBytes(stackFolder, stack.EntryPoint, []byte(payload.StackFileContent))
|
||||||
|
if err != nil {
|
||||||
|
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to persist Kubernetes manifest file on disk", Err: err}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue