Documentation ¶
Overview ¶
Package utils contains shared utility methods for the Liqonet package.
Index ¶
- Constants
- func FromResult(result controllerutil.OperationResult) klog.Level
- func GetClusterID(ctx context.Context, cl kubernetes.Interface, namespace string) (string, error)
- func GetClusterIdentityWithControllerClient(ctx context.Context, controllerClient client.Client, namespace string) (discoveryv1alpha1.ClusterIdentity, error)
- func GetClusterIdentityWithNativeClient(ctx context.Context, nativeClient kubernetes.Interface, namespace string) (discoveryv1alpha1.ClusterIdentity, error)
- func GetClusterName(ctx context.Context, k8sClient kubernetes.Interface, namespace string) (string, 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 IsVirtualNode(node *corev1.Node) bool
- func MergeMaps(m1, m2 map[string]string) map[string]string
- func MergeNodeSelector(ns1, ns2 *corev1.NodeSelector) corev1.NodeSelector
- func RandomString(n int) string
- func SubMaps(m1, m2 map[string]string) map[string]string
- func UserConfig(configPath string) (*rest.Config, error)
- func WriteFile(filepath string, content []byte) error
Constants ¶
const ( // LogInfoLevel -> level associated with informational messages. LogInfoLevel = 0 // LogDebugLevel -> level associated with debug messages. LogDebugLevel = 4 )
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 GetClusterID ¶ added in v0.3.2
GetClusterID returns the local clusterID.
func GetClusterIdentityWithControllerClient ¶ added in v0.3.2
func GetClusterIdentityWithControllerClient(ctx context.Context, controllerClient client.Client, namespace string) (discoveryv1alpha1.ClusterIdentity, error)
GetClusterIdentityWithControllerClient returns cluster identity using a client.Client client.
func GetClusterIdentityWithNativeClient ¶ added in v0.3.2
func GetClusterIdentityWithNativeClient(ctx context.Context, nativeClient kubernetes.Interface, namespace string) (discoveryv1alpha1.ClusterIdentity, error)
GetClusterIdentityWithNativeClient returns cluster identity using a kubernetes.Interface client.
func GetClusterName ¶ added in v0.3.2
func GetClusterName(ctx context.Context, k8sClient kubernetes.Interface, namespace string) (string, error)
GetClusterName returns the local cluster name.
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 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 RandomString ¶ added in v0.4.0
RandomString generates a random string of the given length.
Types ¶
This section is empty.
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 authenticationtoken contains shared utility methods for the management of the authentication token.
|
Package authenticationtoken contains shared utility methods for the management of the authentication token. |
Package cachedclient contains utility methods to create a new controller runtime client with cache.
|
Package cachedclient contains utility methods to create a new controller runtime client with cache. |
Package errors contains utility functions to deal with errors.
|
Package errors contains utility functions to deal with errors. |
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 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 peeringconditionsutils contains shared utility methods to handle the PeeringCondition resource.
|
Package peeringconditionsutils contains shared utility methods to handle the PeeringCondition resource. |
Package pod contains utilities to deal with Pod objects.
|
Package pod contains utilities to deal with Pod objects. |
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 trace contains utility functions to deal with traces.
|
Package trace contains utility functions to deal with traces. |