Documentation
¶
Index ¶
- Constants
- func AnnotateIPCacheKeyWithClusterID(key string, clusterID uint32) string
- func ValidateClusterID(clusterID uint32) error
- type AddrCluster
- func (ac AddrCluster) Addr() netip.Addr
- func (ac AddrCluster) As20() (ac20 [20]byte)
- func (ac AddrCluster) AsNetIP() net.IP
- func (ac AddrCluster) AsPrefixCluster() PrefixCluster
- func (ac AddrCluster) ClusterID() uint32
- func (in *AddrCluster) DeepCopy() *AddrCluster
- func (in *AddrCluster) DeepCopyInto(out *AddrCluster)
- func (ac0 *AddrCluster) DeepEqual(ac1 *AddrCluster) bool
- func (ac0 AddrCluster) Equal(ac1 AddrCluster) bool
- func (ac AddrCluster) Is4() bool
- func (ac AddrCluster) Is6() bool
- func (ac AddrCluster) IsUnspecified() bool
- func (ac0 AddrCluster) Less(ac1 AddrCluster) bool
- func (ac AddrCluster) String() string
- type CiliumClusterConfig
- type CiliumClusterConfigCapabilities
- type ClusterIDName
- type PrefixCluster
- func (pc PrefixCluster) AddrCluster() AddrCluster
- func (pc PrefixCluster) AsIPNet() net.IPNet
- func (pc PrefixCluster) ClusterID() uint32
- func (pc0 PrefixCluster) Equal(pc1 PrefixCluster) bool
- func (pc PrefixCluster) IsSingleIP() bool
- func (pc PrefixCluster) IsValid() bool
- func (pc PrefixCluster) String() string
Constants ¶
const ( // ClusterIDMin is the minimum value of the cluster ID ClusterIDMin = 0 // ClusterIDMax is the maximum value of the cluster ID ClusterIDMax = 255 )
const AddrClusterLen = 20
Variables ¶
This section is empty.
Functions ¶
func AnnotateIPCacheKeyWithClusterID ¶
This function is solely exists for annotating IPCache's key string with ClusterID. IPCache's key string is IP address or Prefix string (10.0.0.1 and 10.0.0.0/32 are different entry). This function assumes given string is one of those format and just put @<ClusterID> suffix and there's no format check for performance reason. User must make sure the input is a valid IP or Prefix string.
We should eventually remove this function once we finish refactoring IPCache and stop using string as a key. At that point, we should consider using PrefixCluster type for IPCache's key.
func ValidateClusterID ¶
Types ¶
type AddrCluster ¶
type AddrCluster struct {
// contains filtered or unexported fields
}
AddrCluster is a type that holds a pair of IP and ClusterID. We should use this type as much as possible when we implement IP + Cluster addressing. We should avoid managing IP and ClusterID separately. Otherwise, it is very hard for code readers to see where we are using cluster-aware addressing.
func AddrClusterFrom ¶
func AddrClusterFrom(addr netip.Addr, clusterID uint32) AddrCluster
AddrClusterFrom creates AddrCluster from netip.Addr and ClusterID
func AddrClusterFromIP ¶
func AddrClusterFromIP(ip net.IP) (AddrCluster, bool)
AddrClusterFromIP parses the given net.IP using ip.AddrFromIP and returns AddrCluster with ClusterID = 0.
func MustAddrClusterFromIP ¶
func MustAddrClusterFromIP(ip net.IP) AddrCluster
func MustParseAddrCluster ¶
func MustParseAddrCluster(s string) AddrCluster
MustParseAddrCluster calls ParseAddr(s) and panics on error. It is intended for use in tests with hard-coded strings.
func ParseAddrCluster ¶
func ParseAddrCluster(s string) (AddrCluster, error)
ParseAddrCluster parses s as an IP + ClusterID and returns AddrCluster. The string s can be a bare IP string (any IP address format allowed in netip.ParseAddr()) or IP string + @ + ClusterID with decimal. Bare IP string is considered as IP string + @ + ClusterID = 0.
func (AddrCluster) Addr ¶
func (ac AddrCluster) Addr() netip.Addr
Addr returns IP address part of AddrCluster as netip.Addr. This function exists for keeping backward compatibility between the existing components which are not aware of the cluster-aware addressing. Calling this function against the AddrCluster which has non-zero clusterID will lose the ClusterID information. It should be used with an extra care.
func (AddrCluster) As20 ¶
func (ac AddrCluster) As20() (ac20 [20]byte)
As20 returns the AddrCluster in its 20-byte representation which consists of 16-byte IP address part from netip.Addr.As16 and 4-byte ClusterID part.
func (AddrCluster) AsNetIP ¶
func (ac AddrCluster) AsNetIP() net.IP
AsNetIP returns the IP address part of AddCluster as a net.IP type. This function exists for keeping backward compatibility between the existing components which are not aware of the cluster-aware addressing. Calling this function against the AddrCluster which has non-zero clusterID will lose the ClusterID information. It should be used with an extra care.
func (AddrCluster) AsPrefixCluster ¶
func (ac AddrCluster) AsPrefixCluster() PrefixCluster
func (AddrCluster) ClusterID ¶
func (ac AddrCluster) ClusterID() uint32
ClusterID returns ClusterID part of AddrCluster as uint32. We should avoid using this function as much as possible and treat IP address and ClusterID together.
func (*AddrCluster) DeepCopy ¶
func (in *AddrCluster) DeepCopy() *AddrCluster
DeepCopy returns a new copy of AddrCluster
func (*AddrCluster) DeepCopyInto ¶
func (in *AddrCluster) DeepCopyInto(out *AddrCluster)
DeepCopyInto copies in to out
func (*AddrCluster) DeepEqual ¶
func (ac0 *AddrCluster) DeepEqual(ac1 *AddrCluster) bool
This is an alias of Equal which only exists for satisfying deepequal-gen
func (AddrCluster) Equal ¶
func (ac0 AddrCluster) Equal(ac1 AddrCluster) bool
Equal returns true when given AddrCluster has a same IP address and ClusterID
func (AddrCluster) Is4 ¶
func (ac AddrCluster) Is4() bool
Is4 reports whether IP address part of AddrCluster is an IPv4 address.
func (AddrCluster) Is6 ¶
func (ac AddrCluster) Is6() bool
Is6 reports whether IP address part of AddrCluster is an IPv6 address.
func (AddrCluster) IsUnspecified ¶
func (ac AddrCluster) IsUnspecified() bool
IsUnspecified reports whether IP address part of the AddrCluster is an unspecified address, either the IPv4 address "0.0.0.0" or the IPv6 address "::".
func (AddrCluster) Less ¶
func (ac0 AddrCluster) Less(ac1 AddrCluster) bool
Less compares ac0 and ac1 and returns true if ac0 is lesser than ac1
func (AddrCluster) String ¶
func (ac AddrCluster) String() string
String returns the string representation of the AddrCluster. If AddrCluster.clusterID = 0, it returns bare IP address string. Otherwise, it returns IP string + "@" + ClusterID (e.g. 10.0.0.1@1)
type CiliumClusterConfig ¶
type CiliumClusterConfig struct { ID uint32 `json:"id,omitempty"` Capabilities CiliumClusterConfigCapabilities `json:"capabilities,omitempty"` }
func (*CiliumClusterConfig) Validate ¶
func (c *CiliumClusterConfig) Validate() error
type CiliumClusterConfigCapabilities ¶
type CiliumClusterConfigCapabilities struct { // Supports per-prefix "synced" canaries SyncedCanaries bool `json:"syncedCanaries,omitempty"` // The information concerning the given cluster is cached from an external // kvstore (for instance, by kvstoremesh). This implies that keys are stored // under the dedicated "cilium/cache" prefix, and all are cluster-scoped. Cached bool `json:"cached,omitempty"` }
type ClusterIDName ¶
ClusterIDName groups together the ClusterID and the ClusterName
type PrefixCluster ¶
type PrefixCluster struct {
// contains filtered or unexported fields
}
PrefixCluster is a type that holds a pair of prefix and ClusterID. We should use this type as much as possible when we implement prefix + Cluster addressing. We should avoid managing prefix and ClusterID separately. Otherwise, it is very hard for code readers to see where we are using cluster-aware addressing.
func MustParsePrefixCluster ¶
func MustParsePrefixCluster(s string) PrefixCluster
MustParsePrefixCluster calls ParsePrefixCluster(s) and panics on error. It is intended for use in tests with hard-coded strings.
func ParsePrefixCluster ¶
func ParsePrefixCluster(s string) (PrefixCluster, error)
ParsePrefixCluster parses s as an Prefix + ClusterID and returns PrefixCluster. The string s can be a bare IP prefix string (any prefix format allowed in netip.ParsePrefix()) or prefix string + @ + ClusterID with decimal. Bare prefix string is considered as prefix string + @ + ClusterID = 0.
func PrefixClusterFrom ¶
func PrefixClusterFrom(addr netip.Addr, bits int, clusterID uint32) PrefixCluster
func PrefixClusterFromCIDR ¶
func PrefixClusterFromCIDR(c *cidr.CIDR, clusterID uint32) PrefixCluster
func (PrefixCluster) AddrCluster ¶
func (pc PrefixCluster) AddrCluster() AddrCluster
func (PrefixCluster) AsIPNet ¶
func (pc PrefixCluster) AsIPNet() net.IPNet
AsIPNet returns the IP prefix part of PrefixCluster as a net.IPNet type. This function exists for keeping backward compatibility between the existing components which are not aware of the cluster-aware addressing. Calling this function against the PrefixCluster which has non-zero clusterID will lose the ClusterID information. It should be used with an extra care.
func (PrefixCluster) ClusterID ¶
func (pc PrefixCluster) ClusterID() uint32
func (PrefixCluster) Equal ¶
func (pc0 PrefixCluster) Equal(pc1 PrefixCluster) bool
func (PrefixCluster) IsSingleIP ¶
func (pc PrefixCluster) IsSingleIP() bool
func (PrefixCluster) IsValid ¶
func (pc PrefixCluster) IsValid() bool
func (PrefixCluster) String ¶
func (pc PrefixCluster) String() string