types

package
v0.0.0-...-606a1df Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Addresses

func Addresses(n *v1.Node) []string

func IPV4

func IPV4(n *v1.Node) string

func IPV6

func IPV6(n *v1.Node) string

func IsEligibleBackend

func IsEligibleBackend(n *v1.Node, labels map[string]string, ip string, ignoreCordon bool, v6 bool, skipMasterNode bool) (bool, string)

func IsEligibleBackendV4

func IsEligibleBackendV4(n *v1.Node, labels map[string]string, ip string, ignoreCordon bool, skipMasterNode bool) (bool, string)

func IsEligibleBackendV6

func IsEligibleBackendV6(n *v1.Node, labels map[string]string, ip string, ignoreCordon bool, skipMasterNode bool) (bool, string)

func IsInReadyState

func IsInReadyState(n *v1.Node) bool

func IsUnschedulable

func IsUnschedulable(n *v1.Node) bool

func MakeIdent

func MakeIdent(namespace, service, portName string) string

MakeIdent standardizes a string construction used in packages nodes and watcher

func NodeEqual

func NodeEqual(a, b *v1.Node) bool

NodeEqual returns a boolean value indicating whether two nodes are EQUAL

func NodesEqual

func NodesEqual(a []*v1.Node, b []*v1.Node) bool

NodesEqual returns a boolean value indicating whether the contents of the two passed NodesLists are equivalent.

Types

type ClusterConfig

type ClusterConfig struct {
	sync.RWMutex
	VIPPool    []string              `json:"vipPool"`
	MTUConfig  map[ServiceIP]string  `json:"mtuConfig"`
	MTUConfig6 map[ServiceIP]string  `json:"mtuConfig6"`
	NodeLabels map[string]string     `json:"labels"`
	IPV6       map[ServiceIP]string  `json:"ipv6"`
	Config     map[ServiceIP]PortMap `json:"config"`
	Config6    map[ServiceIP]PortMap `json:"config6"`
}

ClusterConfig is a representation of an input configuration for this iptables management utility.

Configuration must support the following use cases: - multiple namespaces - multiple VIPs - multiple namespaces per VIP - redundant definitions for the same service (i.e. rio/manifest-agent on 1.2.3.4:8765 and 1.2.3.5:80)

i.e. sharing a single VIP across a pile of namespaces and services, all with different (but unique for the VIP) input ports

func NewClusterConfig

func NewClusterConfig(config *v1.ConfigMap, configKey string) (*ClusterConfig, error)

func (*ClusterConfig) Validate

func (c *ClusterConfig) Validate() error

type IPVSOptions

type IPVSOptions struct {

	// RawUThreshold is the upper bound beyond which (active+inactive) connections are no longer
	// permitted.
	RawUThreshold int `json:"uThreshold"`
	// RawLThreshold is the lower bound below which active conncections must fall before
	// new connections are accepted.
	RawLThreshold int `json:"lThreshold"`

	// can be either 'g' or 'i', indicating DSR or TUN mode.
	// -g
	RawForwardingMethod string `json:"forwardingMethod"`

	// Scheduler is the way that connections are load balanced to the realservers. defaults to 'wrr'
	// -s wrr
	RawScheduler string `json:"scheduler"`

	// Flags are optional args for a new virtual server
	// if flags: -b <flag-1>,<flag-2>,... (default empty)
	Flags string `json:"flags"`
}

IPVSOptions contains per-service options for the IPVS configuration. http://kb.linuxvirtualserver.org/wiki/Ipvsadm

func (*IPVSOptions) ForwardingMethod

func (i *IPVSOptions) ForwardingMethod() string

ForwardingMethod outupts the forwarding method

func (*IPVSOptions) LThreshold

func (i *IPVSOptions) LThreshold() int

RawLThreshold outputs the lower threshold

func (*IPVSOptions) Scheduler

func (i *IPVSOptions) Scheduler() string

Scheduler returns a scheduler

func (*IPVSOptions) UThreshold

func (i *IPVSOptions) UThreshold() int

UThreshold outputs the upper threshold

type KubeRules

type KubeRules struct {
	Masq RulesSet
	Jump RulesSet
}

KubeRules contains two sets of iptables rules for insertion or management, one of MASQ instructions, and one of JUMP instructions. There is a 1:1 correspondance between masq and jump rules in iptables.

This structure is used in order to ensure that the rules are always paired together. In particular, the compareAndPrune and compareAndCreate functions always manage generated rules together. This ensures that the rules are represented in the correct order inside of iptables.

type PortMap

type PortMap map[string]*ServiceDef

PortMap stores a mapping of ports to service definitions.

type RulesSet

type RulesSet []string

RulesSet is a list of iptables rules.

type ServiceDef

type ServiceDef struct {
	Namespace string `json:"namespace"`
	Service   string `json:"service"`
	PortName  string `json:"portName"`

	// Here, the ServiceDef also defines x,y connection limits for IPVS, as well
	// as any other per-LB options
	IPVSOptions IPVSOptions `json:"ipvsOptions"`

	IPV4Enabled          bool `json:"ipv4Enabled"`
	IPV6Enabled          bool `json:"ipv6Enabled"`
	TCPEnabled           bool `json:"tcpEnabled"`
	UDPEnabled           bool `json:"udpEnabled"`
	ProxyProtocolEnabled bool `json:"proxyProtocolEnabled"`
}

ServiceDef stores a Namespace/Service mapping for input from the user, and stores ancillary data collected from iptables about the configuration of that service.

func NewServiceDef

func NewServiceDef(s string) (*ServiceDef, error)

NewServiceDef accepts a kubernetes-formatted "namespace/service:port" identifier and outputs a populated ServiceDef

type ServiceIP

type ServiceIP string

ServiceIP stores a service VIP for iptables and IPVS to manage.

Jump to

Keyboard shortcuts

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