github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/nomad/structs/connect.go (about) 1 package structs 2 3 // ConsulConfigEntries represents Consul ConfigEntry definitions from a job. 4 type ConsulConfigEntries struct { 5 Ingress map[string]*ConsulIngressConfigEntry 6 Terminating map[string]*ConsulTerminatingConfigEntry 7 // Mesh later 8 } 9 10 // ConfigEntries accumulates the Consul Configuration Entries defined in task groups 11 // of j. 12 func (j *Job) ConfigEntries() *ConsulConfigEntries { 13 entries := &ConsulConfigEntries{ 14 Ingress: make(map[string]*ConsulIngressConfigEntry), 15 Terminating: make(map[string]*ConsulTerminatingConfigEntry), 16 // Mesh later 17 } 18 19 for _, tg := range j.TaskGroups { 20 for _, service := range tg.Services { 21 if service.Connect.IsGateway() { 22 gateway := service.Connect.Gateway 23 if ig := gateway.Ingress; ig != nil { 24 entries.Ingress[service.Name] = ig 25 } else if tg := gateway.Terminating; tg != nil { 26 entries.Terminating[service.Name] = tg 27 } // mesh later 28 } 29 } 30 } 31 32 return entries 33 }