Documentation ¶
Overview ¶
Package utils contain utility functions for the Liqonet package.
Index ¶
- Variables
- func AddAnnotationToObj(obj client.Object, aKey, aValue string) bool
- func AddLabelToObj(obj client.Object, labelKey, labelValue string) bool
- func CheckTep(tep *netv1alpha1.TunnelEndpoint) error
- func GetAnnotationValueFromObj(obj client.Object, akey string) string
- func GetExternalCIDRS(tep *netv1alpha1.TunnelEndpoint) (localExternalCIDR, remoteExternalCIDR string)
- func GetFirstIP(network string) (string, error)
- func GetLabelValueFromObj(obj client.Object, labelKey string) string
- func GetMask(network string) uint8
- func GetNodeName() (string, error)
- func GetOverlayIP(ip string) string
- func GetPodCIDRS(tep *netv1alpha1.TunnelEndpoint) (localRemappedPodCIDR, remotePodCIDR string)
- func GetPodIP() (net.IP, error)
- func GetPodNamespace() (string, error)
- func IsValidCIDR(cidr string) error
- func MapIPToNetwork(newNetwork, oldIP string) (newIP string, err error)
- func Next(network string) string
- func SetMask(network string, mask uint8) string
- func SplitNetwork(network string) []string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AddAnnotationToObj ¶
AddAnnotationToObj for a given object it adds the annotation with the given key and value. It return a bool which is true when the annotations has been added or false if the annotation is already present.
func AddLabelToObj ¶
AddLabelToObj for a given object it adds the label with the given key and value. It return a bool which is true when the label has been added or false if the label is already present.
func CheckTep ¶
func CheckTep(tep *netv1alpha1.TunnelEndpoint) error
CheckTep checks validity of TunnelEndpoint resource fields.
func GetAnnotationValueFromObj ¶
GetAnnotationValueFromObj for a given object it return the value of the label denoted by the given key. If the key does not exist it returns an empty string.
func GetExternalCIDRS ¶
func GetExternalCIDRS(tep *netv1alpha1.TunnelEndpoint) (localExternalCIDR, remoteExternalCIDR string)
GetExternalCIDRS for a given tep the function retrieves the values for localExternalCIDR and remoteExternalCIDR. Their values depend if the NAT is required or not.
func GetFirstIP ¶
GetFirstIP returns the first IP address of a network.
func GetLabelValueFromObj ¶
GetLabelValueFromObj for a given object it return the value of the label denoted by the given key. If the key does not exist it returns an empty string.
func GetNodeName ¶
GetNodeName gets the name of the node where the pod is running passed as an environment variable.
func GetOverlayIP ¶
GetOverlayIP given an IP address it is mapped in to the overlay network, described by consts.OverlayNetworkPrefix. It uses the overlay prefix and the last three octets of the original IP address.
func GetPodCIDRS ¶
func GetPodCIDRS(tep *netv1alpha1.TunnelEndpoint) (localRemappedPodCIDR, remotePodCIDR string)
GetPodCIDRS for a given tep the function retrieves the values for localPodCIDR and remotePodCIDR. Their values depend if the NAT is required or not.
func GetPodNamespace ¶
GetPodNamespace gets the namespace of the pod passed as an environment variable.
func IsValidCIDR ¶
IsValidCIDR returns an error if the received CIDR is invalid.
func MapIPToNetwork ¶
MapIPToNetwork creates a new IP address obtained by means of the old IP address and the new network.
func SplitNetwork ¶ added in v0.3.1
SplitNetwork returns the two halves that make up a given network.
Types ¶
This section is empty.