cache

package
v0.0.0-...-e1628ab Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultSessionAffinityTimeout int32 = 10800
)
View Source
const PortNameIndex = "PortNameIndex"
View Source
const ServicePortIndex = "ServicePortIndex"

Variables

This section is empty.

Functions

func GenBackendKey

func GenBackendKey(ip string, port int32, protocol corev1.Protocol) string

func GenServicePortRef

func GenServicePortRef(svcNs, svcName, portName string) string

func GenSvcID

func GenSvcID(svcNS string, svcName string) string

func GenSvcPortKey

func GenSvcPortKey(ns, name string) string

func GetClusterIPs

func GetClusterIPs(spec corev1.ServiceSpec) []string

func GetNsAndNameFromSvcID

func GetNsAndNameFromSvcID(svcID string) (string, string)

func NewBackendCache

func NewBackendCache() cache.Indexer

func NewBaseSvcCache

func NewBaseSvcCache() cache.Indexer

func NewSvcPortCache

func NewSvcPortCache() cache.Indexer

Types

type Backend

type Backend struct {
	IP              string
	Protocol        corev1.Protocol
	Port            int32
	Node            string
	ServicePortRefs sets.String
}

func (*Backend) DeepCopy

func (b *Backend) DeepCopy() *Backend

type BaseSvc

type BaseSvc struct {
	// SvcID is unique identifier of BaseSvc, it should be set svcNamespace/svcName
	SvcID   string
	SvcType corev1.ServiceType

	ClusterIPs []string
	// Ports the key is portname
	Ports map[string]*Port

	// ExternalTrafficPolicy ClusterIP doesn't use it
	ExternalTrafficPolicy ertype.TrafficPolicyType
	InternalTrafficPolicy ertype.TrafficPolicyType

	SessionAffinity corev1.ServiceAffinity
	// SessionAffinityTimeout,the unit is seconds
	SessionAffinityTimeout int32
}

BaseSvc store a service base info

func ServiceToBaseSvc

func ServiceToBaseSvc(svc *corev1.Service) *BaseSvc

func (*BaseSvc) ChangeAffinityMode

func (b *BaseSvc) ChangeAffinityMode(new *BaseSvc) bool

func (*BaseSvc) ChangeAffinityTimeout

func (b *BaseSvc) ChangeAffinityTimeout(new *BaseSvc) bool

func (*BaseSvc) DeepCopy

func (b *BaseSvc) DeepCopy() *BaseSvc

func (*BaseSvc) DiffClusterIPs

func (b *BaseSvc) DiffClusterIPs(new *BaseSvc) (add, del []string)

func (*BaseSvc) DiffPorts

func (b *BaseSvc) DiffPorts(new *BaseSvc) (add, update, del []*Port)

func (*BaseSvc) ListPorts

func (b *BaseSvc) ListPorts() []*Port

type Port

type Port struct {
	// Name represents the associated name with this Port number.
	Name string
	// Protocol for port. Must be UDP, TCP  TODO not icmp webhook
	Protocol corev1.Protocol
	// Port represents the ClusterIP Service Port number.
	Port int32
	// Nodeport represents the NodePort Service NodePort number.
	NodePort int32
}

Port is service port info

type SvcPort

type SvcPort struct {
	Name      string
	Namespace string
	PortName  string
	SvcName   string
}

func GenSvcPortFromServicePort

func GenSvcPortFromServicePort(servicePort *everoutesvc.ServicePort) *SvcPort

Jump to

Keyboard shortcuts

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