utils

package
v0.0.0-...-b380f87 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient() kubernetes.Interface

GetClient returns a k8s clientset to the request from inside of cluster

func GetClientOutOfCluster

func GetClientOutOfCluster() kubernetes.Interface

GetClientOutOfCluster returns a k8s clientset to the request from outside of cluster

func GetObjectMetaData

func GetObjectMetaData(obj interface{}) (objectMeta meta_v1.ObjectMeta)

GetObjectMetaData returns metadata of a given k8s object

func StartUpdateRoutine

func StartUpdateRoutine(ctx context.Context, resource *TTLList, updateCh <-chan httpInput)

Types

type Item

type Item struct {
	Value     string
	ExpiresAt time.Time
}

Item represents an item in the list with a TTL.

type ItemSlice

type ItemSlice []Item

ItemSlice is a type alias for a slice of Items

func (ItemSlice) ExtendIfExists

func (items ItemSlice) ExtendIfExists(value string, ttl time.Duration) bool

Contains checks if a value exists in the slice.

type TTLList

type TTLList struct {
	// contains filtered or unexported fields
}

TTLList represents a list with TTL for each item.

func NewTTLList

func NewTTLList() *TTLList

NewTTLList creates a new TTLList.

func (*TTLList) Add

func (l *TTLList) Add(value string, ttl time.Duration) error

Add adds a new item to the list with a specified TTL.

func (*TTLList) Contains

func (l *TTLList) Contains(value string) bool

Contains checks if a value exists in the list.

func (*TTLList) GetTTL

func (l *TTLList) GetTTL(namespace string) time.Duration

func (*TTLList) Remove

func (l *TTLList) Remove(value string)

Remove removes items from the list based on a matching value.

func (*TTLList) Reset

func (l *TTLList) Reset()

REMOVE ALL

Jump to

Keyboard shortcuts

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