Skip to content

Commit

Permalink
cilium-health: remove use of GlobalEndpointManager
Browse files Browse the repository at this point in the history
Signed-off by: Ian Vernon <ian@cilium.io>
  • Loading branch information
Ian Vernon authored and ianvernon committed Aug 23, 2019
1 parent 34ef1a4 commit 5692c09
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cilium-health/launch/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/cilium/cilium/pkg/endpoint"
"github.com/cilium/cilium/pkg/endpoint/connector"
"github.com/cilium/cilium/pkg/endpoint/regeneration"
"github.com/cilium/cilium/pkg/endpointmanager"
healthDefaults "github.com/cilium/cilium/pkg/health/defaults"
"github.com/cilium/cilium/pkg/health/probe"
"github.com/cilium/cilium/pkg/labels"
Expand Down Expand Up @@ -218,13 +217,18 @@ func CleanupEndpoint() {
}
}

// EndpointAdder is any type which adds an endpoint to be managed by Cilium.
type EndpointAdder interface {
AddEndpoint(owner regeneration.Owner, ep *endpoint.Endpoint, reason string) error
}

// LaunchAsEndpoint launches the cilium-health agent in a nested network
// namespace and attaches it to Cilium the same way as any other endpoint,
// but with special reserved labels.
//
// CleanupEndpoint() must be called before calling LaunchAsEndpoint() to ensure
// cleanup of prior cilium-health endpoint instances.
func LaunchAsEndpoint(baseCtx context.Context, owner regeneration.Owner, n *node.Node, mtuConfig mtu.Configuration) (*Client, error) {
func LaunchAsEndpoint(baseCtx context.Context, owner regeneration.Owner, n *node.Node, mtuConfig mtu.Configuration, epMgr EndpointAdder) (*Client, error) {
var (
cmd = launcher.Launcher{}
info = &models.EndpointChangeRequest{
Expand Down Expand Up @@ -319,7 +323,7 @@ func LaunchAsEndpoint(baseCtx context.Context, owner regeneration.Owner, n *node
return nil, fmt.Errorf("Error while configuring routes: %s", err)
}

if err := endpointmanager.AddEndpoint(owner, ep, "Create cilium-health endpoint"); err != nil {
if err := epMgr.AddEndpoint(owner, ep, "Create cilium-health endpoint"); err != nil {
return nil, fmt.Errorf("Error while adding endpoint: %s", err)
}

Expand Down

0 comments on commit 5692c09

Please sign in to comment.