Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nomad plan output does not show as expected #20582

Open
caichao1103 opened this issue May 14, 2024 · 1 comment
Open

Nomad plan output does not show as expected #20582

caichao1103 opened this issue May 14, 2024 · 1 comment
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/jobspec type/bug

Comments

@caichao1103
Copy link

Nomad version

Nomad v1.7.7
BuildDate 2024-04-16T19:26:43Z
Revision 0f34c85

Issue

when run nomad job plan, the output is not as expected.

Reproduction steps

We have a nomad job, the main job hcl is as below.

group "sentry-beeper" {
        
    scaling {
      min = 2
      max = 3
    }

    network {
      port "http" {}
    }

    task "sentry-beeper" {

      env {
        GIN_MODE          = var.gin_mode
        OTEL_SERVICE_NAME = "${NOMAD_JOB_NAME}"
      }

      driver = "docker"

      kill_timeout = "30s"

      template {
        data        = var.config_yaml
        destination = "local/config.yaml"
      }

      config {
        image        = var.image
        network_mode = "host"
        args         = ["--config=/local/config.yaml"]
      }

      resources {
        cpu    = var.cpu
        memory = var.memory
      }

step1: did a nomad run with docker image = sentry-beeper:main-b142-20240509, successful. And got two alloc running
step2:
change docker image = sentry-beeper:main-b141-20240509 and then did a docker job plan

Expected Result

The plan output should display 2 create/destroy update, as my understand. However, it actually displayed 1 create/destroy update, 1 ignore

Actual Result

+/- Job: "sentry-beeper"
+/- Task Group: "sentry-beeper" (1 create/destroy update, 1 ignore)
  +/- Scaling {

      }
  +/- Task: "sentry-beeper" (forces create/destroy update)
    +/- Config {
          args[0]:      "--config=/local/config.yaml"
      +/- image:        "216927468640.dkr.ecr.cn-northwest-1.amazonaws.com.cn/infra/sentry-beeper:main-b142-20240509" => "216927468640.dkr.ecr.cn-northwest-1.amazonaws.com.cn/infra/sentry-beeper:main-b141-20240509"
          network_mode: "host"
        }

Scheduler dry-run:
- All tasks successfully allocated.

Job Modify Index: 2135838

Job file (if appropriate)

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

@jrasell jrasell added this to Needs Triage in Nomad - Community Issues Triage via automation May 14, 2024
@jrasell
Copy link
Member

jrasell commented May 17, 2024

Hi @caichao1103 and thanks for raising this issue. I have been able to reproduce this locally with a minimal jobspec as detailed below. It does look like when the run is triggered, both allocations go through the create/destroy cycle.

Job Spec:

variable "image" { default = "redis:7" }

job "example" {
  group "cache" {
    count = 2
    task "redis" {
      driver = "docker"
      config {
        image = var.image
      }
    }
  }
}

Plan diff when running nomad plan -var='image=redis:3.2' example.nomad.hcl

+/- Job: "example"
+/- Task Group: "cache" (1 create/destroy update, 1 ignore)
  +/- Task: "redis" (forces create/destroy update)
    +/- Config {
      +/- image: "redis:7" => "redis.3.2"
        }

Scheduler dry-run:
- All tasks successfully allocated.

Job Modify Index: 13
To submit the job with version verification run:

nomad job run -check-index 13 -var="image=redis:3.2" example.nomad.hcl

When running the job with the check-index flag, the job will only be run if the
job modify index given matches the server-side version. If the index has
changed, another user has modified the job and the plan's results are
potentially invalid.

@jrasell jrasell moved this from Needs Triage to Needs Roadmapping in Nomad - Community Issues Triage May 17, 2024
@jrasell jrasell added theme/jobspec stage/accepted Confirmed, and intend to work on. No timeline committment though. labels May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/jobspec type/bug
Projects
Development

No branches or pull requests

2 participants