mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 21:39:40 +02:00
feature(kubernetes): stack name made optional & add toggle to disable stack in kubernetes [EE-6170] (#10436)
This commit is contained in:
parent
44d66cc633
commit
7840e0bfe1
29 changed files with 305 additions and 47 deletions
|
@ -24,6 +24,8 @@ import (
|
|||
|
||||
type kubernetesFileStackUpdatePayload struct {
|
||||
StackFileContent string
|
||||
// Name of the stack
|
||||
StackName string
|
||||
}
|
||||
|
||||
type kubernetesGitStackUpdatePayload struct {
|
||||
|
@ -39,6 +41,9 @@ func (payload *kubernetesFileStackUpdatePayload) Validate(r *http.Request) error
|
|||
if govalidator.IsNull(payload.StackFileContent) {
|
||||
return errors.New("Invalid stack file content")
|
||||
}
|
||||
if govalidator.IsNull(payload.StackName) {
|
||||
return errors.New("Invalid stack name")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -114,6 +119,14 @@ func (handler *Handler) updateKubernetesStack(r *http.Request, stack *portainer.
|
|||
return httperror.InternalServerError("Failed to persist deployment file in a temp directory", err)
|
||||
}
|
||||
|
||||
if payload.StackName != stack.Name {
|
||||
stack.Name = payload.StackName
|
||||
err := handler.DataStore.Stack().Update(stack.ID, stack)
|
||||
if err != nil {
|
||||
return httperror.InternalServerError("Failed to update stack name", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh ECR registry secret if needed
|
||||
// RefreshEcrSecret method checks if the namespace has any ECR registry
|
||||
// otherwise return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue