catalog

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Package catalog is a generated GoMock package.

Package catalog implements the MeshCataloger interface, which forms the central component in OSM that transforms outputs from all other components (SMI policies, Kubernetes services, endpoints etc.) into configuration that is consumed by the the proxy control plane component to program sidecar proxies. Reference: https://github.com/openservicemesh/osm/blob/main/DESIGN.md#5-mesh-catalog

Index

Constants

View Source
const (
	// AllowPartialHostnamesMatch is used to allow a partial/subset match on hostnames in traffic policies
	AllowPartialHostnamesMatch bool = true

	// DisallowPartialHostnamesMatch is used to disallow a partial/subset match on hostnames in traffic policies
	DisallowPartialHostnamesMatch bool = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MeshCatalog

type MeshCatalog struct {
	// contains filtered or unexported fields
}

MeshCatalog is the struct for the service catalog

func NewFakeMeshCatalog

func NewFakeMeshCatalog(kubeClient kubernetes.Interface, meshConfigClient versioned.Interface) *MeshCatalog

NewFakeMeshCatalog creates a new struct implementing catalog.MeshCataloger interface used for testing.

func NewMeshCatalog

func NewMeshCatalog(kubeController k8s.Controller, meshSpec smi.MeshSpec, certManager certificate.Manager,
	ingressMonitor ingress.Monitor, policyController policy.Controller, stop <-chan struct{},
	cfg configurator.Configurator, serviceProviders []service.Provider, endpointsProviders []endpoint.Provider,
	msgBroker *messaging.Broker) *MeshCatalog

NewMeshCatalog creates a new service catalog

func (*MeshCatalog) GetEgressTrafficPolicy added in v0.9.0

func (mc *MeshCatalog) GetEgressTrafficPolicy(serviceIdentity identity.ServiceIdentity) (*trafficpolicy.EgressTrafficPolicy, error)

GetEgressTrafficPolicy returns the Egress traffic policy associated with the given service identity

func (*MeshCatalog) GetInboundMeshTrafficPolicy added in v0.11.0

func (mc *MeshCatalog) GetInboundMeshTrafficPolicy(upstreamIdentity identity.ServiceIdentity, upstreamServices []service.MeshService) *trafficpolicy.InboundMeshTrafficPolicy

GetInboundMeshTrafficPolicy returns the inbound mesh traffic policy for the given upstream identity and services

func (*MeshCatalog) GetIngressTrafficPolicy added in v0.10.0

func (mc *MeshCatalog) GetIngressTrafficPolicy(svc service.MeshService) (*trafficpolicy.IngressTrafficPolicy, error)

GetIngressTrafficPolicy returns the ingress traffic policy for the given mesh service Depending on if the IngressBackend API is enabled, the policies will be generated either from the IngressBackend or Kubernetes Ingress API.

func (*MeshCatalog) GetKubeController added in v0.9.1

func (mc *MeshCatalog) GetKubeController() k8s.Controller

GetKubeController returns the kube controller instance handling the current cluster

func (*MeshCatalog) GetOutboundMeshTrafficPolicy added in v0.11.0

func (mc *MeshCatalog) GetOutboundMeshTrafficPolicy(downstreamIdentity identity.ServiceIdentity) *trafficpolicy.OutboundMeshTrafficPolicy

GetOutboundMeshTrafficPolicy returns the outbound mesh traffic policy for the given downstream identity

The function works as follows:

  1. If permissive mode is enabled, builds outbound mesh traffic policies to reach every upstream service discovered using service discovery, using wildcard routes.
  2. In SMI mode, builds outbound mesh traffic policies to reach every upstream service corresponding to every upstream service account that this downstream is authorized to access using SMI TrafficTarget policies.
  3. Process TraficSplit policies and update the weights for the upstream services based on the policies.

The route configurations are consolidated per port, such that upstream services using the same port are a part of the same route configuration. This is required to avoid route conflicts that can occur when the same hostname needs to be routed differently based on the port used.

func (*MeshCatalog) ListAllowedUpstreamEndpointsForService added in v0.11.0

func (mc *MeshCatalog) ListAllowedUpstreamEndpointsForService(downstreamIdentity identity.ServiceIdentity, upstreamSvc service.MeshService) []endpoint.Endpoint

ListAllowedUpstreamEndpointsForService returns the list of endpoints over which the downstream client identity is allowed access the upstream service

func (*MeshCatalog) ListInboundServiceIdentities added in v0.10.0

func (mc *MeshCatalog) ListInboundServiceIdentities(upstream identity.ServiceIdentity) []identity.ServiceIdentity

ListInboundServiceIdentities lists the downstream service identities that are allowed to connect to the given service identity Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

func (*MeshCatalog) ListInboundTrafficTargetsWithRoutes added in v0.7.0

func (mc *MeshCatalog) ListInboundTrafficTargetsWithRoutes(upstream identity.ServiceIdentity) ([]trafficpolicy.TrafficTargetWithRoutes, error)

ListInboundTrafficTargetsWithRoutes returns a list traffic target objects composed of its routes for the given destination service account Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

func (*MeshCatalog) ListOutboundServiceIdentities added in v0.10.0

func (mc *MeshCatalog) ListOutboundServiceIdentities(downstream identity.ServiceIdentity) []identity.ServiceIdentity

ListOutboundServiceIdentities lists the upstream service identities the given service identity are allowed to connect to Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

func (*MeshCatalog) ListOutboundServicesForIdentity added in v0.10.0

func (mc *MeshCatalog) ListOutboundServicesForIdentity(serviceIdentity identity.ServiceIdentity) []service.MeshService

ListOutboundServicesForIdentity list the services the given service account is allowed to initiate outbound connections to Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

func (*MeshCatalog) ListOutboundServicesForMulticlusterGateway added in v0.10.0

func (mc *MeshCatalog) ListOutboundServicesForMulticlusterGateway() []service.MeshService

ListOutboundServicesForMulticlusterGateway lists the upstream services for the multicluster gateway TODO: improve code by combining with ListOutboundServicesForIdentity

func (*MeshCatalog) ListSMIPolicies

ListSMIPolicies returns all policies OSM is aware of.

func (*MeshCatalog) ListServiceIdentitiesForService added in v0.9.0

func (mc *MeshCatalog) ListServiceIdentitiesForService(svc service.MeshService) []identity.ServiceIdentity

ListServiceIdentitiesForService lists the service identities associated with the given mesh service.

type MeshCataloger

type MeshCataloger interface {
	// ListOutboundServicesForIdentity list the services the given service identity is allowed to initiate outbound connections to
	ListOutboundServicesForIdentity(identity.ServiceIdentity) []service.MeshService

	// ListOutboundServicesForMulticlusterGateway  lists the upstream services for the multicluster gateway
	ListOutboundServicesForMulticlusterGateway() []service.MeshService

	// ListInboundServiceIdentities lists the downstream service identities that are allowed to connect to the given service identity
	ListInboundServiceIdentities(identity.ServiceIdentity) []identity.ServiceIdentity

	// ListOutboundServiceIdentities lists the upstream service identities the given service identity are allowed to connect to
	ListOutboundServiceIdentities(identity.ServiceIdentity) []identity.ServiceIdentity

	// ListServiceIdentitiesForService lists the service identities associated with the given service
	ListServiceIdentitiesForService(service.MeshService) []identity.ServiceIdentity

	// ListAllowedUpstreamEndpointsForService returns the list of endpoints over which the downstream client identity
	// is allowed access the upstream service
	ListAllowedUpstreamEndpointsForService(identity.ServiceIdentity, service.MeshService) []endpoint.Endpoint

	// GetIngressTrafficPolicy returns the ingress traffic policy for the given mesh service
	GetIngressTrafficPolicy(service.MeshService) (*trafficpolicy.IngressTrafficPolicy, error)

	// ListInboundTrafficTargetsWithRoutes returns a list traffic target objects composed of its routes for the given destination service identity
	ListInboundTrafficTargetsWithRoutes(identity.ServiceIdentity) ([]trafficpolicy.TrafficTargetWithRoutes, error)

	// GetEgressTrafficPolicy returns the Egress traffic policy associated with the given service identity.
	GetEgressTrafficPolicy(identity.ServiceIdentity) (*trafficpolicy.EgressTrafficPolicy, error)

	// GetKubeController returns the kube controller instance handling the current cluster
	GetKubeController() k8s.Controller

	// GetOutboundMeshTrafficPolicy returns the outbound mesh traffic policy for the given downstream identity
	GetOutboundMeshTrafficPolicy(identity.ServiceIdentity) *trafficpolicy.OutboundMeshTrafficPolicy

	// GetInboundMeshTrafficPolicy returns the inbound mesh traffic policy for the given upstream identity and services
	GetInboundMeshTrafficPolicy(identity.ServiceIdentity, []service.MeshService) *trafficpolicy.InboundMeshTrafficPolicy
}

MeshCataloger is the mechanism by which the Service Mesh controller discovers all Envoy proxies connected to the catalog.

type MockMeshCataloger added in v0.4.1

type MockMeshCataloger struct {
	// contains filtered or unexported fields
}

MockMeshCataloger is a mock of MeshCataloger interface.

func NewMockMeshCataloger added in v0.4.1

func NewMockMeshCataloger(ctrl *gomock.Controller) *MockMeshCataloger

NewMockMeshCataloger creates a new mock instance.

func (*MockMeshCataloger) EXPECT added in v0.4.1

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockMeshCataloger) GetEgressTrafficPolicy added in v0.9.0

GetEgressTrafficPolicy mocks base method.

func (*MockMeshCataloger) GetInboundMeshTrafficPolicy added in v0.11.0

GetInboundMeshTrafficPolicy mocks base method.

func (*MockMeshCataloger) GetIngressTrafficPolicy added in v0.10.0

func (m *MockMeshCataloger) GetIngressTrafficPolicy(arg0 service.MeshService) (*trafficpolicy.IngressTrafficPolicy, error)

GetIngressTrafficPolicy mocks base method.

func (*MockMeshCataloger) GetKubeController added in v0.9.1

func (m *MockMeshCataloger) GetKubeController() k8s.Controller

GetKubeController mocks base method.

func (*MockMeshCataloger) GetOutboundMeshTrafficPolicy added in v0.11.0

func (m *MockMeshCataloger) GetOutboundMeshTrafficPolicy(arg0 identity.ServiceIdentity) *trafficpolicy.OutboundMeshTrafficPolicy

GetOutboundMeshTrafficPolicy mocks base method.

func (*MockMeshCataloger) ListAllowedUpstreamEndpointsForService added in v0.11.0

func (m *MockMeshCataloger) ListAllowedUpstreamEndpointsForService(arg0 identity.ServiceIdentity, arg1 service.MeshService) []endpoint.Endpoint

ListAllowedUpstreamEndpointsForService mocks base method.

func (*MockMeshCataloger) ListInboundServiceIdentities added in v0.10.0

func (m *MockMeshCataloger) ListInboundServiceIdentities(arg0 identity.ServiceIdentity) []identity.ServiceIdentity

ListInboundServiceIdentities mocks base method.

func (*MockMeshCataloger) ListInboundTrafficTargetsWithRoutes added in v0.7.0

func (m *MockMeshCataloger) ListInboundTrafficTargetsWithRoutes(arg0 identity.ServiceIdentity) ([]trafficpolicy.TrafficTargetWithRoutes, error)

ListInboundTrafficTargetsWithRoutes mocks base method.

func (*MockMeshCataloger) ListOutboundServiceIdentities added in v0.10.0

func (m *MockMeshCataloger) ListOutboundServiceIdentities(arg0 identity.ServiceIdentity) []identity.ServiceIdentity

ListOutboundServiceIdentities mocks base method.

func (*MockMeshCataloger) ListOutboundServicesForIdentity added in v0.10.0

func (m *MockMeshCataloger) ListOutboundServicesForIdentity(arg0 identity.ServiceIdentity) []service.MeshService

ListOutboundServicesForIdentity mocks base method.

func (*MockMeshCataloger) ListOutboundServicesForMulticlusterGateway added in v0.10.0

func (m *MockMeshCataloger) ListOutboundServicesForMulticlusterGateway() []service.MeshService

ListOutboundServicesForMulticlusterGateway mocks base method.

func (*MockMeshCataloger) ListServiceIdentitiesForService added in v0.9.0

func (m *MockMeshCataloger) ListServiceIdentitiesForService(arg0 service.MeshService) []identity.ServiceIdentity

ListServiceIdentitiesForService mocks base method.

type MockMeshCatalogerMockRecorder added in v0.4.1

type MockMeshCatalogerMockRecorder struct {
	// contains filtered or unexported fields
}

MockMeshCatalogerMockRecorder is the mock recorder for MockMeshCataloger.

func (*MockMeshCatalogerMockRecorder) GetEgressTrafficPolicy added in v0.9.0

func (mr *MockMeshCatalogerMockRecorder) GetEgressTrafficPolicy(arg0 interface{}) *gomock.Call

GetEgressTrafficPolicy indicates an expected call of GetEgressTrafficPolicy.

func (*MockMeshCatalogerMockRecorder) GetInboundMeshTrafficPolicy added in v0.11.0

func (mr *MockMeshCatalogerMockRecorder) GetInboundMeshTrafficPolicy(arg0, arg1 interface{}) *gomock.Call

GetInboundMeshTrafficPolicy indicates an expected call of GetInboundMeshTrafficPolicy.

func (*MockMeshCatalogerMockRecorder) GetIngressTrafficPolicy added in v0.10.0

func (mr *MockMeshCatalogerMockRecorder) GetIngressTrafficPolicy(arg0 interface{}) *gomock.Call

GetIngressTrafficPolicy indicates an expected call of GetIngressTrafficPolicy.

func (*MockMeshCatalogerMockRecorder) GetKubeController added in v0.9.1

func (mr *MockMeshCatalogerMockRecorder) GetKubeController() *gomock.Call

GetKubeController indicates an expected call of GetKubeController.

func (*MockMeshCatalogerMockRecorder) GetOutboundMeshTrafficPolicy added in v0.11.0

func (mr *MockMeshCatalogerMockRecorder) GetOutboundMeshTrafficPolicy(arg0 interface{}) *gomock.Call

GetOutboundMeshTrafficPolicy indicates an expected call of GetOutboundMeshTrafficPolicy.

func (*MockMeshCatalogerMockRecorder) ListAllowedUpstreamEndpointsForService added in v0.11.0

func (mr *MockMeshCatalogerMockRecorder) ListAllowedUpstreamEndpointsForService(arg0, arg1 interface{}) *gomock.Call

ListAllowedUpstreamEndpointsForService indicates an expected call of ListAllowedUpstreamEndpointsForService.

func (*MockMeshCatalogerMockRecorder) ListInboundServiceIdentities added in v0.10.0

func (mr *MockMeshCatalogerMockRecorder) ListInboundServiceIdentities(arg0 interface{}) *gomock.Call

ListInboundServiceIdentities indicates an expected call of ListInboundServiceIdentities.

func (*MockMeshCatalogerMockRecorder) ListInboundTrafficTargetsWithRoutes added in v0.7.0

func (mr *MockMeshCatalogerMockRecorder) ListInboundTrafficTargetsWithRoutes(arg0 interface{}) *gomock.Call

ListInboundTrafficTargetsWithRoutes indicates an expected call of ListInboundTrafficTargetsWithRoutes.

func (*MockMeshCatalogerMockRecorder) ListOutboundServiceIdentities added in v0.10.0

func (mr *MockMeshCatalogerMockRecorder) ListOutboundServiceIdentities(arg0 interface{}) *gomock.Call

ListOutboundServiceIdentities indicates an expected call of ListOutboundServiceIdentities.

func (*MockMeshCatalogerMockRecorder) ListOutboundServicesForIdentity added in v0.10.0

func (mr *MockMeshCatalogerMockRecorder) ListOutboundServicesForIdentity(arg0 interface{}) *gomock.Call

ListOutboundServicesForIdentity indicates an expected call of ListOutboundServicesForIdentity.

func (*MockMeshCatalogerMockRecorder) ListOutboundServicesForMulticlusterGateway added in v0.10.0

func (mr *MockMeshCatalogerMockRecorder) ListOutboundServicesForMulticlusterGateway() *gomock.Call

ListOutboundServicesForMulticlusterGateway indicates an expected call of ListOutboundServicesForMulticlusterGateway.

func (*MockMeshCatalogerMockRecorder) ListServiceIdentitiesForService added in v0.9.0

func (mr *MockMeshCatalogerMockRecorder) ListServiceIdentitiesForService(arg0 interface{}) *gomock.Call

ListServiceIdentitiesForService indicates an expected call of ListServiceIdentitiesForService.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL