Documentation ¶
Index ¶
- Constants
- Variables
- func ParseRange(s string) (min int, max int, err error)
- func StripIPSetNamePrefix(ipSetName string) string
- type BufferedCloser
- type CmdIface
- type IPFamily
- type IPSetMember
- type IPSetMetadata
- type IPSetType
- type IPSets
- func (s *IPSets) AddMembers(setID string, newMembers []string)
- func (s *IPSets) AddOrReplaceIPSet(setMetadata IPSetMetadata, members []string)
- func (s *IPSets) ApplyDeletions() bool
- func (s *IPSets) ApplyUpdates()
- func (s *IPSets) CalicoIPSets() ([]string, error)
- func (s *IPSets) GetDesiredMembers(setID string) (set.Set[string], error)
- func (s *IPSets) GetIPFamily() IPFamily
- func (s *IPSets) GetTypeOf(setID string) (IPSetType, error)
- func (s *IPSets) QueueResync()
- func (s *IPSets) RemoveIPSet(setID string)
- func (s *IPSets) RemoveMembers(setID string, removedMembers []string)
- func (s *IPSets) SetFilter(ipSetNames set.Set[string])
- type IPVersionConfig
- type Port
- type V4IPPort
- type V6IPPort
- type WriteCloserFlusher
- type WriteFlusher
Constants ¶
const ( IPFamilyV4 = IPFamily("inet") IPFamilyV6 = IPFamily("inet6") )
const IPSetNamePrefix = "cali"
const (
MaxIPSetDeletionsPerIteration = 1
)
const MaxIPSetNameLength = 31
Variables ¶
var AllIPSetTypes = []IPSetType{ IPSetTypeHashIP, IPSetTypeHashIPPort, IPSetTypeHashNet, IPSetTypeBitmapPort, IPSetTypeHashNetNet, }
Functions ¶
func StripIPSetNamePrefix ¶
Types ¶
type BufferedCloser ¶
type BufferedCloser struct { BufWriter WriteFlusher Closer io.Closer }
func (*BufferedCloser) Close ¶
func (b *BufferedCloser) Close() error
func (*BufferedCloser) Flush ¶
func (b *BufferedCloser) Flush() error
type IPFamily ¶
type IPFamily string
IPFamily constants for the names that the ipset command uses for the IP versions.
type IPSetMember ¶
type IPSetMember interface {
String() string
}
func CanonicaliseMember ¶
func CanonicaliseMember(t IPSetType, member string) IPSetMember
CanonicaliseMember converts the string representation of an IP set member to a canonical object of some kind. The object is required to by hashable.
type IPSetMetadata ¶
IPSetMetadata contains the metadata for a particular IP set, such as its name, type and size.
type IPSetType ¶
type IPSetType string
IPSetType constants for the different kinds of IP set.
func (IPSetType) IsMemberIPV6 ¶
type IPSets ¶
type IPSets struct { IPVersionConfig *IPVersionConfig // contains filtered or unexported fields }
IPSets manages a whole "plane" of IP sets, i.e. all the IPv4 sets, or all the IPv6 IP sets.
func NewIPSets ¶
func NewIPSets(ipVersionConfig *IPVersionConfig, recorder logutils.OpRecorder) *IPSets
func NewIPSetsWithShims ¶
func NewIPSetsWithShims( ipVersionConfig *IPVersionConfig, recorder logutils.OpRecorder, cmdFactory cmdFactory, sleep func(time.Duration), ) *IPSets
NewIPSetsWithShims is an internal test constructor.
func (*IPSets) AddMembers ¶
AddMembers adds the given members to the IP set. Filters out members that are of the incorrect IP version.
func (*IPSets) AddOrReplaceIPSet ¶
func (s *IPSets) AddOrReplaceIPSet(setMetadata IPSetMetadata, members []string)
AddOrReplaceIPSet queues up the creation (or replacement) of an IP set. After the next call to ApplyUpdates(), the IP sets will be replaced with the new contents and the set's metadata will be updated as appropriate.
func (*IPSets) ApplyDeletions ¶
ApplyDeletions tries to delete any IP sets that are no longer needed. Failures are ignored, deletions will be retried the next time we do a resync.
func (*IPSets) ApplyUpdates ¶
func (s *IPSets) ApplyUpdates()
ApplyUpdates applies the updates to the dataplane. Returns a set of programmed IPs in the IPSets included by the ipsetFilter.
func (*IPSets) CalicoIPSets ¶
func (*IPSets) GetDesiredMembers ¶
func (*IPSets) GetIPFamily ¶
func (*IPSets) QueueResync ¶
func (s *IPSets) QueueResync()
QueueResync forces a resync with the dataplane on the next ApplyUpdates() call.
func (*IPSets) RemoveIPSet ¶
RemoveIPSet queues up the removal of an IP set, it need not be empty. The IP sets will be removed on the next call to ApplyDeletions().
func (*IPSets) RemoveMembers ¶
RemoveMembers queues up removal of the given members from an IP set. Members of the wrong IP version are ignored.
type IPVersionConfig ¶
type IPVersionConfig struct { Family IPFamily // contains filtered or unexported fields }
IPVersionConfig wraps up the metadata for a particular IP version. It can be used by this and other components to calculate IP set names from IP set IDs, for example.
func NewIPVersionConfig ¶
func NewIPVersionConfig( family IPFamily, namePrefix string, allHistoricPrefixes []string, extraUnversionedIPSets []string, ) *IPVersionConfig
func (IPVersionConfig) IsTempIPSetName ¶
func (c IPVersionConfig) IsTempIPSetName(setName string) bool
func (IPVersionConfig) NameForMainIPSet ¶
func (c IPVersionConfig) NameForMainIPSet(setID string) string
NameForMainIPSet converts the given IP set ID (example: "qMt7iLlGDhvLnCjM0l9nzxbabcd"), to a name for use in the dataplane. The return value will have the configured prefix and is guaranteed to be short enough to use as an ipset name (example: "cali60s:qMt7iLlGDhvLnCjM0l9nzxb").
func (IPVersionConfig) NameForTempIPSet ¶
func (c IPVersionConfig) NameForTempIPSet(n uint) string
func (IPVersionConfig) OwnsIPSet ¶
func (c IPVersionConfig) OwnsIPSet(setName string) bool
OwnsIPSet returns true if the given IP set name appears to belong to Felix. i.e. whether it starts with an expected prefix.
type V4IPPort ¶
type V4IPPort struct { IP ip.V4Addr Port uint16 Protocol labelindex.IPSetPortProtocol }
type V6IPPort ¶
type V6IPPort struct { IP ip.V6Addr Port uint16 Protocol labelindex.IPSetPortProtocol }
type WriteCloserFlusher ¶
type WriteCloserFlusher interface { io.WriteCloser Flush() error }