common

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

View Source
const (
	// PubSubPods topic
	PubSubPods pubsub.PubSubTopic = "pods"
	// PubSubEndpoints topic
	PubSubEndpoints pubsub.PubSubTopic = "endpoints"
	// PubSubSvc topic
	PubSubSvc pubsub.PubSubTopic = "svc"
	// PubSubNode topic
	PubSubNode pubsub.PubSubTopic = "node"
	// PubSubVeth topic
	PubSubVeth pubsub.PubSubTopic = "veth"
	// PubSubNamespace topic
	PubSubNamespace pubsub.PubSubTopic = "namespace"
	// PubSubFilterRule topic
	PubSubFilterRule pubsub.PubSubTopic = "filterrule"
	// PubSubAPIServer topic
	PubSubAPIServer pubsub.PubSubTopic = "apiserver"
)
View Source
const (
	APIServerEndpointName = "kubernetes-apiserver"
	// default value for annotations
	RetinaPodAnnotation      = "retina.sh"
	RetinaPodAnnotationValue = "observe"
)

Variables

View Source
var ErrNoIPFoundForEndpoint = errors.New("no IP found for endpoint")
View Source
var ErrNoPrimaryIPFoundEndpoint = errors.New("no primary IP found for endpoint")

Functions

This section is empty.

Types

type APIServerObject

type APIServerObject struct {
	EP *RetinaEndpoint
}

func NewAPIServerObject

func NewAPIServerObject(stringIPs []string) *APIServerObject

func (*APIServerObject) DeepCopy

func (a *APIServerObject) DeepCopy() interface{}

func (*APIServerObject) IPs

func (a *APIServerObject) IPs() []net.IP

type BaseObject

type BaseObject struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

BaseObject is a common struct that is embedded in all objects that are published.

func GetBaseObject

func GetBaseObject(name, namespace string, ips *IPAddresses) BaseObject

func (*BaseObject) DeepCopy

func (b *BaseObject) DeepCopy() BaseObject

func (*BaseObject) IPs

func (b *BaseObject) IPs() *IPAddresses

func (*BaseObject) Key

func (b *BaseObject) Key() string

func (*BaseObject) Name

func (b *BaseObject) Name() string

func (*BaseObject) Namespace

func (b *BaseObject) Namespace() string

func (*BaseObject) NamespacedName

func (b *BaseObject) NamespacedName() string

type DirtyCache

type DirtyCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDirtyCache

func NewDirtyCache() *DirtyCache

func (*DirtyCache) ClearAdd

func (d *DirtyCache) ClearAdd()

func (*DirtyCache) ClearDelete

func (d *DirtyCache) ClearDelete()

func (*DirtyCache) GetAddList

func (d *DirtyCache) GetAddList() []interface{}

func (*DirtyCache) GetDeleteList

func (d *DirtyCache) GetDeleteList() []interface{}

func (*DirtyCache) ToAdd

func (d *DirtyCache) ToAdd(key string, obj interface{})

func (*DirtyCache) ToDelete

func (d *DirtyCache) ToDelete(key string, obj interface{})

type IPAddresses

type IPAddresses struct {
	IPv4       net.IP
	IPv6       net.IP
	OtherIPv4s []net.IP
	OtherIPv6s []net.IP
}

IPAddresses represents a set of IP addresses.

func NewIPAddress

func NewIPAddress(ipv4, ipv6 net.IP) *IPAddresses

func (*IPAddresses) AddIPv4

func (i *IPAddresses) AddIPv4(ip net.IP)

func (*IPAddresses) AddIPv6

func (i *IPAddresses) AddIPv6(ip net.IP)

func (*IPAddresses) DeepCopy

func (i *IPAddresses) DeepCopy() *IPAddresses

func (*IPAddresses) GetIPs

func (i *IPAddresses) GetIPs() []string

func (*IPAddresses) GetNetIPs added in v0.0.9

func (i *IPAddresses) GetNetIPs() []net.IP

func (*IPAddresses) GetNetIPv4s added in v0.0.9

func (i *IPAddresses) GetNetIPv4s() []net.IP

func (*IPAddresses) GetNetIPv6s added in v0.0.9

func (i *IPAddresses) GetNetIPv6s() []net.IP

func (*IPAddresses) PrimaryIP

func (i *IPAddresses) PrimaryIP() string

func (*IPAddresses) PrimaryNetIP

func (i *IPAddresses) PrimaryNetIP() net.IP

type OwnerReference

type OwnerReference struct {
	APIVersion string
	Kind       string
	Name       string
	UID        string
	Controller bool
}

OwnerReference contains enough information to let you identify an owning object. Reference: https://github.com/kubernetes/apimachinery/blob/v0.26.4/pkg/apis/meta/v1/types.go#L291

func (*OwnerReference) DeepCopy

func (o *OwnerReference) DeepCopy() *OwnerReference

type PublishObj

type PublishObj interface {
	DeepCopy() interface{}
}

PublishObj is an interface that all objects that are published

type RetinaContainer

type RetinaContainer struct {
	Name string
	ID   string
}

RetinaContainer represents a container in a Kubernetes endpoint.

func (*RetinaContainer) DeepCopy

func (c *RetinaContainer) DeepCopy() *RetinaContainer

type RetinaEndpoint

type RetinaEndpoint struct {
	BaseObject
	// contains filtered or unexported fields
}

RetinaEndpoint represents a Kubernetes endpoint.

func NewRetinaEndpoint

func NewRetinaEndpoint(name, namespace string, ips *IPAddresses) *RetinaEndpoint

func RetinaEndpointCommonFromAPI

func RetinaEndpointCommonFromAPI(retinaEndpoint *retinav1alpha1.RetinaEndpoint) *RetinaEndpoint

func RetinaEndpointCommonFromPod

func RetinaEndpointCommonFromPod(pod *corev1.Pod) *RetinaEndpoint

func (*RetinaEndpoint) Annotations

func (ep *RetinaEndpoint) Annotations() map[string]string

func (*RetinaEndpoint) Containers

func (ep *RetinaEndpoint) Containers() []*RetinaContainer

func (*RetinaEndpoint) DeepCopy

func (ep *RetinaEndpoint) DeepCopy() interface{}

func (*RetinaEndpoint) FormattedLabels

func (ep *RetinaEndpoint) FormattedLabels() []string

func (*RetinaEndpoint) IPs

func (ep *RetinaEndpoint) IPs() ([]string, error)

func (*RetinaEndpoint) Labels

func (ep *RetinaEndpoint) Labels() map[string]string

func (*RetinaEndpoint) NetIPs added in v0.0.9

func (ep *RetinaEndpoint) NetIPs() *IPAddresses

func (*RetinaEndpoint) OwnerRefs

func (ep *RetinaEndpoint) OwnerRefs() []*OwnerReference

func (*RetinaEndpoint) PrimaryIP

func (ep *RetinaEndpoint) PrimaryIP() (string, error)

func (*RetinaEndpoint) PrimaryNetIP

func (ep *RetinaEndpoint) PrimaryNetIP() (net.IP, error)

func (*RetinaEndpoint) SetAnnotations

func (ep *RetinaEndpoint) SetAnnotations(annotations map[string]string)

func (*RetinaEndpoint) SetContainers

func (ep *RetinaEndpoint) SetContainers(containers []*RetinaContainer)

func (*RetinaEndpoint) SetIPs

func (ep *RetinaEndpoint) SetIPs(ips *IPAddresses)

func (*RetinaEndpoint) SetLabels

func (ep *RetinaEndpoint) SetLabels(labels map[string]string)

func (*RetinaEndpoint) SetOwnerRefs

func (ep *RetinaEndpoint) SetOwnerRefs(ownerRefs []*OwnerReference)

type RetinaNode

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

RetinaNode represents a Kubernetes node.

func NewRetinaNode

func NewRetinaNode(name string, ip net.IP) *RetinaNode

func (*RetinaNode) DeepCopy

func (n *RetinaNode) DeepCopy() interface{}

func (*RetinaNode) IPString

func (n *RetinaNode) IPString() string

func (*RetinaNode) Name

func (n *RetinaNode) Name() string

type RetinaSvc

type RetinaSvc struct {
	BaseObject
	// contains filtered or unexported fields
}

RetinaSvc represents a Kubernetes service. ClusterIPs are saved as IPs in base object.

func NewRetinaSvc

func NewRetinaSvc(name, namespace string, ips *IPAddresses, lbIP net.IP, selector map[string]string) *RetinaSvc

func (*RetinaSvc) DeepCopy

func (s *RetinaSvc) DeepCopy() interface{}

func (*RetinaSvc) GetPrimaryIP

func (s *RetinaSvc) GetPrimaryIP() (string, error)

func (*RetinaSvc) IPs

func (s *RetinaSvc) IPs() *IPAddresses

func (*RetinaSvc) LBIP

func (s *RetinaSvc) LBIP() net.IP

func (*RetinaSvc) Selector

func (s *RetinaSvc) Selector() map[string]string

func (*RetinaSvc) SetIPs

func (s *RetinaSvc) SetIPs(ips *IPAddresses)

func (*RetinaSvc) SetLBIP

func (s *RetinaSvc) SetLBIP(lbIP net.IP)

func (*RetinaSvc) SetSelector

func (s *RetinaSvc) SetSelector(selector map[string]string)

Directories

Path Synopsis
package apiretry provides the retry logic for API calls.
package apiretry provides the retry logic for API calls.

Jump to

Keyboard shortcuts

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