Skip to content

Commit

Permalink
Merge pull request #12368 from hashicorp/f-1.3-boogie-nights
Browse files Browse the repository at this point in the history
service discovery: add initial MVP implementation
  • Loading branch information
jrasell committed Mar 25, 2022
2 parents a156ca7 + dfe1854 commit 443cea1
Show file tree
Hide file tree
Showing 120 changed files with 11,260 additions and 2,223 deletions.
1 change: 1 addition & 0 deletions .semgrep/rpc_endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ rules:
# Pattern used by endpoints called exclusively between agents
# (server -> server or client -> server)
- pattern-not-inside: |
...
... := validateTLSCertificateLevel(...)
...
if done, err := $A.$B.forward($METHOD, ...); done {
Expand Down
8 changes: 8 additions & 0 deletions api/allocations.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ func (a *Allocations) Signal(alloc *Allocation, q *QueryOptions, task, signal st
return err
}

// Services is used to return a list of service registrations associated to the
// specified allocID.
func (a *Allocations) Services(allocID string, q *QueryOptions) ([]*ServiceRegistration, *QueryMeta, error) {
var resp []*ServiceRegistration
qm, err := a.client.query("/v1/allocation/"+allocID+"/services", &resp, q)
return resp, qm, err
}

// Allocation is used for serialization of allocations.
type Allocation struct {
ID string
Expand Down
4 changes: 4 additions & 0 deletions api/allocations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,7 @@ func TestAllocations_ShouldMigrate(t *testing.T) {
require.False(t, DesiredTransition{}.ShouldMigrate())
require.False(t, DesiredTransition{Migrate: boolToPtr(false)}.ShouldMigrate())
}

func TestAllocations_Services(t *testing.T) {
// TODO(jrasell) add tests once registration process is in place.
}
Loading

0 comments on commit 443cea1

Please sign in to comment.