service

package
v0.0.0-...-4b75dde Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

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

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

IngressTrafficMatchName returns the ingress traffic match name

func RateLimitServiceClusterName

func RateLimitServiceClusterName(svc policyv1alpha1.RateLimitServiceSpec) string

RateLimitServiceClusterName returns the cluster name used for the global rate limit service

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
	Name string

	// Subdomain is the subdomain of the service. This is currently only populated if the service is a headless service
	// backed by a single pod.
	Subdomain 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

func (ms MeshService) EnvoyClusterName() string

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

func (MeshService) EnvoyLocalClusterName

func (ms MeshService) EnvoyLocalClusterName() string

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

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

func (ms MeshService) OutboundTrafficMatchName() string

OutboundTrafficMatchName returns the MeshService outbound traffic match name

func (MeshService) ServerName

func (ms MeshService) ServerName() string

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

func (MeshService) String

func (ms MeshService) String() string

String returns the string representation of the given MeshService.

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