service

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package service is a generated GoMock package.

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessControlTrafficMatchName

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

AccessControlTrafficMatchName returns the acl traffic match name

func ExportedServiceTrafficMatchName

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

ExportedServiceTrafficMatchName returns the export service traffic match name

func IngressTrafficMatchName

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

func (c ClusterName) String() string

String returns the given ClusterName type as a string

type Locality

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

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

	// ServiceImportUID is the uid of service import
	ServiceImportUID types.UID

	// CloudInheritedFrom is the cloud service Inherited From
	CloudInheritedFrom string

	// ClusterID is the cluster id
	ClusterID string
}

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

func (MeshService) AccessControlTrafficMatchName

func (ms MeshService) AccessControlTrafficMatchName() string

AccessControlTrafficMatchName returns the acl traffic match name

func (MeshService) FQDN

func (ms MeshService) FQDN() string

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

func (MeshService) InboundTrafficMatchName

func (ms MeshService) InboundTrafficMatchName() string

InboundTrafficMatchName returns the MeshService inbound traffic match name

func (MeshService) IngressTrafficMatchName

func (ms MeshService) IngressTrafficMatchName() string

IngressTrafficMatchName returns the ingress traffic match name

func (*MeshService) IsMultiClusterService

func (ms *MeshService) IsMultiClusterService() bool

IsMultiClusterService checks whether it is a multi cluster service

func (MeshService) NamespacedKey

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

func (ms MeshService) OutboundTrafficMatchName() string

OutboundTrafficMatchName returns the MeshService outbound traffic match name

func (*MeshService) ProviderKey

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

func (ms MeshService) ServerName() string

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

func (MeshService) SiblingTo

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

func (ms MeshService) SidecarClusterName() string

SidecarClusterName is the name of the cluster corresponding to the MeshService in Sidecar

func (MeshService) SidecarLocalClusterName

func (ms MeshService) SidecarLocalClusterName() string

SidecarLocalClusterName is the name of the local cluster corresponding to the MeshService in Sidecar

func (MeshService) String

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

func (ms *MeshService) Subdomain() string

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

type MockProvider

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

MockProvider is a mock of Provider interface.

func NewMockProvider

func NewMockProvider(ctrl *gomock.Controller) *MockProvider

NewMockProvider creates a new mock instance.

func (*MockProvider) EXPECT

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

func (*MockProvider) GetID

func (m *MockProvider) GetID() string

GetID mocks base method.

func (*MockProvider) GetServicesForServiceIdentity

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

GetServicesForServiceIdentity mocks base method.

func (*MockProvider) ListServiceIdentitiesForService

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

ListServiceIdentitiesForService mocks base method.

func (*MockProvider) ListServices

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

ListServices mocks base method.

type MockProviderMockRecorder

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

MockProviderMockRecorder is the mock recorder for MockProvider.

func (*MockProviderMockRecorder) GetID

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

GetID indicates an expected call of GetID.

func (*MockProviderMockRecorder) GetServicesForServiceIdentity

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

GetServicesForServiceIdentity indicates an expected call of GetServicesForServiceIdentity.

func (*MockProviderMockRecorder) ListServiceIdentitiesForService

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

ListServiceIdentitiesForService indicates an expected call of ListServiceIdentitiesForService.

func (*MockProviderMockRecorder) ListServices

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

ListServices indicates an expected call of ListServices.

type Provider

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