util

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigSecretDataKey = "kubeconfig"
)

Variables

This section is empty.

Functions

func CheckNamespacedName added in v0.1.1

func CheckNamespacedName(name string) bool

CheckNamespacedName checks if the given string is in the format of "namespace/name".

func CountIP added in v0.1.3

func CountIP(r *allocator.Range) int64

func Filter

func Filter[T any](ss []T, test func(T) bool) (ret []T)

Filter is a generic filter function.

func GetHarvesterClientFromSecret

func GetHarvesterClientFromSecret(secret *corev1.Secret) (*hvclientset.Clientset, error)

func GetNamespacedName added in v0.1.1

func GetNamespacedName(name string, alternativeTargetNS string) (error, types.NamespacedName)

GetNamespacedName returns the namespace and name from the given string in the format of "namespace/name".

func GetSecretForHarvesterConfig

func GetSecretForHarvesterConfig(ctx context.Context, cluster *infrav1.HarvesterCluster, cl client.Client) (*corev1.Secret, error)

func Healthcheck

func Healthcheck(config *clientcmdapi.Config) (bool, error)

func MakeRange added in v0.1.3

func MakeRange(r *lbv1beta1.Range) (*allocator.Range, error)

func MergeCloudInitData

func MergeCloudInitData(cloudInits ...string) ([]byte, error)

func NewTrue

func NewTrue() *bool

NewTrue returns a pointer to true.

func RandomID

func RandomID() string

RandomID returns a random string used as an ID internally in Harvester.

Types

type Store added in v0.1.3

type Store struct {
	// IPPool is the pool of IP addresses.
	*lbv1beta1.IPPool
}

Store implements the backend.Store interface.

func NewStore added in v0.1.3

func NewStore(pool *lbv1beta1.IPPool) *Store

New creates a new store.

func (*Store) Close added in v0.1.3

func (s *Store) Close() error

func (*Store) GetByID added in v0.1.3

func (s *Store) GetByID(id string, _ string) []net.IP

func (*Store) LastReservedIP added in v0.1.3

func (s *Store) LastReservedIP(rangeID string) (net.IP, error)

func (*Store) Lock added in v0.1.3

func (s *Store) Lock() error

Lock locks the store.

func (*Store) Release added in v0.1.3

func (s *Store) Release(ip net.IP) error

func (*Store) ReleaseByID added in v0.1.3

func (s *Store) ReleaseByID(id string, _ string) error

func (*Store) Reserve added in v0.1.3

func (s *Store) Reserve(id, _ string, ip net.IP, _ string) (bool, error)

func (*Store) Unlock added in v0.1.3

func (s *Store) Unlock() error

Jump to

Keyboard shortcuts

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