2018-06-11 20:33:18 +00:00
|
|
|
package consul
|
2017-02-01 00:43:57 +00:00
|
|
|
|
|
|
|
import (
|
2019-11-27 21:41:45 +00:00
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
2017-02-01 00:43:57 +00:00
|
|
|
)
|
|
|
|
|
2019-11-27 21:41:45 +00:00
|
|
|
// TokenDeriverFunc takes an allocation and a set of tasks and derives a
|
|
|
|
// service identity token for each. Requests go through nomad server.
|
|
|
|
type TokenDeriverFunc func(*structs.Allocation, []string) (map[string]string, error)
|
|
|
|
|
|
|
|
// ServiceIdentityAPI is the interface the Nomad Client uses to request Consul
|
|
|
|
// Service Identity tokens through Nomad Server.
|
2020-03-27 20:07:55 +00:00
|
|
|
//
|
|
|
|
// ACL requirements
|
|
|
|
// - acl:write (used by Server only)
|
2019-11-27 21:41:45 +00:00
|
|
|
type ServiceIdentityAPI interface {
|
|
|
|
// DeriveSITokens contacts the nomad server and requests consul service
|
|
|
|
// identity tokens be generated for tasks in the allocation.
|
|
|
|
DeriveSITokens(alloc *structs.Allocation, tasks []string) (map[string]string, error)
|
|
|
|
}
|
2020-09-04 17:50:11 +00:00
|
|
|
|
|
|
|
// SupportedProxiesAPI is the interface the Nomad Client uses to request from
|
|
|
|
// Consul the set of supported proxied to use for Consul Connect.
|
|
|
|
//
|
|
|
|
// No ACL requirements
|
|
|
|
type SupportedProxiesAPI interface {
|
|
|
|
Proxies() (map[string][]string, error)
|
|
|
|
}
|