utils

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareRoute

func CompareRoute()

func ContainsLoadBalancerIP

func ContainsLoadBalancerIP(svc *v1.Service, ip string) bool

func DetectClusterCIDR

func DetectClusterCIDR(k8sCli *kubernetes.Clientset) (string, error)

func DetectKubeProxyMode

func DetectKubeProxyMode(k8sCli *kubernetes.Clientset) (string, error)

func DetectNetworkPlugin

func DetectNetworkPlugin(k8sCli *kubernetes.Clientset) (networkMode string, err error)

func GetOSFromNode

func GetOSFromNode(node *v1.Node) string

func IPMatchPrefix

func IPMatchPrefix(ip net.IP, cidr string) (bool, error)

func MatchPrefix

func MatchPrefix(ip, cidr string) (bool, error)

func NewConfig

func NewConfig(kubeconfigPath string) (*rest.Config, *clientcmd.ClientConfig, error)

NewConfig returns a new Kubernetes configuration object

func Normalize

func Normalize(objType string, obj interface{}) string

func ToPointer

func ToPointer[T any](v T) *T

Types

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[T any]() Queue[T]

func (*Queue[T]) Empty

func (q *Queue[T]) Empty() bool

func (*Queue[T]) Enqueue

func (q *Queue[T]) Enqueue(elements ...T)

func (*Queue[T]) Pop

func (q *Queue[T]) Pop() T

Pop will get a value from the end of the queue and remove it. If no element in the queue, it will return nil.

type Stack

type Stack[V any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[V any](v ...V) *Stack[V]

func (*Stack[V]) Empty

func (s *Stack[V]) Empty() bool

func (*Stack[V]) Pop

func (s *Stack[V]) Pop() V

func (*Stack[V]) Push

func (s *Stack[V]) Push(v V)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL