utils

package
v0.0.0-...-16423e1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
	IMDSv1Server      = "http://169.254.169.254"
	IMDSConfigMapName = "aws-data"
	CIDRKey           = "vpc-cidr"
)

Variables

This section is empty.

Functions

func AddAnnotation

func AddAnnotation(obj client.Object, key string, value string)

func AddFinalizer

func AddFinalizer(obj client.Object, finalizer string) bool

func AddLabel

func AddLabel(obj client.Object, key string, value string)

AddLabel add a label to a resource metadata

func AddOwnerReference

func AddOwnerReference(owner, res client.Object, scheme *runtime.Scheme, isController bool) error

func Contains

func Contains(slice []string, s string) bool

Contains checks whether a string is contained within a slice

func DeploymentNameFromPodName

func DeploymentNameFromPodName(podName string) (string, error)

func GetResourceRequirements

func GetResourceRequirements(name string) corev1.ResourceRequirements

func HTTPGetAndParseBody

func HTTPGetAndParseBody(endpoint string) (string, error)

func HandleMissingWatch

func HandleMissingWatch(missingCRDName string)

func IMDSFetchIPv4CIDR

func IMDSFetchIPv4CIDR(imdsServerAddr string) (string, error)

func MapItems

func MapItems(source []string, transform func(string) string) []string

func MarshalRookResourceRequirements

func MarshalRookResourceRequirements(reqList RookResourceRequirementsList) string

func Remove

func Remove(slice []string, s string) (result []string)

Remove eliminates a given string from a slice and returns the new slice

func RemoveFinalizer

func RemoveFinalizer(obj client.Object, finalizer string) bool

func Retry

func Retry(attempts int, sleep time.Duration, f func() error) error

func ToJsonOrDie

func ToJsonOrDie(value interface{}) []byte

func ToPointer

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

ToPointer returns address of the variable

Types

type RookResourceRequirements

type RookResourceRequirements struct {
	Name     string
	Resource corev1.ResourceRequirements `json:"resource,omitempty"`
}

The Rook config requires the resources requirements in yaml format. Marshalling corev1.ResourceRequirements into yaml does not render the Quantity values as need. This type and the below helper function are used so that the resource configurations in reconcileRookCephOperatorConfig are marshalled properly.

type RookResourceRequirementsList

type RookResourceRequirementsList []RookResourceRequirements

Jump to

Keyboard shortcuts

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