Hello!
I want to add a new variable in the Port
struct, so that when I use, the port is static ( by default it is dynamic ), but without to use ‘static’ in port stanza. Can someone tell me where I can modify to get this?
Hello!
I want to add a new variable in the Port
struct, so that when I use, the port is static ( by default it is dynamic ), but without to use ‘static’ in port stanza. Can someone tell me where I can modify to get this?
Hi. I do not understand the goal. To make it static, then add static.
The port struct is defined at nomad/api/resources.go at main · hashicorp/nomad · GitHub , where it is kind of mixed
So the ports with static go into ReservedPorts field in NetworkResource nomad/api/resources.go at main · hashicorp/nomad · GitHub , the others go into dynamic, like here nomad/jobspec2/parse_job.go at main · hashicorp/nomad · GitHub (or somewhere in api, no idea where) . There is a json example in JSON Job Specification - HTTP API | Nomad | HashiCorp Developer .
Bottom line, to modify how ports are assigned, you would have to modify the scheduler. That will be somewhere way deeper. Good luck.