client: hookup service wrapper for use within client hooks.

This commit is contained in:
James Rasell
2022-03-21 10:29:57 +01:00
parent 131cda2824
commit f0be952cb5
19 changed files with 566 additions and 116 deletions

View File

@@ -14,8 +14,6 @@ import (
"sync"
"time"
"github.com/hashicorp/nomad/lib/cpuset"
metrics "github.com/armon/go-metrics"
consulapi "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/lib"
@@ -28,6 +26,7 @@ import (
"github.com/hashicorp/nomad/command/agent/event"
"github.com/hashicorp/nomad/helper/pluginutils/loader"
"github.com/hashicorp/nomad/helper/uuid"
"github.com/hashicorp/nomad/lib/cpuset"
"github.com/hashicorp/nomad/nomad"
"github.com/hashicorp/nomad/nomad/deploymentwatcher"
"github.com/hashicorp/nomad/nomad/structs"
@@ -891,7 +890,6 @@ func (a *Agent) setupClient() error {
if !a.config.Client.Enabled {
return nil
}
// Setup the configuration
conf, err := a.clientConfig()
if err != nil {

View File

@@ -15,6 +15,8 @@ import (
"github.com/hashicorp/nomad/client/config"
"github.com/hashicorp/nomad/client/devicemanager"
"github.com/hashicorp/nomad/client/pluginmanager/drivermanager"
regMock "github.com/hashicorp/nomad/client/serviceregistration/mock"
"github.com/hashicorp/nomad/client/serviceregistration/wrapper"
"github.com/hashicorp/nomad/client/state"
"github.com/hashicorp/nomad/client/vaultclient"
"github.com/hashicorp/nomad/command/agent/consul"
@@ -93,6 +95,7 @@ func TestConsul_Integration(t *testing.T) {
Name: "httpd",
PortLabel: "http",
Tags: []string{"nomad", "test", "http"},
Provider: structs.ServiceProviderConsul,
Checks: []*structs.ServiceCheck{
{
Name: "httpd-http-check",
@@ -114,6 +117,7 @@ func TestConsul_Integration(t *testing.T) {
{
Name: "httpd2",
PortLabel: "http",
Provider: structs.ServiceProviderConsul,
Tags: []string{
"test",
// Use URL-unfriendly tags to test #3620
@@ -162,6 +166,7 @@ func TestConsul_Integration(t *testing.T) {
DeviceManager: devicemanager.NoopMockManager(),
DriverManager: drivermanager.TestDriverManager(t),
StartConditionMetCtx: closedCh,
ServiceRegWrapper: wrapper.NewHandlerWrapper(logger, serviceClient, regMock.NewServiceRegistrationHandler(logger)),
}
tr, err := taskrunner.NewTaskRunner(config)