nomad icon indicating copy to clipboard operation
nomad copied to clipboard

Nomad service parsing silently "corrects errors" without failing

Open fredrikhgrelland opened this issue 7 years ago • 1 comments

nomad version: 0.10.0

job extract:

job "presto" {
....
group "worker" {
    count = 1
    service {
      port = "https"
      connect {
        sidecar_service {
          proxy {
            upstreams {
              destination_name = "hive-connect-metastore"
              local_bind_port = 9083
            }
          }
        }
      }
    }
    network {
      mode = "bridge"
      # This exposes a port externaly
      port "https" {}
    }
    task "db" {
      driver = "docker"
...
      }
      service {
        name = "${NOMAD_JOB_NAME}-${NOMAD_GROUP_NAME}-${NOMAD_TASK_NAME}-${NOMAD_ALLOC_INDEX}"
        connect {
          sidecar_service {
            proxy {
              upstreams {
                destination_name = "hive-connect-metastores"
                local_bind_port = 9085
              }
            }
          }
        }
      }
  }
}

While getting to grips with nomad's consul connect implementation I came across this code path. Edit: Which seemingly deletes the connect part? https://github.com/hashicorp/nomad/blob/3e38891b88e089b57093efbdcbecd17fddaee001/jobspec/parse_service.go#L63 I copied the connect spec to a different task group, but instead of adding it to the group, I added it to a service stanza in the task. It took a good while to understand why none of my changes seemingly would take effect.

Expected outcome: An error message that connect stanzas are not allowed inside of a task.

  • Edited to add context.

fredrikhgrelland avatar Nov 26 '19 07:11 fredrikhgrelland

Hi @fredrikhgrelland Thanks for submitting this issue! That's definitely a place where our jobspec validation can be improved. Adding this to our Connect project work.

tgross avatar Nov 26 '19 13:11 tgross