nomad icon indicating copy to clipboard operation
nomad copied to clipboard

`Constraint "computed class ineligible": 1 nodes excluded by filter` when Consul is not available

Open lgfa29 opened this issue 4 years ago • 5 comments

Nomad version

Nomad v1.3.2 (bf602974112964e9691729f3f0716ff2bcdb3b44)

Operating system and Environment details

macOS

Issue

When updating a job to add a Consul service definition the deployment will be be block with the message:

* Constraint "computed class ineligible": 1 nodes excluded by filter

Reproduction steps

  • Start a Nomad dev agent without Consul
  • Register the job with service commented out
  • Uncomment service and run the job again

Expected Result

When registering the job for the first time with service the error message is more descriptive of the problem:

* Constraint "${attr.consul.version} semver >= 1.7.0": 1 nodes excluded by filter

Actual Result

* Constraint "computed class ineligible": 1 nodes excluded by filter

Job file (if appropriate)

job "example" {
  datacenters = ["dc1"]

  group "cache" {
    network {
      port "db" {
        to = 6379
      }
    }

    #service {
    #  name     = "redis"
    #  port     = "db"
    #  provider = "consul"
    #}

    task "redis" {
      driver = "docker"

      config {
        image          = "redis:7"
        ports          = ["db"]
        auth_soft_fail = true
      }

      resources {
        cpu    = 500
        memory = 256
      }
    }
  }
}

lgfa29 avatar Jul 22 '22 18:07 lgfa29

Same issue here with all the newest Consul/Nomad versions and using the provider = "consul" in the service block.

When using nomad provider, it works just fine.

OS

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy

Linux rbp1 5.15.0-1029-raspi #31-Ubuntu SMP PREEMPT Sat Apr 22 12:26:40 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

Nomad

nomad --version
Nomad v1.5.6
BuildDate 2023-05-19T18:26:13Z
Revision 8af70885c02ab921dedbdf6bc406a1e886866f80

Consul:

consul --version
Consul v1.15.2
Revision 5e08e229
Build Date 2023-03-30T17:51:19Z
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
nomad job plan -verbose mysql.nomad.hcl
+ Job: "mysql-server"
+ AllAtOnce:  "false"
+ Dispatched: "false"
+ Name:       "mysql-server"
+ Namespace:  "default"
+ Priority:   "50"
+ Region:     "ams"
+ Stop:       "false"
+ Type:       "service"
+ Datacenters {
  + Datacenters: "home"
  }
+ Task Group: "mysql-server" (1 create)
  + Count: "1" (forces create)
  + Constraint {
    + LTarget: "${attr.consul.version}"
    + Operand: "semver"
    + RTarget: ">= 1.7.0"
    }
  + RestartPolicy {
    + Attempts: "10"
    + Delay:    "25000000000"
    + Interval: "300000000000"
    + Mode:     "delay"
    }
  + ReschedulePolicy {
    + Attempts:      "0"
    + Delay:         "30000000000"
    + DelayFunction: "exponential"
    + Interval:      "0"
    + MaxDelay:      "3600000000000"
    + Unlimited:     "true"
    }
  + EphemeralDisk {
    + Migrate: "false"
    + SizeMB:  "300"
    + Sticky:  "false"
    }
  + Update {
    + AutoPromote:      "false"
    + AutoRevert:       "false"
    + Canary:           "0"
    + HealthCheck:      "checks"
    + HealthyDeadline:  "300000000000"
    + MaxParallel:      "1"
    + MinHealthyTime:   "10000000000"
    + ProgressDeadline: "600000000000"
    }
  + Network {
      Hostname: ""
    + MBits:    "0"
      Mode:     ""
    + Static Port {
      + HostNetwork: "default"
      + Label:       "mysql"
      + To:          "3306"
      + Value:       "3306"
      }
    }
  + Service {
      Address:           ""
    + AddressMode:       "auto"
    + EnableTagOverride: "false"
    + Name:              "mysql-server"
    + Namespace:         "default"
    + OnUpdate:          "require_healthy"
    + PortLabel:         "mysql"
    + Provider:          "consul"
      TaskName:          ""
    }
  + Volume {
      AccessMode:     ""
      AttachmentMode: ""
    + Name:           "mysql"
    + PerAlloc:       "false"
    + ReadOnly:       "false"
    + Source:         "mysql"
    + Type:           "host"
    }
  + Task: "mysql-server" (forces create)
    + Driver:                   "docker"
    + Env[MYSQL_ROOT_PASSWORD]: "password"
    + KillTimeout:              "5000000000"
    + Leader:                   "false"
    + ShutdownDelay:            "0"
    + Config {
      + image:    "arm64v8/mysql:8"
      + ports[0]: "mysql"
      }
    + Resources {
      + CPU:         "500"
      + Cores:       "0"
      + DiskMB:      "0"
      + IOPS:        "0"
      + MemoryMB:    "1024"
      + MemoryMaxMB: "0"
      }
    + LogConfig {
      + Disabled:      "false"
      + MaxFileSizeMB: "10"
      + MaxFiles:      "10"
      }
    + Service {
        Address:           ""
      + AddressMode:       "auto"
      + EnableTagOverride: "false"
      + Name:              "mysql-server"
      + Namespace:         "default"
      + OnUpdate:          "require_healthy"
      + PortLabel:         "mysql"
      + Provider:          "consul"
      + TaskName:          "mysql-server"
      + Check {
          AddressMode:            ""
          Body:                   ""
          Command:                ""
        + Expose:                 "false"
        + FailuresBeforeCritical: "0"
          GRPCService:            ""
        + GRPCUseTLS:             "false"
          InitialStatus:          ""
        + Interval:               "10000000000"
          Method:                 ""
        + Name:                   "service: \"mysql-server\" check"
        + OnUpdate:               "require_healthy"
          Path:                   ""
          PortLabel:              ""
          Protocol:               ""
        + SuccessBeforePassing:   "0"
        + TLSSkipVerify:          "false"
        + TaskName:               "mysql-server"
        + Timeout:                "2000000000"
        + Type:                   "tcp"
        }
      }

Scheduler dry-run:
- WARNING: Failed to place all allocations.
  Task Group "mysql-server" (failed to place 1 allocation):
    * Constraint "${attr.consul.version} semver >= 1.7.0": 4 nodes excluded by filter

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

nomad job run -check-index 0 mysql.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.

flamarion avatar May 29 '23 18:05 flamarion

We got the same issue when upgrading from Consul 1.13.7 -> 1.13.8. Nomad is running 1.5.6. A workaround would be great!

maxramqvist avatar Jun 06 '23 10:06 maxramqvist

Hi @flamarion and @maxramqvist,

I think you may be running into https://github.com/hashicorp/nomad/issues/17302. Unfortunately there's currently no workaround available, but the Consul team has been able to fix the problem. Future releases of Nomad will also be able to work with Consul 1.13.8.

lgfa29 avatar Jun 07 '23 01:06 lgfa29

Hi @MylesDev 👋

This issue is more about improving the error message to be more explicit about why a node was filtered.

Expected Result

When registering the job for the first time with service the error message is more descriptive of the problem

If you're seeing Constraint "computed class ineligible": 1 nodes excluded by filter then it's likely you may have an actual problem.

Would you be able to open a new issue describe your environment (Consul and Nomad configs, sample job etc.) and the result you're receiving?

Thanks!

lgfa29 avatar Aug 11 '23 17:08 lgfa29

I am able to reproduce this. Just start Nomad clients before host with Consul/Nomad server starts. That is all.

EugenKon avatar Feb 27 '25 16:02 EugenKon