catalog

package
v0.6.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Package catalog is a generated GoMock package.

Index

Constants

View Source
const (
	//HTTPTraffic specifies HTTP Traffic Policy
	HTTPTraffic = "HTTPRouteGroup"
)

Variables

This section is empty.

Functions

func GetPodFromCertificate

func GetPodFromCertificate(cn certificate.CommonName, kubecontroller k8s.Controller) (*v1.Pod, error)

GetPodFromCertificate returns the Kubernetes Pod object for a given certificate.

func GetServiceAccountFromProxyCertificate added in v0.6.0

func GetServiceAccountFromProxyCertificate(cn certificate.CommonName) (service.K8sServiceAccount, error)

GetServiceAccountFromProxyCertificate returns the ServiceAccount information encoded in the certificate CN

func NewCertCommonNameWithProxyID

func NewCertCommonNameWithProxyID(proxyUUID uuid.UUID, serviceAccount, namespace string) certificate.CommonName

NewCertCommonNameWithProxyID returns a newly generated CommonName for a certificate of the form: <ProxyUUID>.<serviceAccount>.<namespace>

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) *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, stop <-chan struct{}, cfg configurator.Configurator, endpointsProviders ...endpoint.Provider) *MeshCatalog

NewMeshCatalog creates a new service catalog

func (*MeshCatalog) ExpectProxy

func (mc *MeshCatalog) ExpectProxy(cn certificate.CommonName)

ExpectProxy catalogs the fact that a certificate was issued for an Envoy proxy and this is expected to connect to XDS.

func (*MeshCatalog) GetHostnamesForUpstreamService added in v0.6.0

func (mc *MeshCatalog) GetHostnamesForUpstreamService(downstream, upstream service.MeshService) ([]string, error)

GetHostnamesForUpstreamService returns the hostnames over which an upstream service is accessible from a downstream service The hostname is the FQDN for the service, and can include ports as well. Ex. bookstore.default, bookstore.default:80, bookstore.default.svc, bookstore.default.svc:80 etc. TODO: replace GetResolvableHostnamesForUpstreamService with this func once routes refactor is complete (#issue)

func (*MeshCatalog) GetIngressRoutesPerHost

func (mc *MeshCatalog) GetIngressRoutesPerHost(service service.MeshService) (map[string][]trafficpolicy.HTTPRouteMatch, error)

GetIngressRoutesPerHost returns route matches per host 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. The function ensures the port:protocol mapping is the same across different endpoint providers for the service, and returns an error otherwise.

func (*MeshCatalog) GetResolvableHostnamesForUpstreamService added in v0.5.0

func (mc *MeshCatalog) GetResolvableHostnamesForUpstreamService(downstream, upstream service.MeshService) ([]string, error)

GetResolvableHostnamesForUpstreamService returns the hostnames over which an upstream service is accessible from a downstream service The hostname is the FQDN for the service, and can include ports as well. Ex. bookstore.default, bookstore.default:80, bookstore.default.svc, bookstore.default.svc:80 etc.

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) GetSMISpec

func (mc *MeshCatalog) GetSMISpec() smi.MeshSpec

GetSMISpec returns a MeshCatalog's SMI Spec

func (*MeshCatalog) GetServicesForServiceAccount added in v0.4.0

func (mc *MeshCatalog) GetServicesForServiceAccount(sa service.K8sServiceAccount) ([]service.MeshService, error)

GetServicesForServiceAccount returns a list of services corresponding to a service account

func (*MeshCatalog) GetServicesForServiceAccounts added in v0.6.0

func (mc *MeshCatalog) GetServicesForServiceAccounts(saList []service.K8sServiceAccount) []service.MeshService

GetServicesForServiceAccounts returns a list of services corresponding to a list service accounts

TODO: Consider merging this function and mc.GetServicesForServiceAccount in future (#2038)

func (*MeshCatalog) GetServicesFromEnvoyCertificate added in v0.4.0

func (mc *MeshCatalog) GetServicesFromEnvoyCertificate(cn certificate.CommonName) ([]service.MeshService, error)

GetServicesFromEnvoyCertificate returns a list of services the given Envoy is a member of based on the certificate provided, which is a cert issued to an Envoy for XDS communication (not Envoy-to-Envoy).

func (*MeshCatalog) GetWeightedClusterForService

func (mc *MeshCatalog) GetWeightedClusterForService(svc service.MeshService) (service.WeightedCluster, error)

GetWeightedClusterForService returns the weighted cluster for a given service

func (*MeshCatalog) ListAllowedInboundServiceAccounts added in v0.6.0

func (mc *MeshCatalog) ListAllowedInboundServiceAccounts(upstream service.K8sServiceAccount) ([]service.K8sServiceAccount, error)

ListAllowedInboundServiceAccounts lists the downstream service accounts that can connect to the given upstream service account

func (*MeshCatalog) ListAllowedInboundServices

func (mc *MeshCatalog) ListAllowedInboundServices(destinationService service.MeshService) ([]service.MeshService, error)

ListAllowedInboundServices lists the inbound services allowed to connect to the given service.

func (*MeshCatalog) ListAllowedOutboundServiceAccounts added in v0.6.0

func (mc *MeshCatalog) ListAllowedOutboundServiceAccounts(downstream service.K8sServiceAccount) ([]service.K8sServiceAccount, error)

ListAllowedOutboundServiceAccounts lists the upstream service accounts the given downstream service account can connect to

func (*MeshCatalog) ListAllowedOutboundServices

func (mc *MeshCatalog) ListAllowedOutboundServices(sourceService service.MeshService) ([]service.MeshService, error)

ListAllowedOutboundServices lists the services the given service is allowed outbound connections to.

func (*MeshCatalog) ListConnectedProxies

func (mc *MeshCatalog) ListConnectedProxies() map[certificate.CommonName]*envoy.Proxy

ListConnectedProxies lists the Envoy proxies already connected and the time they first connected.

func (*MeshCatalog) ListDisconnectedProxies

func (mc *MeshCatalog) ListDisconnectedProxies() map[certificate.CommonName]time.Time

ListDisconnectedProxies lists the Envoy proxies disconnected and the time last seen.

func (*MeshCatalog) ListEndpointsForService

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

ListEndpointsForService returns the list of provider endpoints corresponding to a service

func (*MeshCatalog) ListExpectedProxies

func (mc *MeshCatalog) ListExpectedProxies() map[certificate.CommonName]time.Time

ListExpectedProxies lists the Envoy proxies yet to connect and the time their XDS certificate was issued.

func (*MeshCatalog) ListMonitoredNamespaces added in v0.1.0

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

ListMonitoredNamespaces returns all namespaces that the mesh is monitoring.

func (*MeshCatalog) ListSMIPolicies

ListSMIPolicies returns all policies OSM is aware of.

func (*MeshCatalog) ListServiceAccountsForService added in v0.6.0

func (mc *MeshCatalog) ListServiceAccountsForService(svc service.MeshService) ([]service.K8sServiceAccount, error)

ListServiceAccountsForService lists the service accounts associated with the given service

func (*MeshCatalog) ListTrafficPolicies

func (mc *MeshCatalog) ListTrafficPolicies(service service.MeshService) ([]trafficpolicy.TrafficTarget, error)

ListTrafficPolicies returns all the traffic policies for a given service that Envoy proxy should be aware of.

func (*MeshCatalog) RegisterProxy

func (mc *MeshCatalog) RegisterProxy(proxy *envoy.Proxy)

RegisterProxy implements MeshCatalog and registers a newly connected proxy.

func (*MeshCatalog) UnregisterProxy

func (mc *MeshCatalog) UnregisterProxy(p *envoy.Proxy)

UnregisterProxy unregisters the given proxy from the catalog.

type MeshCataloger

type MeshCataloger interface {
	// GetSMISpec returns the SMI spec
	GetSMISpec() smi.MeshSpec

	// ListTrafficPolicies returns all the traffic policies for a given service that Envoy proxy should be aware of.
	ListTrafficPolicies(service.MeshService) ([]trafficpolicy.TrafficTarget, error)

	// ListAllowedInboundServices lists the inbound services allowed to connect to the given service.
	ListAllowedInboundServices(service.MeshService) ([]service.MeshService, error)

	// ListAllowedOutboundServices lists the services the given service is allowed outbound connections to.
	ListAllowedOutboundServices(service.MeshService) ([]service.MeshService, error)

	// ListAllowedInboundServiceAccounts lists the downstream service accounts that can connect to the given service account
	ListAllowedInboundServiceAccounts(service.K8sServiceAccount) ([]service.K8sServiceAccount, error)

	// ListAllowedOutboundServiceAccounts lists the upstream service accounts the given service account can connect to
	ListAllowedOutboundServiceAccounts(service.K8sServiceAccount) ([]service.K8sServiceAccount, error)

	// ListServiceAccountsForService lists the service accounts associated with the given service
	ListServiceAccountsForService(service.MeshService) ([]service.K8sServiceAccount, error)

	// ListSMIPolicies lists SMI policies.
	ListSMIPolicies() ([]*split.TrafficSplit, []service.WeightedService, []service.K8sServiceAccount, []*spec.HTTPRouteGroup, []*target.TrafficTarget)

	// ListEndpointsForService returns the list of individual instance endpoint backing a service
	ListEndpointsForService(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 attemtpting 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)

	// ExpectProxy catalogs the fact that a certificate was issued for an Envoy proxy and this is expected to connect to XDS.
	ExpectProxy(certificate.CommonName)

	// GetServicesFromEnvoyCertificate returns a list of services the given Envoy is a member of based on the certificate provided, which is a cert issued to an Envoy for XDS communication (not Envoy-to-Envoy).
	GetServicesFromEnvoyCertificate(certificate.CommonName) ([]service.MeshService, error)

	// RegisterProxy registers a newly connected proxy with the service mesh catalog.
	RegisterProxy(*envoy.Proxy)

	// UnregisterProxy unregisters an existing proxy from the service mesh catalog
	UnregisterProxy(*envoy.Proxy)

	// GetServicesForServiceAccount returns a list of services corresponding to a service account
	GetServicesForServiceAccount(service.K8sServiceAccount) ([]service.MeshService, error)

	// GetResolvableHostnamesForUpstreamService returns the hostnames over which an upstream service is accessible from a downstream service
	GetResolvableHostnamesForUpstreamService(downstream, upstream service.MeshService) ([]string, error)

	//GetWeightedClusterForService returns the weighted cluster for a service
	GetWeightedClusterForService(service service.MeshService) (service.WeightedCluster, error)

	// GetIngressRoutesPerHost returns the HTTP route matches per host associated with an ingress service
	GetIngressRoutesPerHost(service.MeshService) (map[string][]trafficpolicy.HTTPRouteMatch, error)

	// ListMonitoredNamespaces lists namespaces monitored by the control plane
	ListMonitoredNamespaces() []string

	// GetPortToProtocolMappingForService returns a mapping of the service's ports to their corresponding application protocol
	GetPortToProtocolMappingForService(service.MeshService) (map[uint32]string, 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) ExpectProxy added in v0.4.1

func (m *MockMeshCataloger) ExpectProxy(arg0 certificate.CommonName)

ExpectProxy mocks base method

func (*MockMeshCataloger) GetIngressRoutesPerHost added in v0.4.1

func (m *MockMeshCataloger) GetIngressRoutesPerHost(arg0 service.MeshService) (map[string][]trafficpolicy.HTTPRouteMatch, error)

GetIngressRoutesPerHost 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) GetResolvableHostnamesForUpstreamService added in v0.5.0

func (m *MockMeshCataloger) GetResolvableHostnamesForUpstreamService(arg0, arg1 service.MeshService) ([]string, error)

GetResolvableHostnamesForUpstreamService 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) GetSMISpec added in v0.4.1

func (m *MockMeshCataloger) GetSMISpec() smi.MeshSpec

GetSMISpec mocks base method

func (*MockMeshCataloger) GetServicesForServiceAccount added in v0.4.1

func (m *MockMeshCataloger) GetServicesForServiceAccount(arg0 service.K8sServiceAccount) ([]service.MeshService, error)

GetServicesForServiceAccount mocks base method

func (*MockMeshCataloger) GetServicesFromEnvoyCertificate added in v0.4.1

func (m *MockMeshCataloger) GetServicesFromEnvoyCertificate(arg0 certificate.CommonName) ([]service.MeshService, error)

GetServicesFromEnvoyCertificate mocks base method

func (*MockMeshCataloger) GetWeightedClusterForService added in v0.4.1

func (m *MockMeshCataloger) GetWeightedClusterForService(arg0 service.MeshService) (service.WeightedCluster, error)

GetWeightedClusterForService mocks base method

func (*MockMeshCataloger) ListAllowedInboundServiceAccounts added in v0.6.0

func (m *MockMeshCataloger) ListAllowedInboundServiceAccounts(arg0 service.K8sServiceAccount) ([]service.K8sServiceAccount, error)

ListAllowedInboundServiceAccounts mocks base method

func (*MockMeshCataloger) ListAllowedInboundServices added in v0.4.1

func (m *MockMeshCataloger) ListAllowedInboundServices(arg0 service.MeshService) ([]service.MeshService, error)

ListAllowedInboundServices mocks base method

func (*MockMeshCataloger) ListAllowedOutboundServiceAccounts added in v0.6.0

func (m *MockMeshCataloger) ListAllowedOutboundServiceAccounts(arg0 service.K8sServiceAccount) ([]service.K8sServiceAccount, error)

ListAllowedOutboundServiceAccounts mocks base method

func (*MockMeshCataloger) ListAllowedOutboundServices added in v0.4.1

func (m *MockMeshCataloger) ListAllowedOutboundServices(arg0 service.MeshService) ([]service.MeshService, error)

ListAllowedOutboundServices mocks base method

func (*MockMeshCataloger) ListEndpointsForService added in v0.4.1

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

ListEndpointsForService mocks base method

func (*MockMeshCataloger) ListMonitoredNamespaces added in v0.4.1

func (m *MockMeshCataloger) ListMonitoredNamespaces() []string

ListMonitoredNamespaces mocks base method

func (*MockMeshCataloger) ListSMIPolicies added in v0.4.1

ListSMIPolicies mocks base method

func (*MockMeshCataloger) ListServiceAccountsForService added in v0.6.0

func (m *MockMeshCataloger) ListServiceAccountsForService(arg0 service.MeshService) ([]service.K8sServiceAccount, error)

ListServiceAccountsForService mocks base method

func (*MockMeshCataloger) ListTrafficPolicies added in v0.4.1

func (m *MockMeshCataloger) ListTrafficPolicies(arg0 service.MeshService) ([]trafficpolicy.TrafficTarget, error)

ListTrafficPolicies mocks base method

func (*MockMeshCataloger) RegisterProxy added in v0.4.1

func (m *MockMeshCataloger) RegisterProxy(arg0 *envoy.Proxy)

RegisterProxy mocks base method

func (*MockMeshCataloger) UnregisterProxy added in v0.4.1

func (m *MockMeshCataloger) UnregisterProxy(arg0 *envoy.Proxy)

UnregisterProxy 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) ExpectProxy added in v0.4.1

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

ExpectProxy indicates an expected call of ExpectProxy

func (*MockMeshCatalogerMockRecorder) GetIngressRoutesPerHost added in v0.4.1

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

GetIngressRoutesPerHost indicates an expected call of GetIngressRoutesPerHost

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) GetResolvableHostnamesForUpstreamService added in v0.5.0

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

GetResolvableHostnamesForUpstreamService indicates an expected call of GetResolvableHostnamesForUpstreamService

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) GetSMISpec added in v0.4.1

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

GetSMISpec indicates an expected call of GetSMISpec

func (*MockMeshCatalogerMockRecorder) GetServicesForServiceAccount added in v0.4.1

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

GetServicesForServiceAccount indicates an expected call of GetServicesForServiceAccount

func (*MockMeshCatalogerMockRecorder) GetServicesFromEnvoyCertificate added in v0.4.1

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

GetServicesFromEnvoyCertificate indicates an expected call of GetServicesFromEnvoyCertificate

func (*MockMeshCatalogerMockRecorder) GetWeightedClusterForService added in v0.4.1

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

GetWeightedClusterForService indicates an expected call of GetWeightedClusterForService

func (*MockMeshCatalogerMockRecorder) ListAllowedInboundServiceAccounts added in v0.6.0

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

ListAllowedInboundServiceAccounts indicates an expected call of ListAllowedInboundServiceAccounts

func (*MockMeshCatalogerMockRecorder) ListAllowedInboundServices added in v0.4.1

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

ListAllowedInboundServices indicates an expected call of ListAllowedInboundServices

func (*MockMeshCatalogerMockRecorder) ListAllowedOutboundServiceAccounts added in v0.6.0

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

ListAllowedOutboundServiceAccounts indicates an expected call of ListAllowedOutboundServiceAccounts

func (*MockMeshCatalogerMockRecorder) ListAllowedOutboundServices added in v0.4.1

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

ListAllowedOutboundServices indicates an expected call of ListAllowedOutboundServices

func (*MockMeshCatalogerMockRecorder) ListEndpointsForService added in v0.4.1

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

ListEndpointsForService indicates an expected call of ListEndpointsForService

func (*MockMeshCatalogerMockRecorder) ListMonitoredNamespaces added in v0.4.1

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

ListMonitoredNamespaces indicates an expected call of ListMonitoredNamespaces

func (*MockMeshCatalogerMockRecorder) ListSMIPolicies added in v0.4.1

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

ListSMIPolicies indicates an expected call of ListSMIPolicies

func (*MockMeshCatalogerMockRecorder) ListServiceAccountsForService added in v0.6.0

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

ListServiceAccountsForService indicates an expected call of ListServiceAccountsForService

func (*MockMeshCatalogerMockRecorder) ListTrafficPolicies added in v0.4.1

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

ListTrafficPolicies indicates an expected call of ListTrafficPolicies

func (*MockMeshCatalogerMockRecorder) RegisterProxy added in v0.4.1

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

RegisterProxy indicates an expected call of RegisterProxy

func (*MockMeshCatalogerMockRecorder) UnregisterProxy added in v0.4.1

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

UnregisterProxy indicates an expected call of UnregisterProxy

Jump to

Keyboard shortcuts

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