mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
chore(kompose): remove the code EE-4917 (#12003)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
This commit is contained in:
parent
ac4b129195
commit
6e7a42727a
14 changed files with 61 additions and 168 deletions
|
@ -34,7 +34,6 @@ func createStackPayloadFromK8sFileContentPayload(name, namespace, fileContent st
|
|||
StackName: name,
|
||||
Namespace: namespace,
|
||||
StackFileContent: fileContent,
|
||||
ComposeFormat: composeFormat,
|
||||
FromAppTemplate: fromAppTemplate,
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +66,6 @@ func createStackPayloadFromK8sGitPayload(name, repoUrl, repoReference, repoUsern
|
|||
TLSSkipVerify: repoSkipSSLVerify,
|
||||
},
|
||||
Namespace: namespace,
|
||||
ComposeFormat: composeFormat,
|
||||
ManifestFile: manifest,
|
||||
AdditionalFiles: additionalFiles,
|
||||
AutoUpdate: autoUpdate,
|
||||
|
@ -83,10 +81,9 @@ type kubernetesManifestURLDeploymentPayload struct {
|
|||
|
||||
func createStackPayloadFromK8sUrlPayload(name, namespace, manifestUrl string, composeFormat bool) stackbuilders.StackPayload {
|
||||
return stackbuilders.StackPayload{
|
||||
StackName: name,
|
||||
Namespace: namespace,
|
||||
ManifestURL: manifestUrl,
|
||||
ComposeFormat: composeFormat,
|
||||
StackName: name,
|
||||
Namespace: namespace,
|
||||
ManifestURL: manifestUrl,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,22 +99,23 @@ func (payload *kubernetesGitDeploymentPayload) Validate(r *http.Request) error {
|
|||
if govalidator.IsNull(payload.RepositoryURL) || !govalidator.IsURL(payload.RepositoryURL) {
|
||||
return errors.New("Invalid repository URL. Must correspond to a valid URL format")
|
||||
}
|
||||
|
||||
if payload.RepositoryAuthentication && govalidator.IsNull(payload.RepositoryPassword) {
|
||||
return errors.New("Invalid repository credentials. Password must be specified when authentication is enabled")
|
||||
}
|
||||
|
||||
if govalidator.IsNull(payload.ManifestFile) {
|
||||
return errors.New("Invalid manifest file in repository")
|
||||
}
|
||||
if err := update.ValidateAutoUpdateSettings(payload.AutoUpdate); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
return update.ValidateAutoUpdateSettings(payload.AutoUpdate)
|
||||
}
|
||||
|
||||
func (payload *kubernetesManifestURLDeploymentPayload) Validate(r *http.Request) error {
|
||||
if govalidator.IsNull(payload.ManifestURL) || !govalidator.IsURL(payload.ManifestURL) {
|
||||
return errors.New("Invalid manifest URL")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -171,9 +169,8 @@ func (handler *Handler) createKubernetesStackFromFileContent(w http.ResponseWrit
|
|||
}
|
||||
|
||||
stackBuilderDirector := stackbuilders.NewStackBuilderDirector(k8sStackBuilder)
|
||||
_, httpErr := stackBuilderDirector.Build(&stackPayload, endpoint)
|
||||
if httpErr != nil {
|
||||
return httpErr
|
||||
if _, err := stackBuilderDirector.Build(&stackPayload, endpoint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp := &createKubernetesStackResponse{
|
||||
|
@ -213,13 +210,11 @@ func (handler *Handler) createKubernetesStackFromGitRepository(w http.ResponseWr
|
|||
return httperror.InternalServerError("Unable to load user information from the database", err)
|
||||
}
|
||||
|
||||
//make sure the webhook ID is unique
|
||||
// Make sure the webhook ID is unique
|
||||
if payload.AutoUpdate != nil && payload.AutoUpdate.Webhook != "" {
|
||||
isUnique, err := handler.checkUniqueWebhookID(payload.AutoUpdate.Webhook)
|
||||
if err != nil {
|
||||
if isUnique, err := handler.checkUniqueWebhookID(payload.AutoUpdate.Webhook); err != nil {
|
||||
return httperror.InternalServerError("Unable to check for webhook ID collision", err)
|
||||
}
|
||||
if !isUnique {
|
||||
} else if !isUnique {
|
||||
return httperror.Conflict(fmt.Sprintf("Webhook ID: %s already exists", payload.AutoUpdate.Webhook), stackutils.ErrWebhookIDAlreadyExists)
|
||||
}
|
||||
}
|
||||
|
@ -247,16 +242,13 @@ func (handler *Handler) createKubernetesStackFromGitRepository(w http.ResponseWr
|
|||
user)
|
||||
|
||||
stackBuilderDirector := stackbuilders.NewStackBuilderDirector(k8sStackBuilder)
|
||||
_, httpErr := stackBuilderDirector.Build(&stackPayload, endpoint)
|
||||
if httpErr != nil {
|
||||
return httpErr
|
||||
if _, err := stackBuilderDirector.Build(&stackPayload, endpoint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp := &createKubernetesStackResponse{
|
||||
return response.JSON(w, &createKubernetesStackResponse{
|
||||
Output: k8sStackBuilder.GetResponse(),
|
||||
}
|
||||
|
||||
return response.JSON(w, resp)
|
||||
})
|
||||
}
|
||||
|
||||
// @id StackCreateKubernetesUrl
|
||||
|
@ -296,16 +288,13 @@ func (handler *Handler) createKubernetesStackFromManifestURL(w http.ResponseWrit
|
|||
user)
|
||||
|
||||
stackBuilderDirector := stackbuilders.NewStackBuilderDirector(k8sStackBuilder)
|
||||
_, httpErr := stackBuilderDirector.Build(&stackPayload, endpoint)
|
||||
if httpErr != nil {
|
||||
return httpErr
|
||||
if _, err := stackBuilderDirector.Build(&stackPayload, endpoint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
resp := &createKubernetesStackResponse{
|
||||
return response.JSON(w, &createKubernetesStackResponse{
|
||||
Output: k8sStackBuilder.GetResponse(),
|
||||
}
|
||||
|
||||
return response.JSON(w, resp)
|
||||
})
|
||||
}
|
||||
|
||||
func (handler *Handler) deployKubernetesStack(userID portainer.UserID, endpoint *portainer.Endpoint, stack *portainer.Stack, appLabels k.KubeAppLabels) (string, error) {
|
||||
|
@ -320,8 +309,7 @@ func (handler *Handler) deployKubernetesStack(userID portainer.UserID, endpoint
|
|||
return "", errors.Wrap(err, "failed to create temp kub deployment files")
|
||||
}
|
||||
|
||||
err = k8sDeploymentConfig.Deploy()
|
||||
if err != nil {
|
||||
if err := k8sDeploymentConfig.Deploy(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue