util

package
v0.2.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CRDKind                              = "CustomResourceDefinition"
	CRDGroup                             = "apiextensions.k8s.io"
	CRDVersion                           = "v1"
	ServiceVersion                       = "v1"
	ServiceKind                          = "Service"
	AnnotationToPreserveValuesKey        = "annotations.kubestellar.io/preserve"
	PreserveNodePortValue                = "nodeport"
	UnableToRetrieveCompleteAPIListError = "unable to retrieve the complete list of server APIs"

	AppliedManifestWorkKind     = "AppliedManifestWork"
	AppliedManifestWorkResource = "appliedmanifestworks"
)

Variables

This section is empty.

Functions

func BuildWorkstatusName

func BuildWorkstatusName(aw workv1.AppliedManifestWork, obj any) string

BuildWorkstatusName builds a unique work status name from the applied manifest uid and manifestwork name

func ConvertRuntimeObjectToUnstructured

func ConvertRuntimeObjectToUnstructured(obj runtime.Object) (*unstructured.Unstructured, error)

func CopyObjectMetaAndType

func CopyObjectMetaAndType(obj runtime.Object) runtime.Object

create a minimal runtime.Object copy with no spec and status for use with the delete

func GenerateObjectInfoString

func GenerateObjectInfoString(obj runtime.Object) string

Used for generating a single string unique representation of the object for logging info

func GetObjectFromKey

func GetObjectFromKey(listers *SafeMap, key Key) (runtime.Object, error)

func GetObjectStatusAsBytes

func GetObjectStatusAsBytes(obj runtime.Object) ([]byte, error)

func HasPrefixInMap

func HasPrefixInMap(m map[string]string, prefix string) bool

func IsAppliedManifestWork

func IsAppliedManifestWork(o interface{}) bool

func IsBeingDeleted

func IsBeingDeleted(obj runtime.Object) bool

func IsCRD

func IsCRD(o interface{}) bool

func IsListerNotFound

func IsListerNotFound(err error) bool

func KeyForGroupVersionKind

func KeyForGroupVersionKind(group, version, kind string) string

Create a string key in the form group/version/Kind or version/Kind if the group is empty

func ZeroFields

func ZeroFields(obj runtime.Object) runtime.Object

Types

type AppliedManifestInfo

type AppliedManifestInfo struct {
	ObjectUIDs []string
	GVRs       []*schema.GroupVersionResource
}

a struct to keep track of resources tracked in applied manifest work

func GetAddedRemovedInfo

func GetAddedRemovedInfo(base AppliedManifestInfo, updated AppliedManifestInfo) (added, removed AppliedManifestInfo)

GetAddedRemovedInfo compares the updated AppliedManifestInfo to the base AppliedManifestInfo and returns AppliedManifestInfos for added and removed elements.

type Key

type Key struct {
	GvkKey           string
	NamespaceNameKey string
	DeletedObject    *runtime.Object
}

Key struct used to add items to the workqueue. The key is used to identify the group/version/Kind of an object, used to index the listers for all objects, and the namespace/name key for the object. For deleted objects, since they are no longer in the cache, the key stores a shallow copy of the deleted object.

func KeyForGroupVersionKindNamespaceName

func KeyForGroupVersionKindNamespaceName(obj any) (Key, error)

Given an object that implements runtime.Object, create a key of type Key that contains the groupVersionKind key and name/namespace

type Names

type Names struct {
	ManifestName   string
	WorkStatusName string
}

a struct to maintain the names of manifestwork and status

type SafeMap

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

SafeMap provides a simple thread-safe map for concurrent access

func NewSafeMap

func NewSafeMap() *SafeMap

func (*SafeMap) Delete

func (s *SafeMap) Delete(key string)

func (*SafeMap) Get

func (s *SafeMap) Get(key string) (interface{}, bool)

func (*SafeMap) ListValues

func (s *SafeMap) ListValues() []interface{}

func (*SafeMap) Set

func (s *SafeMap) Set(key string, value interface{})

type SafeUIDMap

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

func NewSafeUIDMap

func NewSafeUIDMap() *SafeUIDMap

func (*SafeUIDMap) AddUID

func (s *SafeUIDMap) AddUID(key, uid string)

func (*SafeUIDMap) DeleteUID

func (s *SafeUIDMap) DeleteUID(key, uid string)

func (*SafeUIDMap) GetUIDCount

func (s *SafeUIDMap) GetUIDCount(key string) int

Jump to

Keyboard shortcuts

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