Adding ability to add named ports to job configuration
This commit is contained in:
parent
7aa6c07c66
commit
403abcd684
1 changed files with 16 additions and 2 deletions
18
job.go
18
job.go
|
@ -161,13 +161,27 @@ func (a *Job) AddLabel(key string, value string) *Job {
|
|||
return a
|
||||
}
|
||||
|
||||
// Adds a request for a number of ports to the job configuration. These are random ports as it's
|
||||
// Add a named port to the job configuration These are random ports as it's
|
||||
// not currently possible to request specific ports using Aurora.
|
||||
func (a *Job) AddNamedPorts(names ...string) *Job {
|
||||
a.portCount += len(names)
|
||||
for _, name := range names {
|
||||
a.jobConfig.TaskConfig.Resources[&aurora.Resource{NamedPort: &name}] = true
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
|
||||
// Adds a request for a number of ports to the job configuration. The names chosen for these ports
|
||||
// will be org.apache.aurora.portX, where X is the current port count for the job configuration
|
||||
// starting at 0. These are random ports as it's not currently possible to request
|
||||
// specific ports using Aurora.
|
||||
func (a *Job) AddPorts(num int) *Job {
|
||||
start := a.portCount
|
||||
a.portCount += num
|
||||
for i := start; i < a.portCount; i++ {
|
||||
portName := "port" + strconv.Itoa(i)
|
||||
portName := "gorealis.port" + strconv.Itoa(i)
|
||||
a.jobConfig.TaskConfig.Resources[&aurora.Resource{NamedPort: &portName}] = true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue