utils

package
v0.0.0-...-a14639f Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 11 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 metav1.Object, key string, value string)

func AddLabel

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

AddLabel add a label to a resource metadata

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 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 Retry

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

func ToJsonOrDie

func ToJsonOrDie(value interface{}) []byte

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