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

chore(nomad): remove Nomad code EE-7234 (#11980)
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-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:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run

This commit is contained in:
andres-portainer 2024-06-28 08:54:44 -03:00 committed by GitHub
parent 19fa40286a
commit e1648425ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 11 additions and 41 deletions

View file

@ -78,7 +78,7 @@ func (payload *edgeStackFromFileUploadPayload) Validate(r *http.Request) error {
// @param Name formData string true "Name of the stack"
// @param file formData file true "Content of the Stack file"
// @param EdgeGroups formData string true "JSON stringified array of Edge Groups ids"
// @param DeploymentType formData int true "deploy type 0 - 'compose', 1 - 'kubernetes', 2 - 'nomad'"
// @param DeploymentType formData int true "deploy type 0 - 'compose', 1 - 'kubernetes'"
// @param Registries formData string false "JSON stringified array of Registry ids to use for this stack"
// @param UseManifestNamespaces formData bool false "Uses the manifest's namespaces instead of the default one, relevant only for kube environments"
// @param PrePullImage formData bool false "Pre Pull image"

View file

@ -4,19 +4,19 @@ import (
"context"
"os"
dockerclient "github.com/portainer/portainer/api/docker/client"
"github.com/docker/docker/client"
"github.com/pkg/errors"
dockerclient "github.com/portainer/portainer/api/docker/client"
"github.com/rs/zerolog/log"
)
const (
PodmanMode = "PODMAN"
KubernetesServiceHost = "KUBERNETES_SERVICE_HOST"
NomadJobName = "NOMAD_JOB_NAME"
)
// ContainerPlatform represent the platform on which the container is running (Docker, Kubernetes, Nomad)
// ContainerPlatform represent the platform on which the container is running (Docker, Kubernetes)
type ContainerPlatform string
const (
@ -28,8 +28,6 @@ const (
PlatformKubernetes = ContainerPlatform("Kubernetes")
// PlatformPodman represent the Podman platform (Standalone)
PlatformPodman = ContainerPlatform("Podman")
// PlatformNomad represent the Nomad platform (Standalone)
PlatformNomad = ContainerPlatform("Nomad")
)
// DetermineContainerPlatform will check for the existence of the PODMAN_MODE
@ -47,11 +45,6 @@ func DetermineContainerPlatform() (ContainerPlatform, error) {
return PlatformKubernetes, nil
}
nomadJobName := os.Getenv(NomadJobName)
if nomadJobName != "" {
return PlatformNomad, nil
}
if !isRunningInContainer() {
return "", nil
}
@ -65,9 +58,8 @@ func DetermineContainerPlatform() (ContainerPlatform, error) {
info, err := dockerCli.Info(context.Background())
if err != nil {
if client.IsErrConnectionFailed(err) {
log.Warn().
Err(err).
Msg("failed to retrieve docker info")
log.Warn().Err(err).Msg("failed to retrieve docker info")
return "", nil
}
@ -85,5 +77,6 @@ func DetermineContainerPlatform() (ContainerPlatform, error) {
// this code is taken from https://github.com/moby/libnetwork/blob/master/drivers/bridge/setup_bridgenetfiltering.go
func isRunningInContainer() bool {
_, err := os.Stat("/.dockerenv")
return !os.IsNotExist(err)
}