catalog

package
v0.9.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 43 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

View Source
var (
	// ErrServiceNotFoundForAnyProvider is an error for when OSM cannot find a service for the given service account.
	ErrServiceNotFoundForAnyProvider = errors.New("no service found for service account with any of the mesh supported providers")

	// ErrNoTrafficSpecFoundForTrafficPolicy is an error for when OSM cannot find a traffic spec for the given traffic policy.
	ErrNoTrafficSpecFoundForTrafficPolicy = errors.New("no traffic spec found for the traffic policy")

	// ErrServiceNotFound is an error for when OSM cannot find a service.
	ErrServiceNotFound = errors.New("service not found")
)

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, kubeClient kubernetes.Interface, meshSpec smi.MeshSpec, certManager certificate.Manager, ingressMonitor ingress.Monitor, policyController policy.Controller, stop <-chan struct{}, cfg configurator.Configurator, endpointsProviders ...endpoint.Provider) *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) GetIngressPoliciesForService added in v0.8.0

func (mc *MeshCatalog) GetIngressPoliciesForService(svc service.MeshService) ([]*trafficpolicy.InboundTrafficPolicy, error)

GetIngressPoliciesForService returns a list of inbound traffic policies for a service as defined in observed ingress k8s resources.

func (*MeshCatalog) GetPortToProtocolMappingForService added in v0.6.0

func (mc *MeshCatalog) GetPortToProtocolMappingForService(svc service.MeshService) (map[uint32]string, error)

GetPortToProtocolMappingForService returns a mapping of the service's ports to their corresponding application protocol, where the ports returned are the ones used by downstream clients in their requests. This can be different from the ports actually exposed by the application binary, ie. 'spec.ports[].port' instead of 'spec.ports[].targetPort' for a Kubernetes service.

func (*MeshCatalog) GetResolvableServiceEndpoints added in v0.4.0

func (mc *MeshCatalog) GetResolvableServiceEndpoints(svc service.MeshService) ([]endpoint.Endpoint, error)

GetResolvableServiceEndpoints returns the resolvable set of endpoint over which a service is accessible using its FQDN

func (*MeshCatalog) GetTargetPortToProtocolMappingForService added in v0.7.0

func (mc *MeshCatalog) GetTargetPortToProtocolMappingForService(svc service.MeshService) (map[uint32]string, error)

GetTargetPortToProtocolMappingForService returns a mapping of the service's ports to their corresponding application protocol. The ports returned are the actual ports on which the application exposes the service derived from the service's endpoints, ie. 'spec.ports[].targetPort' instead of 'spec.ports[].port' for a Kubernetes service. The function ensures the port:protocol mapping is the same across different endpoint providers for the service, and returns an error otherwise.

func (*MeshCatalog) GetWeightedClustersForUpstream added in v0.9.0

func (mc *MeshCatalog) GetWeightedClustersForUpstream(upstream service.MeshService) []service.WeightedCluster

GetWeightedClustersForUpstream returns Envoy cluster weights for the given upstream service, the apex service of a TrafficSplit.

func (*MeshCatalog) ListAllowedEndpointsForService added in v0.8.0

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

ListAllowedEndpointsForService returns only those endpoints for a service that belong to the allowed outbound service accounts for the given downstream identity Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

func (*MeshCatalog) ListAllowedInboundServiceIdentities added in v0.9.0

func (mc *MeshCatalog) ListAllowedInboundServiceIdentities(upstream identity.ServiceIdentity) ([]identity.ServiceIdentity, error)

ListAllowedInboundServiceIdentities lists the downstream service identities that can connect to the given upstream service account Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

func (*MeshCatalog) ListAllowedOutboundServiceIdentities added in v0.9.0

func (mc *MeshCatalog) ListAllowedOutboundServiceIdentities(downstream identity.ServiceIdentity) ([]identity.ServiceIdentity, error)

ListAllowedOutboundServiceIdentities lists the upstream service identities the given downstream service account can connect to Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

func (*MeshCatalog) ListAllowedOutboundServicesForIdentity added in v0.7.0

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

ListAllowedOutboundServicesForIdentity 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) ListInboundTrafficPolicies added in v0.8.0

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

ListInboundTrafficPolicies returns all inbound traffic policies 1. from service discovery for permissive mode 2. for the given service account and upstream services from SMI Traffic Target and Traffic Split 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) ListMeshServicesForIdentity added in v0.9.0

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

ListMeshServicesForIdentity returns a list of services the service with the given identity can communicate with, including apex TrafficSplit services.

func (*MeshCatalog) ListMonitoredNamespaces added in v0.1.0

func (mc *MeshCatalog) ListMonitoredNamespaces() []string

ListMonitoredNamespaces returns all namespaces that the mesh is monitoring.

func (*MeshCatalog) ListOutboundTrafficPolicies added in v0.8.0

func (mc *MeshCatalog) ListOutboundTrafficPolicies(downstreamIdentity identity.ServiceIdentity) []*trafficpolicy.OutboundTrafficPolicy

ListOutboundTrafficPolicies returns all outbound traffic policies 1. from service discovery for permissive mode 2. for the given service account from SMI Traffic Target and Traffic Split Note: ServiceIdentity must be in the format "name.namespace" [https://github.com/openservicemesh/osm/issues/3188]

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, error)

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

type MeshCataloger

type MeshCataloger interface {
	// ListInboundTrafficPolicies returns all inbound traffic policies related to the given service identity and inbound services
	ListInboundTrafficPolicies(identity.ServiceIdentity, []service.MeshService) []*trafficpolicy.InboundTrafficPolicy

	// ListOutboundTrafficPolicies returns all outbound traffic policies related to the given service identity
	ListOutboundTrafficPolicies(identity.ServiceIdentity) []*trafficpolicy.OutboundTrafficPolicy

	// ListAllowedOutboundServicesForIdentity list the services the given service identity is allowed to initiate outbound connections to
	ListAllowedOutboundServicesForIdentity(identity.ServiceIdentity) []service.MeshService

	// ListAllowedInboundServiceIdentities lists the downstream service identities that can connect to the given service identity
	ListAllowedInboundServiceIdentities(identity.ServiceIdentity) ([]identity.ServiceIdentity, error)

	// ListAllowedOutboundServiceIdentities lists the upstream service identities the given service identity can connect to
	ListAllowedOutboundServiceIdentities(identity.ServiceIdentity) ([]identity.ServiceIdentity, error)

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

	// ListAllowedEndpointsForService returns the list of endpoints backing a service and its allowed service identities
	ListAllowedEndpointsForService(identity.ServiceIdentity, service.MeshService) ([]endpoint.Endpoint, error)

	// GetResolvableServiceEndpoints returns the resolvable set of endpoint over which a service is accessible using its FQDN.
	// These are the endpoint destinations we'd expect client applications sends the traffic towards to, when attempting to
	// reach a specific service.
	// If no LB/virtual IPs are assigned to the service, GetResolvableServiceEndpoints will return ListEndpointsForService
	GetResolvableServiceEndpoints(service.MeshService) ([]endpoint.Endpoint, error)

	// GetIngressPoliciesForService returns the inbound traffic policies associated with an ingress service
	GetIngressPoliciesForService(service.MeshService) ([]*trafficpolicy.InboundTrafficPolicy, error)

	// GetTargetPortToProtocolMappingForService returns a mapping of the service's ports to their corresponding application protocol.
	// The ports returned are the actual ports on which the application exposes the service derived from the service's endpoints,
	// ie. 'spec.ports[].targetPort' instead of 'spec.ports[].port' for a Kubernetes service.
	GetTargetPortToProtocolMappingForService(service.MeshService) (map[uint32]string, error)

	// GetPortToProtocolMappingForService returns a mapping of the service's ports to their corresponding application protocol,
	// where the ports returned are the ones used by downstream clients in their requests. This can be different from the ports
	// actually exposed by the application binary, ie. 'spec.ports[].port' instead of 'spec.ports[].targetPort' for a Kubernetes service.
	GetPortToProtocolMappingForService(service.MeshService) (map[uint32]string, error)

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

	// GetWeightedClustersForUpstream lists the weighted cluster backends corresponding to the upstream service.
	GetWeightedClustersForUpstream(service.MeshService) []service.WeightedCluster

	// ListMeshServicesForIdentity lists the services for a given service identity.
	ListMeshServicesForIdentity(identity.ServiceIdentity) []service.MeshService

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

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) GetIngressPoliciesForService added in v0.8.0

func (m *MockMeshCataloger) GetIngressPoliciesForService(arg0 service.MeshService) ([]*trafficpolicy.InboundTrafficPolicy, error)

GetIngressPoliciesForService mocks base method

func (*MockMeshCataloger) GetPortToProtocolMappingForService added in v0.6.0

func (m *MockMeshCataloger) GetPortToProtocolMappingForService(arg0 service.MeshService) (map[uint32]string, error)

GetPortToProtocolMappingForService mocks base method

func (*MockMeshCataloger) GetResolvableServiceEndpoints added in v0.4.1

func (m *MockMeshCataloger) GetResolvableServiceEndpoints(arg0 service.MeshService) ([]endpoint.Endpoint, error)

GetResolvableServiceEndpoints mocks base method

func (*MockMeshCataloger) GetTargetPortToProtocolMappingForService added in v0.7.0

func (m *MockMeshCataloger) GetTargetPortToProtocolMappingForService(arg0 service.MeshService) (map[uint32]string, error)

GetTargetPortToProtocolMappingForService mocks base method

func (*MockMeshCataloger) GetWeightedClustersForUpstream added in v0.9.0

func (m *MockMeshCataloger) GetWeightedClustersForUpstream(arg0 service.MeshService) []service.WeightedCluster

GetWeightedClustersForUpstream mocks base method

func (*MockMeshCataloger) ListAllowedEndpointsForService added in v0.8.0

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

ListAllowedEndpointsForService mocks base method

func (*MockMeshCataloger) ListAllowedInboundServiceIdentities added in v0.9.0

func (m *MockMeshCataloger) ListAllowedInboundServiceIdentities(arg0 identity.ServiceIdentity) ([]identity.ServiceIdentity, error)

ListAllowedInboundServiceIdentities mocks base method

func (*MockMeshCataloger) ListAllowedOutboundServiceIdentities added in v0.9.0

func (m *MockMeshCataloger) ListAllowedOutboundServiceIdentities(arg0 identity.ServiceIdentity) ([]identity.ServiceIdentity, error)

ListAllowedOutboundServiceIdentities mocks base method

func (*MockMeshCataloger) ListAllowedOutboundServicesForIdentity added in v0.7.0

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

ListAllowedOutboundServicesForIdentity mocks base method

func (*MockMeshCataloger) ListInboundTrafficPolicies added in v0.8.0

func (m *MockMeshCataloger) ListInboundTrafficPolicies(arg0 identity.ServiceIdentity, arg1 []service.MeshService) []*trafficpolicy.InboundTrafficPolicy

ListInboundTrafficPolicies 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) ListMeshServicesForIdentity added in v0.9.0

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

ListMeshServicesForIdentity mocks base method

func (*MockMeshCataloger) ListOutboundTrafficPolicies added in v0.8.0

func (m *MockMeshCataloger) ListOutboundTrafficPolicies(arg0 identity.ServiceIdentity) []*trafficpolicy.OutboundTrafficPolicy

ListOutboundTrafficPolicies mocks base method

func (*MockMeshCataloger) ListServiceIdentitiesForService added in v0.9.0

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

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) GetIngressPoliciesForService added in v0.8.0

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

GetIngressPoliciesForService indicates an expected call of GetIngressPoliciesForService

func (*MockMeshCatalogerMockRecorder) GetPortToProtocolMappingForService added in v0.6.0

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

GetPortToProtocolMappingForService indicates an expected call of GetPortToProtocolMappingForService

func (*MockMeshCatalogerMockRecorder) GetResolvableServiceEndpoints added in v0.4.1

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

GetResolvableServiceEndpoints indicates an expected call of GetResolvableServiceEndpoints

func (*MockMeshCatalogerMockRecorder) GetTargetPortToProtocolMappingForService added in v0.7.0

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

GetTargetPortToProtocolMappingForService indicates an expected call of GetTargetPortToProtocolMappingForService

func (*MockMeshCatalogerMockRecorder) GetWeightedClustersForUpstream added in v0.9.0

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

GetWeightedClustersForUpstream indicates an expected call of GetWeightedClustersForUpstream

func (*MockMeshCatalogerMockRecorder) ListAllowedEndpointsForService added in v0.8.0

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

ListAllowedEndpointsForService indicates an expected call of ListAllowedEndpointsForService

func (*MockMeshCatalogerMockRecorder) ListAllowedInboundServiceIdentities added in v0.9.0

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

ListAllowedInboundServiceIdentities indicates an expected call of ListAllowedInboundServiceIdentities

func (*MockMeshCatalogerMockRecorder) ListAllowedOutboundServiceIdentities added in v0.9.0

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

ListAllowedOutboundServiceIdentities indicates an expected call of ListAllowedOutboundServiceIdentities

func (*MockMeshCatalogerMockRecorder) ListAllowedOutboundServicesForIdentity added in v0.7.0

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

ListAllowedOutboundServicesForIdentity indicates an expected call of ListAllowedOutboundServicesForIdentity

func (*MockMeshCatalogerMockRecorder) ListInboundTrafficPolicies added in v0.8.0

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

ListInboundTrafficPolicies indicates an expected call of ListInboundTrafficPolicies

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) ListMeshServicesForIdentity added in v0.9.0

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

ListMeshServicesForIdentity indicates an expected call of ListMeshServicesForIdentity

func (*MockMeshCatalogerMockRecorder) ListOutboundTrafficPolicies added in v0.8.0

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

ListOutboundTrafficPolicies indicates an expected call of ListOutboundTrafficPolicies

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