github.com/cilium/cilium@v1.16.2/pkg/redirectpolicy/cell.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package redirectpolicy
     5  
     6  import (
     7  	"github.com/cilium/hive/cell"
     8  
     9  	serviceapi "github.com/cilium/cilium/api/v1/server/restapi/service"
    10  	agentK8s "github.com/cilium/cilium/daemon/k8s"
    11  	"github.com/cilium/cilium/pkg/endpointmanager"
    12  	"github.com/cilium/cilium/pkg/k8s"
    13  	"github.com/cilium/cilium/pkg/service"
    14  )
    15  
    16  // Cell provides access to the Local Redirect Policy Manager.
    17  var Cell = cell.Module(
    18  	"lrp-manager",
    19  	"LRP Manager",
    20  
    21  	cell.Provide(newLRPManager),
    22  	cell.Provide(newLRPApiHandler),
    23  )
    24  
    25  type lrpManagerParams struct {
    26  	cell.In
    27  
    28  	Svc      service.ServiceManager
    29  	SvcCache *k8s.ServiceCache
    30  	Lpr      agentK8s.LocalPodResource
    31  	Ep       endpointmanager.EndpointManager
    32  }
    33  
    34  func newLRPManager(params lrpManagerParams) *Manager {
    35  	return NewRedirectPolicyManager(params.Svc, params.SvcCache, params.Lpr, params.Ep)
    36  }
    37  
    38  func newLRPApiHandler(lrpManager *Manager) serviceapi.GetLrpHandler {
    39  	return &getLrpHandler{
    40  		lrpManager: lrpManager,
    41  	}
    42  }