Documentation ¶
Index ¶
- Constants
- func Append(buffer *bytes.Buffer, chain string, rule []string)
- func AppendUnique(buffer *bytes.Buffer, chain string, rule []string)
- func CloseCloserDisregardError(handler io.Closer)
- func ClusterIPIsNone(clusterIP string) bool
- func ClusterIPIsNoneOrBlank(clusterIP string) bool
- func ContainsIPv4Address(addrs []string) bool
- func ContainsIPv6Address(addrs []string) bool
- func GetNodeObject(clientset kubernetes.Interface, hostnameOverride string) (*apiv1.Node, error)
- func GetNodeSubnet(nodeIP net.IP, linkQ LocalLinkQuerier) (net.IPNet, string, error)
- func GetPodCIDRsFromNodeSpecDualStack(node *v1core.Node) ([]string, []string, error)
- func GetPodCidrFromNodeSpec(node *v1core.Node) (string, error)
- func IPSetName(setName string, isIPv6 bool) string
- func NewCNINetworkConfig(cniConfFilePath string) (*cniNetworkConfig, error)
- func PartialJSONMarshal(r rawMapAble) ([]byte, error)
- func PartialJSONUnmarshal(r rawMapAble, bytes []byte) error
- func RouteTableAdd(tableNumber, tableName string) error
- func SaveInto(iptablesBinary, table string, buffer *bytes.Buffer) error
- func ServiceForEndpointSlice(ci *cache.Indexer, es *discovery.EndpointSlice) (interface{}, bool, error)
- func ServiceForEndpoints(ci *cache.Indexer, ep *v1core.Endpoints) (interface{}, bool, error)
- func ServiceHasNoClusterIP(obj interface{}) bool
- func ServiceNameforEndpointSlice(es *discovery.EndpointSlice) (string, error)
- func SliceContainsString(needle string, haystack []string) bool
- func TCPAddressBindable(addr string, port uint16) error
- type Broadcaster
- type Conf
- type ConfList
- type Entry
- type FakeLocalLinkQuerier
- type ICMPRule
- type IPAM
- type IPSet
- func (ipset *IPSet) Add(set *Set) error
- func (ipset *IPSet) Create(setName string, createOptions ...string) (*Set, error)
- func (ipset *IPSet) Destroy(setName string) error
- func (ipset *IPSet) DestroyAllWithin() error
- func (ipset *IPSet) Flush() error
- func (ipset *IPSet) Get(setName string) *Set
- func (ipset *IPSet) Name(setName string) string
- func (ipset *IPSet) RefreshSet(setName string, entriesWithOptions [][]string, setType string)
- func (ipset *IPSet) Restore() error
- func (ipset *IPSet) Save() error
- func (ipset *IPSet) Sets() map[string]*Set
- type IPSetHandler
- type IPTablesHandler
- type IPTablesSaveRestore
- type IPTablesSaveRestorer
- type KRNode
- func (n *KRNode) FindBestIPv4NodeAddress() net.IP
- func (n *KRNode) FindBestIPv6NodeAddress() net.IP
- func (n *KRNode) GetNodeIPAddrs() []net.IP
- func (n *KRNode) GetNodeIPv4Addrs() []net.IP
- func (n *KRNode) GetNodeIPv6Addrs() []net.IP
- func (n *KRNode) GetNodeName() string
- func (n *KRNode) GetPrimaryNodeIP() net.IP
- func (n *KRNode) IsIPv4Capable() bool
- func (n *KRNode) IsIPv6Capable() bool
- type Listener
- type ListenerFunc
- type LocalKRNode
- type LocalLinkQuerier
- type MockLocalLinkQuerier
- type NodeAware
- type NodeFamilyAware
- type NodeIPAndFamilyAware
- type NodeIPAware
- type NodeInterfaceAware
- type NodeNameAware
- type Range
- type Set
- type SysctlError
Constants ¶
const ( // FamillyInet IPV4. FamillyInet = "inet" // FamillyInet6 IPV6. FamillyInet6 = "inet6" // DefaultMaxElem Default OptionMaxElem value. DefaultMaxElem = "65536" // DefaultHasSize Defaul OptionHashSize value. DefaultHasSize = "1024" // TypeHashIP The hash:ip set type uses a hash to store IP host addresses (default) or network addresses. Zero // valued IP address cannot be stored in a hash:ip type of set. TypeHashIP = "hash:ip" // TypeHashMac The hash:mac set type uses a hash to store MAC addresses. Zero valued MAC addresses cannot be stored // in a hash:mac type of set. TypeHashMac = "hash:mac" // TypeHashNet The hash:net set type uses a hash to store different sized IP network addresses. Network address with // zero prefix size cannot be stored in this type of sets. TypeHashNet = "hash:net" // TypeHashNetNet The hash:net,net set type uses a hash to store pairs of different sized IP network addresses. Bear // in mind that the first parameter has precedence over the second, so a nomatch entry could be potentially be // ineffective if a more specific first parameter existed with a suitable second parameter. Network address with // zero prefix size cannot be stored in this type of set. TypeHashNetNet = "hash:net,net" // TypeHashIPPort The hash:ip,port set type uses a hash to store IP address and port number pairs. The port number // is interpreted together with a protocol (default TCP) and zero protocol number cannot be used. TypeHashIPPort = "hash:ip,port" // TypeHashNetPort The hash:net,port set type uses a hash to store different sized IP network address and port // pairs. The port number is interpreted together with a protocol (default TCP) and zero protocol number cannot be // used. Network address with zero prefix size is not accepted either. TypeHashNetPort = "hash:net,port" // TypeHashIPPortIP The hash:ip,port,ip set type uses a hash to store IP address, port number and a second IP // address triples. The port number is interpreted together with a protocol (default TCP) and zero protocol number // cannot be used. TypeHashIPPortIP = "hash:ip,port,ip" // TypeHashIPPortNet The hash:ip,port,net set type uses a hash to store IP address, port number and IP network // address triples. The port number is interpreted together with a protocol (default TCP) and zero protocol number // cannot be used. Network address with zero prefix size cannot be stored either. TypeHashIPPortNet = "hash:ip,port,net" // TypeHashIPMark The hash:ip,mark set type uses a hash to store IP address and packet mark pairs. TypeHashIPMark = "hash:ip,mark" // TypeHashIPNetPortNet The hash:net,port,net set type behaves similarly to hash:ip,port,net but accepts a cidr // value for both the first and last parameter. Either subnet is permitted to be a /0 should you wish to match port // between all destinations. TypeHashIPNetPortNet = "hash:net,port,net" // TypeHashNetIface The hash:net,iface set type uses a hash to store different sized IP network address and // interface name pairs. TypeHashNetIface = "hash:net,iface" // TypeListSet The list:set type uses a simple list in which you can store set names. TypeListSet = "list:set" // OptionTimeout All set types supports the optional timeout parameter when creating a set and adding entries. The // value of the timeout parameter for the create command means the default timeout value (in seconds) for new // entries. If a set is created with timeout support, then the same timeout option can be used to specify // non-default timeout values when adding entries. Zero timeout value means the entry is added permanent to the // set. The timeout value of already added elements can be changed by readding the element using the -exist option. // When listing the set, the number of entries printed in the header might be larger than the listed number of // entries for sets with the timeout extensions: the number of entries in the set is updated when elements // added/deleted to the set and periodically when the garbage colletor evicts the timed out entries. OptionTimeout = "timeout" // OptionCounters All set types support the optional counters option when creating a set. If the option is specified // then the set is created with packet and byte counters per element support. The packet and byte counters are // initialized to zero when the elements are (re-)added to the set, unless the packet and byte counter values are // explicitly specified by the packets and bytes options. An example when an element is added to a set with non-zero // counter values. OptionCounters = "counters" // OptionPackets All set types support the optional counters option when creating a set. If the option is specified // then the set is created with packet and byte counters per element support. The packet and byte counters are // initialized to zero when the elements are (re-)added to the set, unless the packet and byte counter values are // explicitly specified by the packets and bytes options. An example when an element is added to a set with non-zero // counter values. OptionPackets = "packets" // OptionBytes All set types support the optional counters option when creating a set. If the option is specified // then the set is created with packet and byte counters per element support. The packet and byte counters are // initialized to zero when the elements are (re-)added to the set, unless the packet and byte counter values are // explicitly specified by the packets and bytes options. An example when an element is added to a set with non-zero // counter values. OptionBytes = "bytes" // OptionComment All set types support the optional comment extension. Enabling this extension on an ipset enables // you to annotate an ipset entry with an arbitrary string. This string is completely ignored by both the kernel and // ipset itself and is purely for providing a convenient means to document the reason for an entry's existence. // Comments must not contain any quotation marks and the usual escape character (\) has no meaning. OptionComment = "comment" // OptionSkbinfo All set types support the optional skbinfo extension. This extension allow to store the metainfo // (firewall mark, tc class and hardware queue) with every entry and map it to packets by usage of SET netfilter // target with --map-set option. skbmark option format: MARK or MARK/MASK, where MARK and MASK are 32bit hex numbers // with 0x prefix. If only mark is specified mask 0xffffffff are used. skbprio option has tc class format: // MAJOR:MINOR, where major and minor numbers are hex without 0x prefix. skbqueue option is just decimal number. OptionSkbinfo = "skbinfo" // OptionSkbmark All set types support the optional skbinfo extension. This extension allow to store the metainfo // (firewall mark, tc class and hardware queue) with every entry and map it to packets by usage of SET netfilter // target with --map-set option. skbmark option format: MARK or MARK/MASK, where MARK and MASK are 32bit hex numbers // with 0x prefix. If only mark is specified mask 0xffffffff are used. skbprio option has tc class format: //MAJOR:MINOR, where major and minor numbers are hex without 0x prefix. skbqueue option is just decimal number. OptionSkbmark = "skbmark" // OptionSkbprio All set types support the optional skbinfo extension. This extension allow to store the metainfo // (firewall mark, tc class and hardware queue) with every entry and map it to packets by usage of SET netfilter // target with --map-set option. skbmark option format: MARK or MARK/MASK, where MARK and MASK are 32bit hex numbers // with 0x prefix. If only mark is specified mask 0xffffffff are used. skbprio option has tc class format: // MAJOR:MINOR, where major and minor numbers are hex without 0x prefix. skbqueue option is just decimal number. OptionSkbprio = "skbprio" // OptionSkbqueue All set types support the optional skbinfo extension. This extension allow to store the metainfo // (firewall mark, tc class and hardware queue) with every entry and map it to packets by usage of SET netfilter // target with --map-set option. skbmark option format: MARK or MARK/MASK, where MARK and MASK are 32bit hex numbers // with 0x prefix. If only mark is specified mask 0xffffffff are used. skbprio option has tc class format: // MAJOR:MINOR, where major and minor numbers are hex without 0x prefix. skbqueue option is just decimal number. OptionSkbqueue = "skbqueue" // OptionHashSize This parameter is valid for the create command of all hash type sets. It defines the initial hash // size for the set, default is 1024. The hash size must be a power of two, the kernel automatically rounds up non // power of two hash sizes to the first correct value. OptionHashSize = "hashsize" // OptionMaxElem This parameter is valid for the create command of all hash type sets. It does define the maximal // number of elements which can be stored in the set, default 65536. OptionMaxElem = "maxelem" // OptionFamilly This parameter is valid for the create command of all hash type sets except for hash:mac. It // defines the protocol family of the IP addresses to be stored in the set. The default is inet, i.e IPv4. OptionFamilly = "family" // OptionNoMatch The hash set types which can store net type of data (i.e. hash:*net*) support the optional nomatch // option when adding entries. When matching elements in the set, entries marked as nomatch are skipped as if those // were not added to the set, which makes possible to build up sets with exceptions. See the example at hash type // hash:net below. When elements are tested by ipset, the nomatch flags are taken into account. If one wants to test // the existence of an element marked with nomatch in a set, then the flag must be specified too. OptionNoMatch = "nomatch" // OptionForceAdd All hash set types support the optional forceadd parameter when creating a set. When sets created // with this option become full the next addition to the set may succeed and evict a random entry from the set. OptionForceAdd = "forceadd" // IPv6SetPrefix is the prefix that ipset requires on IPv6 ipsets in order to distinguish them from IPv4 sets IPv6SetPrefix = "inet6" )
const ( ICMPv4Proto = "icmp" ICMPv4Type = "--icmp-type" ICMPv6Proto = "ipv6-icmp" ICMPv6Type = "--icmpv6-type" )
const ( // From what I can see there are no IPv6 equivalents for the below options, so we only consider IPv6 here // Network Services Configuration Paths IPv4IPVSConntrack = "net/ipv4/vs/conntrack" IPv4IPVSExpireNodestConn = "net/ipv4/vs/expire_nodest_conn" IPv4IPVSExpireQuiescent = "net/ipv4/vs/expire_quiescent_template" IPv4IPVSConnReuseMode = "net/ipv4/vs/conn_reuse_mode" IPv4ConfAllArpIgnore = "net/ipv4/conf/all/arp_ignore" IPv4ConfAllArpAnnounce = "net/ipv4/conf/all/arp_announce" IPv6ConfAllDisableIPv6 = "net/ipv6/conf/all/disable_ipv6" // Network Routes Configuration Paths BridgeNFCallIPTables = "net/bridge/bridge-nf-call-iptables" BridgeNFCallIP6Tables = "net/bridge/bridge-nf-call-ip6tables" // Template Configuration Paths IPv4ConfRPFilterTemplate = "net/ipv4/conf/%s/rp_filter" )
const (
IPInIPHeaderLength = 20
)
Variables ¶
This section is empty.
Functions ¶
func AppendUnique ¶
AppendUnique ensures that rule is in chain only once in the buffer and that the occurrence is at the end of the buffer
func CloseCloserDisregardError ¶
CloseCloserDisregardError it is a common need throughout kube-router's code base to need close a closer in defer statements, this allows an action like that to pass a linter as well as describe its intention well
func ClusterIPIsNone ¶
ClusterIPIsNone checks to see whether the ClusterIP contains "None" which would indicate that it is headless
func ClusterIPIsNoneOrBlank ¶
ClusterIPIsNoneOrBlank checks to see whether the ClusterIP contains "None" or is blank
func ContainsIPv4Address ¶
ContainsIPv4Address checks a given string array to see if it contains a valid IPv4 address within it
func ContainsIPv6Address ¶
ContainsIPv6Address checks a given string array to see if it contains a valid IPv6 address within it
func GetNodeObject ¶
GetNodeObject returns the node API object for the node
func GetNodeSubnet ¶ added in v2.3.0
GetNodeSubnet returns the subnet and interface name for a given node IP
func GetPodCIDRsFromNodeSpecDualStack ¶
GetPodCIDRsFromNodeSpecDualStack reads the IPv4 and IPv6 pod CIDR allocated to the node from API node object and returns them
func GetPodCidrFromNodeSpec ¶
GetPodCidrFromNodeSpec reads the pod CIDR allocated to the node from API node object and returns it
func IPSetName ¶ added in v2.1.1
IPSetName returns the proper set name for this component based upon whether or not it is an IPv6 set
func NewCNINetworkConfig ¶
func PartialJSONMarshal ¶
PartialJSONMarshal allows a struct that implements the rawMapAble interface to be fully restored without having to know about every possible field that may exist within the JSON. This is the reverse process of PartialJSONUnmarshal().
func PartialJSONUnmarshal ¶
PartialJSONUnmarshal allows a struct that implements the rawMapAble interface to be partially unmarshaled. This means that via this function we are able to parse and understand the fields that we know about and have defined in the struct without knowing every possible field. This still stores the unknown fields and they can be retrieved via the getRaw() function and restored properly via the PartialJSONMarshal() function.
func RouteTableAdd ¶ added in v2.1.1
RouteTableAdd adds a new named table to iproute's rt_tables configuration file
func ServiceForEndpointSlice ¶
func ServiceForEndpointSlice(ci *cache.Indexer, es *discovery.EndpointSlice) (interface{}, bool, error)
ServiceForEndpoints given EndpointSlice object return Service API object if it exists
func ServiceForEndpoints ¶
ServiceForEndpoints given Endpoint object return Service API object if it exists
func ServiceHasNoClusterIP ¶ added in v2.1.0
func ServiceHasNoClusterIP(obj interface{}) bool
ServiceHasNoClusterIP decides whether or not the this service is a headless service which is often useful to kube-router as there is no need to execute logic on most headless changes. Function takes a generic interface as its input parameter so that it can be used more easily in early processing if needed. If a non-service object is given, function will return false.
func ServiceNameforEndpointSlice ¶
func ServiceNameforEndpointSlice(es *discovery.EndpointSlice) (string, error)
ServiceNameforEndpointSlice returns the name of the service that created the EndpointSlice for a given EndpointSlice
With endpoints, the name of the endpoint object always matches the service object, however when it comes to EndpointSlices, things work a bit different as k8s' controller will autogenerated it (something like: foo-kl29b)
We can get service information from a number of spots: * From the ownerReferences in the metadata EndpointSlice -> metadata -> ownerReferences[0] -> name * We can also get this from the label: kubernetes.io/service-name * generateName will also contain the prefix for the autogenerated name which should align with our service name
We'll all through all of these and do our best to identify the service's name, if we aren't able to find any of these or they disagree with each other we'll throw an error
func SliceContainsString ¶
SliceContainsString checks to see if needle is contained within haystack, returns true if found, otherwise returns false
func TCPAddressBindable ¶ added in v2.1.0
TCPAddressBindable checks to see if an IP/port is bindable by attempting to open a listener then closing it returns nil if successful
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
Broadcaster holds the details of registered listeners
func (*Broadcaster) Add ¶
func (b *Broadcaster) Add(listener Listener)
Add lets to register a listener
func (*Broadcaster) Notify ¶
func (b *Broadcaster) Notify(instance interface{})
Notify notifies an update to registered listeners
type Conf ¶
type Conf struct { Bridge string IPAM *IPAM MTU float64 Type string // contains filtered or unexported fields }
Conf represents the individual CNI configuration that may exist on its own, or be part of a ConfList
func (*Conf) MarshalJSON ¶
func (*Conf) UnmarshalJSON ¶
type ConfList ¶
type ConfList struct { Plugins []*Conf // contains filtered or unexported fields }
ConfList represents a list of CNI configurations
func (*ConfList) MarshalJSON ¶
func (*ConfList) UnmarshalJSON ¶
type FakeLocalLinkQuerier ¶ added in v2.3.0
type FakeLocalLinkQuerier struct {
// contains filtered or unexported fields
}
func NewFakeLocalLinkQuerier ¶ added in v2.3.0
func NewFakeLocalLinkQuerier(addrStrings []string, mtus []int) *FakeLocalLinkQuerier
type ICMPRule ¶ added in v2.2.0
func CommonICMPRules ¶ added in v2.2.0
CommonICMPRules returns a list of common ICMP rules that should always be allowed for given IP family
type IPAM ¶
IPAM represents the ipam specific configuration that may exist on a given CNI configuration / plugin
func (*IPAM) MarshalJSON ¶
func (*IPAM) UnmarshalJSON ¶
type IPSet ¶
type IPSet struct {
// contains filtered or unexported fields
}
IPSet represent ipset sets managed by.
func (*IPSet) Create ¶
Create a set identified with setname and specified type. The type may require type specific options. Does not create set on the system if it already exists by the same name.
func (*IPSet) Destroy ¶
Destroy the specified set by name. If the set has got reference(s), nothing is done and no set destroyed. If the IPSet does not contain the named set then Destroy is a no-op.
func (*IPSet) DestroyAllWithin ¶
DestroyAllWithin destroys all sets contained within the IPSet's Sets.
func (*IPSet) RefreshSet ¶
RefreshSet add/update internal Sets with a Set of entries but does not run restore command
func (*IPSet) Restore ¶
Restore a saved session generated by save. The saved session can be fed from stdin or the option -file can be used to specify a filename instead of stdin. Please note, existing sets and elements are not erased by restore unless specified so in the restore file. All commands are allowed in restore mode except list, help, version, interactive mode and restore itself. Send formatted ipset.sets into stdin of "ipset restore" command.
type IPSetHandler ¶
type IPSetHandler interface { Create(setName string, createOptions ...string) (*Set, error) Add(set *Set) error RefreshSet(setName string, entriesWithOptions [][]string, setType string) Destroy(setName string) error DestroyAllWithin() error Save() error Restore() error Flush() error Get(setName string) *Set Sets() map[string]*Set Name(ipSet string) string }
type IPTablesHandler ¶
type IPTablesHandler interface { Proto() iptables.Protocol Exists(table, chain string, rulespec ...string) (bool, error) Insert(table, chain string, pos int, rulespec ...string) error Append(table, chain string, rulespec ...string) error AppendUnique(table, chain string, rulespec ...string) error Delete(table, chain string, rulespec ...string) error DeleteIfExists(table, chain string, rulespec ...string) error List(table, chain string) ([]string, error) ListWithCounters(table, chain string) ([]string, error) ListChains(table string) ([]string, error) ChainExists(table, chain string) (bool, error) Stats(table, chain string) ([][]string, error) ParseStat(stat []string) (iptables.Stat, error) StructuredStats(table, chain string) ([]iptables.Stat, error) NewChain(table, chain string) error ClearChain(table, chain string) error RenameChain(table, oldChain, newChain string) error DeleteChain(table, chain string) error ClearAndDeleteChain(table, chain string) error ClearAll() error DeleteAll() error ChangePolicy(table, chain, target string) error HasRandomFully() bool GetIptablesVersion() (int, int, int) }
IPTablesHandler interface based on the IPTables struct from github.com/coreos/go-iptables which allows to mock it.
type IPTablesSaveRestore ¶
type IPTablesSaveRestore struct {
// contains filtered or unexported fields
}
IPTablesSaveRestore struct stores shell commands to save and restore iptables state
func NewIPTablesSaveRestore ¶
func NewIPTablesSaveRestore(ipFamily v1core.IPFamily) *IPTablesSaveRestore
NewIPTablesSaveRestore returns an IPTablesSaveRestore with apparopriate commands based on ipFamily (IPv4 or IPv6)
type IPTablesSaveRestorer ¶
type IPTablesSaveRestorer interface { SaveInto(table string, buffer *bytes.Buffer) error Restore(table string, data []byte) error }
IPTablesSaveRestorer interface that defines functions to save and restore tables
type KRNode ¶ added in v2.3.0
type KRNode struct { NodeIPv4Addrs addressMap NodeIPv6Addrs addressMap NodeName string PrimaryIP net.IP }
KRNode is a struct that holds information about a node that is used by kube-router.
func NewRemoteKRNode ¶ added in v2.3.0
NewRemoteKRNode creates a new KRNode object from a Kubernetes Node Object. This function is used when kube-router is attempting to parse a remote node and does not have access to the node's interfaces and address data. It will return an error if the node does not have any IPv4 or IPv6 addresses defined in the Kubernetes Node Object.
func (*KRNode) FindBestIPv4NodeAddress ¶ added in v2.3.0
FindBestIPv4NodeAddress returns the best available IPv4 address for the node. If the primary IP is already an IPv4 address, it will return that. Otherwise, it will return the first internal or external IPv4 address defined in the Kubernetes Node Object.
func (*KRNode) FindBestIPv6NodeAddress ¶ added in v2.3.0
FindBestIPv6NodeAddress returns the best available IPv6 address for the node. If the primary IP is already an IPv6 address, it will return that. Otherwise, it will return the first internal or external IPv6 address defined in the Kubernetes Node Object.
func (*KRNode) GetNodeIPAddrs ¶ added in v2.3.0
GetNodeIPAddrs returns all of the node's IP addresses (whether internal or external) as defined by the Kubernetes Node Object.
func (*KRNode) GetNodeIPv4Addrs ¶ added in v2.3.0
GetNodeIPv4Addrs returns the node's IPv4 addresses as defined by the Kubernetes Node Object.
func (*KRNode) GetNodeIPv6Addrs ¶ added in v2.3.0
GetNodeIPv6Addrs returns the node's IPv6 addresses as defined by the Kubernetes Node Object.
func (*KRNode) GetNodeName ¶ added in v2.3.0
GetNodeName returns the node's name as defined by the Kubernetes Node Object.
func (*KRNode) GetPrimaryNodeIP ¶ added in v2.3.0
GetPrimaryNodeIP returns the node's primary IP address which for the purposes of kube-router is defined as the first internal address defined on the Kubernetes node object. If no internal address is defined, the first external address is used.
func (*KRNode) IsIPv4Capable ¶ added in v2.3.0
IsIPv4Capable returns true if the node has at least one IPv4 address defined in the Kubernetes Node Object.
func (*KRNode) IsIPv6Capable ¶ added in v2.3.0
IsIPv6Capable returns true if the node has at least one IPv6 address defined in the Kubernetes Node Object.
type ListenerFunc ¶
type ListenerFunc func(instance interface{})
func (ListenerFunc) OnUpdate ¶
func (f ListenerFunc) OnUpdate(instance interface{})
type LocalKRNode ¶ added in v2.3.0
type LocalKRNode struct { KRNode NodeInterfaceName string // contains filtered or unexported fields }
LocalKRNode is a struct that holds information about this kube-router node.
func NewKRNode ¶ added in v2.3.0
func NewKRNode(node *apiv1.Node, linkQ LocalLinkQuerier, enableIPv4, enableIPv6 bool) (*LocalKRNode, error)
NewKRNode creates a new KRNode object from a Kubernetes Node Object. This function is used when kube-router is running on the node itself and has access to the node's interfaces and address data. If you attempt to run this on a remote node, it will result in an error as it will not be able to find the correct subnet / interface information. For this use-case use NewRemoteKRNode instead. It will also return an error if the node does not have any IPv4 or IPv6 addresses defined in the Kubernetes Node Object.
func (*LocalKRNode) GetNodeInterfaceName ¶ added in v2.3.0
func (n *LocalKRNode) GetNodeInterfaceName() string
GetNodeInterfaceName returns the node's interface name as defined by the primary IP address. This function is only available if you are running on the node itself, as kube-router determines this by looking at the node's interfaces and parsing the address data there. If you attempt to call this function on a remote node, it will return nil.
func (*LocalKRNode) GetNodeMTU ¶ added in v2.3.0
func (n *LocalKRNode) GetNodeMTU() (int, error)
GetNodeMTU returns the MTU of the interface that the node's primary IP address is assigned to. This function is only available if you are running on the node itself, as kube-router determines this by looking at the node's interfaces and parsing the address data there. If you attempt to call this function on a remote node, it will return an error.
type LocalLinkQuerier ¶ added in v2.3.0
type MockLocalLinkQuerier ¶ added in v2.3.0
type NodeAware ¶ added in v2.3.0
type NodeAware interface { NodeIPAware NodeInterfaceAware NodeFamilyAware NodeNameAware }
NodeAware is an interface that combines the NodeIPAware, NodeInterfaceAware, NodeFamilyAware, and NodeNameAware interfaces.
type NodeFamilyAware ¶ added in v2.3.0
NodeFamilyAware is an interface that provides methods to check if a node is IPv4 or IPv6 capable.
type NodeIPAndFamilyAware ¶ added in v2.3.0
type NodeIPAndFamilyAware interface { NodeIPAware NodeFamilyAware }
NodeIPAndFamilyAware is an interface that combines the NodeIPAware and NodeFamilyAware interfaces.
type NodeIPAware ¶ added in v2.3.0
type NodeIPAware interface { FindBestIPv4NodeAddress() net.IP FindBestIPv6NodeAddress() net.IP GetNodeIPv4Addrs() []net.IP GetNodeIPv6Addrs() []net.IP GetNodeIPAddrs() []net.IP GetPrimaryNodeIP() net.IP }
NodeIPAware is an interface that provides methods to get the node's IP addresses in various data structures.
type NodeInterfaceAware ¶ added in v2.3.0
NodeInterfaceAware is an interface that provides methods to get the node's interface name, MTU, and subnet. This interface is a collection of functions that are only available if you are running on the node itself, as kube-router determines this by looking at the node's interfaces and parsing the address data there. If you attempt to call these functions on a remote node, they will return nil or an error.
type NodeNameAware ¶ added in v2.3.0
type NodeNameAware interface {
GetNodeName() string
}
NodeNameAware is an interface that provides a method to get the node's name.
type Range ¶
type Range struct { Subnet string // contains filtered or unexported fields }
Range represents an IP range that may exist within a range set (hence the double array above)
func (*Range) MarshalJSON ¶
func (*Range) UnmarshalJSON ¶
type Set ¶
Set represent a ipset set entry.
func (*Set) BatchAdd ¶
BatchAdd given entries (with their options) to the set. For multiple items, this is much faster than Add().
type SysctlError ¶
type SysctlError struct {
// contains filtered or unexported fields
}
func SetSysctlSingleTemplate ¶
func SetSysctlSingleTemplate(pathTemplate string, substitute string, value int) *SysctlError
SetSysctlSingleTemplate sets a sysctl value by first formatting the PathTemplate parameter with the substitute string and then setting the sysctl to the value parameter
func (*SysctlError) IsFatal ¶
func (e *SysctlError) IsFatal() bool
IsFatal was the error fatal and reason to exit kube-router
func (*SysctlError) Unwrap ¶
func (e *SysctlError) Unwrap() error
Unwrap allows us to unwrap an error showing the original error