Documentation ¶
Overview ¶
Package getters contains utility functions to get k8s resources and at the same time to extract data from the same resources.
Package getters provides functions to get k8s resources and liqo custom resources.
Index ¶
- func GetConfigMapByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*corev1.ConfigMap, error)
- func GetIPAMStorageByLabel(ctx context.Context, cl client.Client, lSelector labels.Selector) (*netv1alpha1.IpamStorage, error)
- func GetNetworkConfigByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*netv1alpha1.NetworkConfig, error)
- func GetNodeByClusterID(ctx context.Context, cl client.Client, ...) (*corev1.Node, error)
- func GetOffloadingByNamespace(ctx context.Context, cl client.Client, namespace string) (*offloadingv1alpha1.NamespaceOffloading, error)
- func GetPodByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector, ...) (*corev1.Pod, error)
- func GetResourceOfferByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*sharingv1alpha1.ResourceOffer, error)
- func GetSecretByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*corev1.Secret, error)
- func GetServiceByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*corev1.Service, error)
- func GetTunnelEndpoint(ctx context.Context, cl client.Client, ...) (*netv1alpha1.TunnelEndpoint, error)
- func ListNetworkConfigsByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*netv1alpha1.NetworkConfigList, error)
- func ListOffloadedPods(ctx context.Context, cl client.Client, namespace string) (corev1.PodList, error)
- func ListVirtualNodes(ctx context.Context, cl client.Client) (corev1.NodeList, error)
- func MapForeignClustersByLabel(ctx context.Context, cl client.Client, lSelector labels.Selector) (map[string]discoveryv1alpha1.ForeignCluster, error)
- func RetrieveClusterIDFromConfigMap(cm *corev1.ConfigMap) (*discoveryv1alpha1.ClusterIdentity, error)
- func RetrieveClusterIDFromVirtualNode(node *corev1.Node) (string, error)
- func RetrieveEndpointFromService(svc *corev1.Service, svcType corev1.ServiceType, portName string) (endpointIP, endpointPort string, err error)
- func RetrieveWGEPFromLoadBalancer(svc *corev1.Service, portName string) (endpointIP, endpointPort string, err error)
- func RetrieveWGEPFromNodePort(svc *corev1.Service, annotationKey, portName string) (endpointIP, endpointPort string, err error)
- func RetrieveWGEPFromService(svc *corev1.Service, annotationKey, portName string) (endpointIP, endpointPort string, err error)
- func RetrieveWGPubKeyFromSecret(secret *corev1.Secret, keyName string) (pubKey wgtypes.Key, err error)
- type NetworkConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigMapByLabel ¶
func GetConfigMapByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*corev1.ConfigMap, error)
GetConfigMapByLabel it returns a configmap instance that matches the given label selector.
func GetIPAMStorageByLabel ¶
func GetIPAMStorageByLabel(ctx context.Context, cl client.Client, lSelector labels.Selector) (*netv1alpha1.IpamStorage, error)
GetIPAMStorageByLabel it returns a IPAMStorage instance that matches the given label selector.
func GetNetworkConfigByLabel ¶
func GetNetworkConfigByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*netv1alpha1.NetworkConfig, error)
GetNetworkConfigByLabel it returns a networkconfigs instance that matches the given label selector.
func GetNodeByClusterID ¶ added in v0.5.0
func GetNodeByClusterID(ctx context.Context, cl client.Client, clusterID *discoveryv1alpha1.ClusterIdentity) (*corev1.Node, error)
GetNodeByClusterID returns the node instance that matches the given cluster id.
func GetOffloadingByNamespace ¶ added in v0.5.0
func GetOffloadingByNamespace(ctx context.Context, cl client.Client, namespace string) (*offloadingv1alpha1.NamespaceOffloading, error)
GetOffloadingByNamespace returns the NamespaceOffloading resource for the given namespace.
func GetPodByLabel ¶
func GetPodByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector, fSelector fields.Selector) (*corev1.Pod, error)
GetPodByLabel it returns a pod instance that matches the given label and field selector.
func GetResourceOfferByLabel ¶ added in v0.5.0
func GetResourceOfferByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*sharingv1alpha1.ResourceOffer, error)
GetResourceOfferByLabel returns the ResourceOffer with the given labels.
func GetSecretByLabel ¶
func GetSecretByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*corev1.Secret, error)
GetSecretByLabel it returns a secret instance that matches the given label selector.
func GetServiceByLabel ¶
func GetServiceByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*corev1.Service, error)
GetServiceByLabel it returns a service instance that matches the given label selector.
func GetTunnelEndpoint ¶ added in v0.6.0
func GetTunnelEndpoint(ctx context.Context, cl client.Client, destinationClusterIdentity *discoveryv1alpha1.ClusterIdentity, namespace string) (*netv1alpha1.TunnelEndpoint, error)
GetTunnelEndpoint retrieves the tunnelEndpoint resource related to a cluster.
func ListNetworkConfigsByLabel ¶ added in v0.7.0
func ListNetworkConfigsByLabel(ctx context.Context, cl client.Client, ns string, lSelector labels.Selector) (*netv1alpha1.NetworkConfigList, error)
ListNetworkConfigsByLabel it returns a NetworkConfig list that matches the given label selector.
func ListOffloadedPods ¶ added in v0.6.0
func ListOffloadedPods(ctx context.Context, cl client.Client, namespace string) (corev1.PodList, error)
ListOffloadedPods returns the list of pods offloaded from the given namespace.
func ListVirtualNodes ¶ added in v0.6.0
ListVirtualNodes returns the list of virtual nodes.
func MapForeignClustersByLabel ¶ added in v0.7.0
func MapForeignClustersByLabel(ctx context.Context, cl client.Client, lSelector labels.Selector) (map[string]discoveryv1alpha1.ForeignCluster, error)
MapForeignClustersByLabel returns a map of foreign clusters indexed their names.
func RetrieveClusterIDFromConfigMap ¶
func RetrieveClusterIDFromConfigMap(cm *corev1.ConfigMap) (*discoveryv1alpha1.ClusterIdentity, error)
RetrieveClusterIDFromConfigMap retrieves ClusterIdentity from a given configmap.
func RetrieveClusterIDFromVirtualNode ¶ added in v0.6.0
RetrieveClusterIDFromVirtualNode retrieves the cluster id from the given node labels.
func RetrieveEndpointFromService ¶
func RetrieveEndpointFromService(svc *corev1.Service, svcType corev1.ServiceType, portName string) (endpointIP, endpointPort string, err error)
RetrieveEndpointFromService retrieves an ip address and port from a given service object based on the service and port name.
func RetrieveWGEPFromLoadBalancer ¶
func RetrieveWGEPFromLoadBalancer(svc *corev1.Service, portName string) (endpointIP, endpointPort string, err error)
RetrieveWGEPFromLoadBalancer retrieves the WireGuard endpoint from a LoadBalancer service.
func RetrieveWGEPFromNodePort ¶
func RetrieveWGEPFromNodePort(svc *corev1.Service, annotationKey, portName string) (endpointIP, endpointPort string, err error)
RetrieveWGEPFromNodePort retrieves the WireGuard endpoint from a NodePort service.
Types ¶
type NetworkConfig ¶
type NetworkConfig struct { PodCIDR string ExternalCIDR string ServiceCIDR string ReservedSubnets []string }
NetworkConfig holds the liqo network configuration.
func RetrieveNetworkConfiguration ¶
func RetrieveNetworkConfiguration(ipamS *netv1alpha1.IpamStorage) (*NetworkConfig, error)
RetrieveNetworkConfiguration returns the podCIDR, serviceCIDR, reservedSubnets and the externalCIDR as saved in the ipams.net.liqo.io custom resource instance.