service

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package service is a generated GoMock package.

Package service models an instance of a service managed by OSM controller and utility routines associated with it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IngressTrafficMatchName added in v1.2.0

func IngressTrafficMatchName(name, namespace string, targetPort uint16, protocol string) string

IngressTrafficMatchName returns the ingress traffic match name

Types

type ClusterName

type ClusterName string

ClusterName is a type for a service name

func (ClusterName) String added in v0.6.0

func (c ClusterName) String() string

String returns the given ClusterName type as a string

type Locality added in v0.10.0

type Locality int

Locality is the relative locality of a service. ie: if a service is being accessed from the same namespace or a remote cluster.

const (
	// LocalNS refers to the local namespace within the local cluster.
	LocalNS Locality = iota

	// LocalCluster refers to access within the cluster, but not within the same namespace.
	LocalCluster

	// RemoteCluster refers to access from a different cluster.
	RemoteCluster
)

type MeshService added in v0.1.0

type MeshService struct {
	// If the service resides on a Kubernetes service, this would be the Kubernetes namespace.
	Namespace string

	// The name of the service. May include instance (e.g. pod) information if the backing service
	// doesn't have a single, stable ip address. For example, a MeshService created by a headless
	// Kubernetes service named mysql-headless, will have the name "mysql.mysql-headless"
	// A MeshService created by a normal ClusterIP service named mysql will be named "mysql"
	// This imposes a restriction that service names cannot contain "." (which is already
	// the case in kubernetes). Thus, MeshService.Name will be of the form: [subdomain.]providerKey
	Name string

	// Port is the port number that clients use to access the service.
	// This can be different than MeshService.TargetPort which represents the actual port number
	// the application is accepting connections on.
	// Port maps to ServicePort.Port in k8s: https://pkg.go.dev/k8s.io/api/core/v1#ServicePort
	Port uint16

	// TargetPort is the port number on which an application accept traffic directed to this MeshService
	// This can be different than MeshService.Port in k8s.
	// TargetPort maps to ServicePort.TargetPort in k8s: https://pkg.go.dev/k8s.io/api/core/v1#ServicePort
	TargetPort uint16

	// Protocol is the protocol served by the service's port
	Protocol string
}

MeshService is the struct representing a service (Kubernetes or otherwise) within the service mesh.

func (MeshService) EnvoyClusterName added in v0.11.0

func (ms MeshService) EnvoyClusterName() string

EnvoyClusterName is the name of the cluster corresponding to the MeshService in Envoy

func (MeshService) EnvoyLocalClusterName added in v0.11.0

func (ms MeshService) EnvoyLocalClusterName() string

EnvoyLocalClusterName is the name of the local cluster corresponding to the MeshService in Envoy

func (MeshService) FQDN added in v0.10.0

func (ms MeshService) FQDN() string

FQDN is similar to String(), but uses a dot separator and is in a different order.

func (MeshService) InboundTrafficMatchName added in v1.2.0

func (ms MeshService) InboundTrafficMatchName() string

InboundTrafficMatchName returns the MeshService inbound traffic match name

func (MeshService) IngressTrafficMatchName added in v1.2.0

func (ms MeshService) IngressTrafficMatchName() string

IngressTrafficMatchName returns the ingress traffic match name

func (MeshService) NamespacedKey added in v1.2.0

func (ms MeshService) NamespacedKey() string

NamespacedKey is the key (i.e. namespace + ProviderKey()) with which to lookup the backing service within the provider

func (MeshService) OutboundTrafficMatchName added in v1.2.0

func (ms MeshService) OutboundTrafficMatchName() string

OutboundTrafficMatchName returns the MeshService outbound traffic match name

func (*MeshService) ProviderKey added in v1.2.0

func (ms *MeshService) ProviderKey() string

ProviderKey represents the name of the original entity from which this MeshService was created (e.g. a Kubernetes service name) TODO: possibly memoize if performance suffers

func (MeshService) ServerName added in v0.6.0

func (ms MeshService) ServerName() string

ServerName returns the Server Name Identifier (SNI) for TLS connections

func (MeshService) SiblingTo added in v1.2.0

func (ms MeshService) SiblingTo(svc MeshService) bool

SiblingTo returns true if svc and ms are derived from the same resource in the service provder (based on namespace and provider key)

func (MeshService) String added in v0.1.0

func (ms MeshService) String() string

String returns the string representation of the given MeshService. SHOULD NOT BE USED AS A MAPPING FOR ANYTHING. Use NamespacedKey and Subdomain

func (*MeshService) Subdomain added in v1.2.0

func (ms *MeshService) Subdomain() string

Subdomain is an optional subdomain for this MeshService TODO: possibly memoize if performance suffers

type MockProvider added in v0.10.0

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

MockProvider is a mock of Provider interface.

func NewMockProvider added in v0.10.0

func NewMockProvider(ctrl *gomock.Controller) *MockProvider

NewMockProvider creates a new mock instance.

func (*MockProvider) EXPECT added in v0.10.0

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

func (*MockProvider) GetID added in v0.10.0

func (m *MockProvider) GetID() string

GetID mocks base method.

func (*MockProvider) GetServicesForServiceIdentity added in v0.10.0

func (m *MockProvider) GetServicesForServiceIdentity(arg0 identity.ServiceIdentity) []MeshService

GetServicesForServiceIdentity mocks base method.

func (*MockProvider) ListServiceIdentitiesForService added in v0.10.0

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

ListServiceIdentitiesForService mocks base method.

func (*MockProvider) ListServices added in v0.10.0

func (m *MockProvider) ListServices() []MeshService

ListServices mocks base method.

type MockProviderMockRecorder added in v0.10.0

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

MockProviderMockRecorder is the mock recorder for MockProvider.

func (*MockProviderMockRecorder) GetID added in v0.10.0

func (mr *MockProviderMockRecorder) GetID() *gomock.Call

GetID indicates an expected call of GetID.

func (*MockProviderMockRecorder) GetServicesForServiceIdentity added in v0.10.0

func (mr *MockProviderMockRecorder) GetServicesForServiceIdentity(arg0 interface{}) *gomock.Call

GetServicesForServiceIdentity indicates an expected call of GetServicesForServiceIdentity.

func (*MockProviderMockRecorder) ListServiceIdentitiesForService added in v0.10.0

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

ListServiceIdentitiesForService indicates an expected call of ListServiceIdentitiesForService.

func (*MockProviderMockRecorder) ListServices added in v0.10.0

func (mr *MockProviderMockRecorder) ListServices() *gomock.Call

ListServices indicates an expected call of ListServices.

type Provider added in v0.10.0

type Provider interface {
	// GetServicesForServiceIdentity retrieves the namespaced services for a given service identity
	GetServicesForServiceIdentity(identity.ServiceIdentity) []MeshService

	// ListServices returns a list of services that are part of monitored namespaces
	ListServices() []MeshService

	// ListServiceIdentitiesForService returns service identities for given service
	ListServiceIdentitiesForService(MeshService) []identity.ServiceIdentity

	// GetID returns the unique identifier of the Provider
	GetID() string
}

Provider is an interface to be implemented by components abstracting Kubernetes, and other compute/cluster providers

type WeightedCluster

type WeightedCluster struct {
	ClusterName ClusterName `json:"cluster_name:omitempty"`
	Weight      int         `json:"weight:omitempty"`
}

WeightedCluster is a struct of a cluster and is weight that is backing a service

Jump to

Keyboard shortcuts

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