Documentation
¶
Index ¶
- type AddressPool
- type BgpAdvertisement
- type BgpAdvertisements
- type ConfigFile
- func (cfg *ConfigFile) AddAddressPool(add *AddressPool) bool
- func (cfg *ConfigFile) AddPeer(add *Peer) bool
- func (cfg *ConfigFile) AddPeerByService(add *Peer, svcNamespace, svcName string) bool
- func (cfg *ConfigFile) Bytes() ([]byte, error)
- func (cfg *ConfigFile) RemoveAddressPool(remove *AddressPool)
- func (cfg *ConfigFile) RemoveAddressPoolByAddress(addr string)
- func (cfg *ConfigFile) RemovePeer(remove *Peer)
- func (cfg *ConfigFile) RemovePeersBySelector(remove *NodeSelector) bool
- func (cfg *ConfigFile) RemovePeersByService(svcNamespace, svcName string) bool
- type LB
- func (l *LB) AddService(ctx context.Context, svcNamespace, svcName, ip string, ...) error
- func (l *LB) RemoveNode(ctx context.Context, nodeName string) error
- func (l *LB) RemoveService(ctx context.Context, svcNamespace, svcName, ip string) error
- func (l *LB) UpdateService(ctx context.Context, svcNamespace, svcName string, nodes []loadbalancers.Node) error
- type NodeSelector
- type NodeSelectors
- type Peer
- func (p *Peer) AddService(svcNamespace, svcName string) bool
- func (p *Peer) Duplicate() Peer
- func (p *Peer) Equal(o *Peer) bool
- func (p *Peer) EqualIgnoreService(o *Peer) bool
- func (p *Peer) MatchSelector(s *NodeSelector) bool
- func (p *Peer) RemoveService(svcNamespace, svcName string) (bool, int)
- func (p *Peer) Services() []Resource
- type Proto
- type Resource
- type Resources
- type SelectorRequirements
- type SelectorRequirementsSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressPool ¶
type AddressPool struct { Protocol Proto Name string Addresses []string AvoidBuggyIPs bool `yaml:"avoid-buggy-ips"` AutoAssign *bool `yaml:"auto-assign"` BGPAdvertisements []BgpAdvertisement `yaml:"bgp-advertisements"` }
func (*AddressPool) Duplicate ¶
func (a *AddressPool) Duplicate() AddressPool
func (*AddressPool) Equal ¶
func (a *AddressPool) Equal(o *AddressPool) bool
Equal determine if two AddressPools are equal. Definition of a match is MatchIgnoreName == true && a.Name == o.Name
func (*AddressPool) EqualIgnoreName ¶
func (a *AddressPool) EqualIgnoreName(o *AddressPool) bool
EqualIgnoreName determine if two AddressPools are equal. Definition of a match is: - Protocol matches - AvoidBuggyIPs matches - AutoAssign matches - Addresses match (order is ignored) - BGPAdvertisements all match (order is ignored)
Note that two match even if the name is different. If you use this function, you must check name match separately!
type BgpAdvertisement ¶
type BgpAdvertisement struct { AggregationLength *int `yaml:"aggregation-length"` LocalPref *uint32 Communities []string }
func (*BgpAdvertisement) Duplicate ¶
func (b *BgpAdvertisement) Duplicate() BgpAdvertisement
func (*BgpAdvertisement) Equal ¶
func (b *BgpAdvertisement) Equal(o *BgpAdvertisement) bool
type BgpAdvertisements ¶
type BgpAdvertisements []BgpAdvertisement
func (BgpAdvertisements) Len ¶
func (b BgpAdvertisements) Len() int
func (BgpAdvertisements) Less ¶
func (b BgpAdvertisements) Less(i, j int) bool
func (BgpAdvertisements) Swap ¶
func (b BgpAdvertisements) Swap(i, j int)
type ConfigFile ¶
type ConfigFile struct { Peers []Peer BGPCommunities map[string]string `yaml:"bgp-communities"` Pools []AddressPool `yaml:"address-pools"` }
configFile is the configuration as parsed out of the ConfigMap, without validation or useful high level types.
func ParseConfig ¶
func ParseConfig(bs []byte) (*ConfigFile, error)
func (*ConfigFile) AddAddressPool ¶
func (cfg *ConfigFile) AddAddressPool(add *AddressPool) bool
AddAddressPool adds an address pool. If a matching pool already exists, do not change anything. Returns if anything changed
func (*ConfigFile) AddPeer ¶
func (cfg *ConfigFile) AddPeer(add *Peer) bool
AddPeer adds a peer. If a matching peer already exists, do not change anything Returns if anything changed.
func (*ConfigFile) AddPeerByService ¶
func (cfg *ConfigFile) AddPeerByService(add *Peer, svcNamespace, svcName string) bool
AddPeerByService adds a peer for a specific service. If a matching peer already exists with the service, do not change anything. If a matching peer already exists but does not have the service, add it. Returns if anything changed.
func (*ConfigFile) Bytes ¶
func (cfg *ConfigFile) Bytes() ([]byte, error)
func (*ConfigFile) RemoveAddressPool ¶
func (cfg *ConfigFile) RemoveAddressPool(remove *AddressPool)
RemoveAddressPool remove a pool. If the matching pool does not exist, do not change anything
func (*ConfigFile) RemoveAddressPoolByAddress ¶
func (cfg *ConfigFile) RemoveAddressPoolByAddress(addr string)
RemoveAddressPooByAddress remove a pool by an address alone. If the matching pool does not exist, do not change anything
func (*ConfigFile) RemovePeer ¶
func (cfg *ConfigFile) RemovePeer(remove *Peer)
RemovePeer remove a peer. If the matching peer does not exist, do not change anything
func (*ConfigFile) RemovePeersBySelector ¶
func (cfg *ConfigFile) RemovePeersBySelector(remove *NodeSelector) bool
RemovePeersBySelector remove a peer by selector. If the matching peer does not exist, do not change anything. Returns if anything changed.
func (*ConfigFile) RemovePeersByService ¶
func (cfg *ConfigFile) RemovePeersByService(svcNamespace, svcName string) bool
RemovePeersByService remove peers from a particular service. For any peers that have this services in the special MatchLabel, remove the service from the label. If there are no services left on a peer, remove the peer entirely.
type LB ¶
type LB struct {
// contains filtered or unexported fields
}
func (*LB) AddService ¶
func (*LB) RemoveNode ¶
RemoveNode remove a node with the provided name
func (*LB) RemoveService ¶
func (*LB) UpdateService ¶
type NodeSelector ¶
type NodeSelector struct { MatchLabels map[string]string `yaml:"match-labels"` MatchExpressions []SelectorRequirements `yaml:"match-expressions"` }
func (*NodeSelector) Duplicate ¶
func (ns *NodeSelector) Duplicate() NodeSelector
func (*NodeSelector) Equal ¶
func (ns *NodeSelector) Equal(o *NodeSelector) bool
type NodeSelectors ¶
type NodeSelectors []NodeSelector
func (NodeSelectors) Equal ¶
func (n NodeSelectors) Equal(o NodeSelectors) bool
Equal return true if two sets of NodeSelectors are identical
func (NodeSelectors) EqualIgnoreService ¶
func (n NodeSelectors) EqualIgnoreService(o NodeSelectors) bool
EqualIgnoreService return true if two sets of NodeSelectors are identical, except that the NodeSelector containing the special service label is ignored in the first one.
func (NodeSelectors) Len ¶
func (n NodeSelectors) Len() int
func (NodeSelectors) Less ¶
func (n NodeSelectors) Less(i, j int) bool
func (NodeSelectors) Swap ¶
func (n NodeSelectors) Swap(i, j int)
type Peer ¶
type Peer struct { MyASN uint32 `yaml:"my-asn"` ASN uint32 `yaml:"peer-asn"` Addr string `yaml:"peer-address"` Port uint16 `yaml:"peer-port"` SrcAddr string `yaml:"source-address"` HoldTime string `yaml:"hold-time"` RouterID string `yaml:"router-id"` NodeSelectors []NodeSelector `yaml:"node-selectors"` Password string `yaml:"password"` }
func (*Peer) AddService ¶
AddService ensures that the provided service is in the list of linked services.
func (*Peer) EqualIgnoreService ¶
EqualIgnoreService return true if a peer is identical except for the special service label. Will only check for it in the current Peer p, and not the "other" peer in the parameter.
func (*Peer) MatchSelector ¶
func (p *Peer) MatchSelector(s *NodeSelector) bool
MatchSelector report if this peer matches a given selector
func (*Peer) RemoveService ¶
RemoveService removes a given service from the peer. Returns whether or not it was changed, and how many services are left for this peer.
type SelectorRequirements ¶
type SelectorRequirements struct { Key string `yaml:"key"` Operator string `yaml:"operator"` Values []string `yaml:"values"` }
func (*SelectorRequirements) Compare ¶
func (s *SelectorRequirements) Compare(o *SelectorRequirements) int
func (*SelectorRequirements) Equal ¶
func (s *SelectorRequirements) Equal(o *SelectorRequirements) bool
type SelectorRequirementsSlice ¶
type SelectorRequirementsSlice []SelectorRequirements
func (SelectorRequirementsSlice) Equal ¶
func (s SelectorRequirementsSlice) Equal(o SelectorRequirementsSlice) bool
func (SelectorRequirementsSlice) Len ¶
func (s SelectorRequirementsSlice) Len() int
func (SelectorRequirementsSlice) Less ¶
func (s SelectorRequirementsSlice) Less(i, j int) bool
func (SelectorRequirementsSlice) Swap ¶
func (s SelectorRequirementsSlice) Swap(i, j int)