common

package
v1.16.30-beta2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeStandalone = "standalone"
	ModeAgent      = "agent"
)

Variables

This section is empty.

Functions

func AppendTypeMeta

func AppendTypeMeta(kind string, version schema.GroupVersion, crs ...ObjectWithTypeMeta)

func CleanObjectMeta

func CleanObjectMeta(crs ...metav1.Object)

func DeserializeCRD

func DeserializeCRD(cr runtime.Object, content []byte) error

func GetMapValue

func GetMapValue[T any, K comparable](m map[K]T, k K, def T) T

func MapMap

func MapMap[T any, U any](m map[string]T, fn func(T) U) map[string]U

func MapPtr

func MapPtr[T any, U any](v *T, fn func(T) U) *U

func MapSlice

func MapSlice[T any, U any](s []T, fn func(T) U) []U

func MergeMaps

func MergeMaps(ms ...map[string]string) map[string]string

MergeMaps merges multiple maps into one, the later ones takes precedence over the first ones

func Ptr

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

func PtrOrNil

func PtrOrNil[T comparable](v T) *T

func ResolvePtr

func ResolvePtr[T any](v *T, def T) T

func SerializeCRD

func SerializeCRD(cr interface{}, opts SerializeOptions) ([]byte, error)

func SerializeCRDs

func SerializeCRDs[T interface{}](crs []T, opts SerializeOptions) ([]byte, error)

SerializeCRDs builds a serialized version of CRD, persisting the order of properties from the struct.

Types

type ObjectWithTypeMeta

type ObjectWithTypeMeta interface {
	SetGroupVersionKind(schema.GroupVersionKind)
}

type SerializeOptions

type SerializeOptions struct {
	OmitCreationTimestamp bool
	CleanMeta             bool
	Kind                  string
	GroupVersion          *schema.GroupVersion
}

Jump to

Keyboard shortcuts

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