Documentation
¶
Index ¶
- func CallWithRetry(ctx context.Context, call func(retryTimes int) (shouldRetry bool, err error), ...) error
- func CheckAndFinallyCall(ctx context.Context, checkFunc func(context.Context) (bool, error), ...) error
- func ConvertBizStatusToContainerStatus(container *corev1.Container, containerStatus *corev1.ContainerStatus, ...) (*corev1.ContainerStatus, error)
- func ConvertByteNumToResourceQuantity(byteNum int64) resource.Quantity
- func ConvertNodeToNodeInfo(node *corev1.Node) model.NodeInfo
- func DefaultRateLimiter(retryTimes int) time.Duration
- func ExtractNodeIDFromNodeName(nodeName string) string
- func FillPodKey(pods []corev1.Pod, bizStatusDatas []model.BizStatusData) (toUpdate []model.BizStatusData, toDelete []model.BizStatusData)
- func FormatNodeName(nodeID, env string) string
- func GetBizNameAndVersionFromUniqueKey(bizUniqueKey string) (string, string)
- func GetBizUniqueKey(container *corev1.Container) string
- func GetContainerKey(podKey, containerName string) string
- func GetContainerNameFromContainerKey(containerKey string) string
- func GetEnv(key, defaultValue string) string
- func GetNameSpaceAndNameFromPodKey(podKey string) (string, string)
- func GetPodKey(pod *corev1.Pod) string
- func GetPodKeyFromContainerKey(containerKey string) string
- func MergeNodeFromProvider(node *corev1.Node, data model.NodeStatusData) *corev1.Node
- func PodsEqual(pod1, pod2 *corev1.Pod) bool
- func SplitMetaNamespaceKey(key string) (namespace, name string, err error)
- func TimedTaskWithInterval(ctx context.Context, interval time.Duration, task func(context.Context))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallWithRetry ¶ added in v0.3.0
func CallWithRetry(ctx context.Context, call func(retryTimes int) (shouldRetry bool, err error), retryRateLimiter func(retryTimes int) time.Duration) error
CallWithRetry attempts to call a function with retries based on a custom rate limiter.
func CheckAndFinallyCall ¶ added in v0.2.0
func CheckAndFinallyCall(ctx context.Context, checkFunc func(context.Context) (bool, error), timeout, interval time.Duration, finally, timeoutCall func()) error
CheckAndFinallyCall checks a condition at a specified interval until it's true or a timeout occurs.
func ConvertBizStatusToContainerStatus ¶ added in v0.3.4
func ConvertBizStatusToContainerStatus(container *corev1.Container, containerStatus *corev1.ContainerStatus, data *model.BizStatusData) (*corev1.ContainerStatus, error)
ConvertBizStatusToContainerStatus converts tunnel container status to Kubernetes container status, if not the status for the container, then create a empty state container status
func ConvertByteNumToResourceQuantity ¶
ConvertByteNumToResourceQuantity converts a byte number to a resource quantity.
func ConvertNodeToNodeInfo ¶ added in v0.3.6
func DefaultRateLimiter ¶ added in v0.3.0
DefaultRateLimiter calculates the duration for retry based on the number of retries.
func ExtractNodeIDFromNodeName ¶ added in v0.2.0
ExtractNodeIDFromNodeName extracts the node ID from a node name.
func FillPodKey ¶ added in v0.3.4
func FillPodKey(pods []corev1.Pod, bizStatusDatas []model.BizStatusData) (toUpdate []model.BizStatusData, toDelete []model.BizStatusData)
func FormatNodeName ¶ added in v0.2.0
FormatNodeName constructs a node name based on node ID and environment.
func GetBizNameAndVersionFromUniqueKey ¶ added in v0.3.8
GetBizNameAndVersionFromUniqueKey extracts the biz name and version from a unique key
func GetBizUniqueKey ¶ added in v0.3.4
GetBizUniqueKey returns a unique key for the container
func GetContainerKey ¶ added in v0.2.0
GetContainerKey constructs a container key from a pod key and container name.
func GetContainerNameFromContainerKey ¶ added in v0.2.0
GetContainerNameFromContainerKey extracts the container name from a container key.
func GetEnv ¶ added in v0.2.0
GetEnv retrieves an environment variable or returns a default value if not set.
func GetNameSpaceAndNameFromPodKey ¶ added in v0.3.7
func GetPodKeyFromContainerKey ¶ added in v0.2.0
GetPodKeyFromContainerKey extracts the pod key from a container key.
func MergeNodeFromProvider ¶ added in v0.3.5
MergeNodeFromProvider constructs a virtual node based on the latest node status data.
func PodsEqual ¶
PodsEqual checks if two pods are equal based on specific fields that can be modified after startup.
func SplitMetaNamespaceKey ¶ added in v0.2.0
SplitMetaNamespaceKey splits a key into namespace and name.
Types ¶
This section is empty.