add serviceID to leaf cert request

pull/6413/head
tradel 2019-08-27 14:12:22 -07:00
parent a4312d2e6e
commit 672e181399
1 changed files with 14 additions and 1 deletions

View File

@ -1249,8 +1249,21 @@ func (s *HTTPServer) AgentConnectCALeafCert(resp http.ResponseWriter, req *http.
// not the ID of the service instance.
serviceName := strings.TrimPrefix(req.URL.Path, "/v1/agent/connect/ca/leaf/")
serviceID := serviceName
allServices := s.agent.State.Services()
for _, service := range allServices {
if service.Service == serviceName {
serviceID = service.ID
break
}
}
args := cachetype.ConnectCALeafRequest{
Service: serviceName, // Need name not ID
Service: serviceName, // Need name not ID
ServiceID: serviceID,
Datacenter: s.agent.config.Datacenter,
Domain: s.agent.config.DNSDomain,
NodeName: s.agent.config.NodeName,
}
var qOpts structs.QueryOptions