Documentation ¶
Overview ¶
Package utils contains shared utility methods for the IPAM package.
Index ¶
- Constants
- func FromResult(result controllerutil.OperationResult) klog.Level
- func GetAddress(node *corev1.Node) (string, error)
- func GetAddressFromNodeList(nodes []corev1.Node) (string, error)
- func GetClusterID(ctx context.Context, cl kubernetes.Interface, namespace string) (liqov1beta1.ClusterID, error)
- func GetClusterIDFromLabels(labels map[string]string) (liqov1beta1.ClusterID, bool)
- func GetClusterIDFromLabelsWithKey(labels map[string]string, key string) (liqov1beta1.ClusterID, bool)
- func GetClusterIDWithControllerClient(ctx context.Context, cl client.Client, namespace string) (liqov1beta1.ClusterID, error)
- func GetClusterIDWithNativeClient(ctx context.Context, nativeClient kubernetes.Interface, namespace string) (liqov1beta1.ClusterID, error)
- func GetNodeClusterID(selectedNode *corev1.Node) (string, bool)
- func GetOwnerByKind(ownerReferences *[]v1.OwnerReference, kind string) *v1.OwnerReference
- func GetRestConfig(configPath string) (config *rest.Config, err error)
- func IsNodeReady(node *corev1.Node) bool
- func IsPreinstalledResource(obj metav1.Object) bool
- func IsVirtualNode(node *corev1.Node) bool
- func MergeNodeSelector(ns1, ns2 *corev1.NodeSelector) corev1.NodeSelector
- func PreUninstall(ctx context.Context, cl client.Client) error
- func RandomJitter(duration, maxJitter time.Duration) time.Duration
- func RandomString(n int) string
- func UserConfig(configPath string) (*rest.Config, error)
- func WriteFile(filepath string, content []byte) error
- type UninstallError
- type UninstallErrorType
Constants ¶
const ( // LogInfoLevel -> level associated with informational messages. LogInfoLevel = 0 // LogDebugLevel -> level associated with debug messages. LogDebugLevel = 4 )
const ( // GenericUninstallError is an error related to resources that needs to be removed. GenericUninstallError = "generic" // PendingActivePeerings is an error related peerings still active. PendingActivePeerings = "pendingActivePeerings" // PendingOffloadedNamespaces is an error related to namespaces still offloaded. PendingOffloadedNamespaces = "pendingOffloadedNamespaces" )
Variables ¶
This section is empty.
Functions ¶
func FromResult ¶ added in v0.3.0
func FromResult(result controllerutil.OperationResult) klog.Level
FromResult returns a logger level, given the result of a CreateOrUpdate operation.
func GetAddress ¶
GetAddress returns an address for a Node.
func GetAddressFromNodeList ¶
GetAddressFromNodeList returns an address from a Node pool.
func GetClusterID ¶ added in v0.3.2
func GetClusterID(ctx context.Context, cl kubernetes.Interface, namespace string) (liqov1beta1.ClusterID, error)
GetClusterID returns the local clusterID.
func GetClusterIDFromLabels ¶
func GetClusterIDFromLabels(labels map[string]string) (liqov1beta1.ClusterID, bool)
GetClusterIDFromLabels returns the clusterID from the given labels.
func GetClusterIDFromLabelsWithKey ¶
func GetClusterIDFromLabelsWithKey(labels map[string]string, key string) (liqov1beta1.ClusterID, bool)
GetClusterIDFromLabelsWithKey returns the clusterID from the given labels with the given key.
func GetClusterIDWithControllerClient ¶ added in v0.3.0
func GetClusterIDWithControllerClient(ctx context.Context, cl client.Client, namespace string) (liqov1beta1.ClusterID, error)
GetClusterIDWithControllerClient returns cluster identity using a client.Client client.
func GetClusterIDWithNativeClient ¶ added in v0.3.0
func GetClusterIDWithNativeClient(ctx context.Context, nativeClient kubernetes.Interface, namespace string) (liqov1beta1.ClusterID, error)
GetClusterIDWithNativeClient returns cluster identity using a kubernetes.Interface client.
func GetNodeClusterID ¶ added in v0.3.2
GetNodeClusterID returns the clusterID given a virtual node.
func GetOwnerByKind ¶ added in v0.3.0
func GetOwnerByKind(ownerReferences *[]v1.OwnerReference, kind string) *v1.OwnerReference
func GetRestConfig ¶ added in v0.3.0
GetRestConfig returns a rest.Config object to initialize a client to the target cluster.
func IsNodeReady ¶ added in v0.3.0
IsNodeReady returns true if the passed node has the NodeReady condition = True, false otherwise.
func IsPreinstalledResource ¶
IsPreinstalledResource returns whether the given resource was created at install-time by Liqo.
func IsVirtualNode ¶ added in v0.3.2
IsVirtualNode returns true if the passed node is a virtual node, false otherwise.
func MergeNodeSelector ¶ added in v0.3.2
func MergeNodeSelector(ns1, ns2 *corev1.NodeSelector) corev1.NodeSelector
MergeNodeSelector merges two nodeSelectors. Every MatchExpression of the first one must be merged with all the MatchExpressions of the second one: n first MatchExpressions. m second MatchExpressions. m * n MergedNodeSelector MatchExpressions. For each term in the first selector, AND each term of the second selector: (A || B) && (C || D) -> (A && C) || (A && D) || (B && C) || (B && D).
func PreUninstall ¶
PreUninstall checks if there are resources that need to be removed before uninstalling Liqo.
func RandomJitter ¶ added in v0.7.0
RandomJitter returns a duration between duration and duration + maxJitter.
func RandomString ¶ added in v0.4.0
RandomString generates a random string of the given length.
Types ¶
type UninstallError ¶
type UninstallError struct {
// contains filtered or unexported fields
}
UninstallError is an error type returned when there are errors during the uninstall process.
func (UninstallError) Error ¶
func (ue UninstallError) Error() string
Error returns the error message.
func (UninstallError) GetErrorTypes ¶
func (ue UninstallError) GetErrorTypes() []UninstallErrorType
GetErrorTypes returns the type of uninstall error.
type UninstallErrorType ¶
type UninstallErrorType string
UninstallErrorType is the type of uninstall error.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package apiserver contains utility functions to configure the connection parameters to the Kubernetes API server to advertise to peering clusters.
|
Package apiserver contains utility functions to configure the connection parameters to the Kubernetes API server to advertise to peering clusters. |
Package args contains shared utility methods for argument parsing and validation.
|
Package args contains shared utility methods for argument parsing and validation. |
Package clients contains utility methods to create and manage clients with custom features.
|
Package clients contains utility methods to create and manage clients with custom features. |
Package csr contains the logic required to generate, create and approve Certificate Signing Requests (CSR) for the Virtual Kubelet instances.
|
Package csr contains the logic required to generate, create and approve Certificate Signing Requests (CSR) for the Virtual Kubelet instances. |
Package dynamic contains utilities for working with dynamic client.
|
Package dynamic contains utilities for working with dynamic client. |
Package errors contains utility functions to deal with errors.
|
Package errors contains utility functions to deal with errors. |
Package events provides a simple event system for the application.
|
Package events provides a simple event system for the application. |
Package flags provides a set of utilities to manage flags.
|
Package flags provides a set of utilities to manage flags. |
Package foreigncluster contains shared utility methods to handle the ForeignCluster resources.
|
Package foreigncluster contains shared utility methods to handle the ForeignCluster resources. |
Package getters contains utility functions to get k8s resources and at the same time to extract data from the same resources.
|
Package getters contains utility functions to get k8s resources and at the same time to extract data from the same resources. |
Package grpc provides a set of utilities to manage grpc connections.
|
Package grpc provides a set of utilities to manage grpc connections. |
Package indexer provides indexers for controller-runtime managers.
|
Package indexer provides indexers for controller-runtime managers. |
Package ipam contains utility functions to deal with resources of the IPAM API.
|
Package ipam contains utility functions to deal with resources of the IPAM API. |
mapping
Package mapping contains utility functions to deal with the mapping of IPs.
|
Package mapping contains utility functions to deal with the mapping of IPs. |
Package ipc contains the logic to manage the Inter-Process Communication (IPC) between the gateway replicas.
|
Package ipc contains the logic to manage the Inter-Process Communication (IPC) between the gateway replicas. |
Package json contains some utilities to work with JSON.
|
Package json contains some utilities to work with JSON. |
Package kernel provides functions to interact with the kernel.
|
Package kernel provides functions to interact with the kernel. |
version
Package version provides functions to get kernel version and compare it with a given one.
|
Package version provides functions to get kernel version and compare it with a given one. |
Package kubeconfig provides utilities to work with kubeconfigs.
|
Package kubeconfig provides utilities to work with kubeconfigs. |
Package labels label selectors used throughout the liqo code in order to get k8s resources.
|
Package labels label selectors used throughout the liqo code in order to get k8s resources. |
Package mapper contains the utility functions for k8s resource REST mapping.
|
Package mapper contains the utility functions for k8s resource REST mapping. |
Package maps contains utility functions to manage maps.
|
Package maps contains utility functions to manage maps. |
Package network contains some utilities about networking module.
|
Package network contains some utilities about networking module. |
geneve
Package geneve contains utilities for the geneve interface
|
Package geneve contains utilities for the geneve interface |
netmonitor
Package netmonitor is a package that allows to monitor changes in the network interfaces.
|
Package netmonitor is a package that allows to monitor changes in the network interfaces. |
port
Package port provides utilities for working with network ports.
|
Package port provides utilities for working with network ports. |
Package pod contains utilities to deal with Pod objects.
|
Package pod contains utilities to deal with Pod objects. |
Package resource contains shared utility methods for resource management.
|
Package resource contains shared utility methods for resource management. |
Package resources contains utilities to get share resources quantities.
|
Package resources contains utilities to get share resources quantities. |
Package restcfg contains utility functions to deal with rest configs.
|
Package restcfg contains utility functions to deal with rest configs. |
Package slice contains utility functions to manage slices.
|
Package slice contains utility functions to manage slices. |
Package syncset provides a structure describing a set of elements safe for concurrent usage.
|
Package syncset provides a structure describing a set of elements safe for concurrent usage. |
Package testutil contains some methods useful to mock components while testing
|
Package testutil contains some methods useful to mock components while testing |
Package time contains utility functions for time management.
|
Package time contains utility functions for time management. |
Package trace contains utility functions to deal with traces.
|
Package trace contains utility functions to deal with traces. |
Package virtualkubelet contains utility functions to deal with virtual kubelet.
|
Package virtualkubelet contains utility functions to deal with virtual kubelet. |
Package virtualnode contains utils functions to manage virtual nodes.
|
Package virtualnode contains utils functions to manage virtual nodes. |