Documentation
¶
Index ¶
- func AppendEnvVarIfNotExists(slice []v1.EnvVar, elems ...v1.EnvVar) []v1.EnvVar
- func AppendPortIfNotExists(slice []v1.ContainerPort, elems ...v1.ContainerPort) []v1.ContainerPort
- func AppendVolumeIfNotExists(slice []v1.Volume, volume v1.Volume) []v1.Volume
- func Bool(b bool) *bool
- func Filter(origin map[string]string, predicate func(string) bool) map[string]string
- func FirstNonNilError(objects []error) error
- func GetAvailableResourcesForApi(config *rest.Config, groupVersion string) (*metav1.APIResourceList, error)
- func GetInstanceTypeShortName(currentInstanceType string) (string, error)
- func GetNodeInstanceType(logger logging.Interface) (string, error)
- func Includes(slice []string, value string) bool
- func IncludesArg(slice []string, arg string) bool
- func IsCrdAvailable(config *rest.Config, groupVersion, kind string) (bool, error)
- func IsGPUEnabled(requirements v1.ResourceRequirements) bool
- func IsPrefixSupported(input string, prefixes []string) bool
- func IsStringEmptyOrWithWhitespaces(input string) bool
- func MergeEnvs(baseEnvs []v1.EnvVar, overrideEnvs []v1.EnvVar) []v1.EnvVar
- func RemoveString(slice []string, s string) (result []string)
- func Retry(attempts int, sleep time.Duration, f func() error) (err error)
- func SetAvailableResourcesForApi(groupVersion string, resources *metav1.APIResourceList)
- func UInt64(u uint64) *uint64
- func Union(maps ...map[string]string) map[string]string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendEnvVarIfNotExists ¶
func AppendPortIfNotExists ¶
func AppendPortIfNotExists(slice []v1.ContainerPort, elems ...v1.ContainerPort) []v1.ContainerPort
func AppendVolumeIfNotExists ¶
func FirstNonNilError ¶
FirstNonNilError returns the first non nil interface in the slice
func GetAvailableResourcesForApi ¶
func GetAvailableResourcesForApi(config *rest.Config, groupVersion string) (*metav1.APIResourceList, error)
GetAvailableResourcesForApi returns the list of discovered resources that belong to the API specified in groupVersion. The first query to a specifig groupVersion will query the cluster API server to discover the available resources and the discovered resources will be cached and returned to subsequent invocations to prevent additional queries to the API server.
func GetInstanceTypeShortName ¶ added in v0.1.3
func GetNodeInstanceType ¶ added in v0.1.3
GetNodeInstanceType retrieves the instance type of the node. NOTE: This implementation is currently specific to Oracle Cloud Infrastructure (OCI) and uses the OCI IMDS client. A future refactor is needed to support other cloud providers' metadata services.
func IncludesArg ¶
func IsCrdAvailable ¶
IsCrdAvailable checks if a given CRD is present in the cluster by verifying the existence of its API.
func IsGPUEnabled ¶
func IsGPUEnabled(requirements v1.ResourceRequirements) bool
func IsPrefixSupported ¶
IsPrefixSupported Check if a given string contains one of the prefixes in the provided list.
func MergeEnvs ¶
MergeEnvs Merge a slice of EnvVars (`O`) into another slice of EnvVars (`B`), which does the following: 1. If an EnvVar is present in B but not in O, value remains unchanged in the result 2. If an EnvVar is present in `O` but not in `B`, appends to the result 3. If an EnvVar is present in both O and B, uses the value from O in the result
func RemoveString ¶
RemoveString Helper functions to remove string from a slice of strings.
func SetAvailableResourcesForApi ¶
func SetAvailableResourcesForApi(groupVersion string, resources *metav1.APIResourceList)
SetAvailableResourcesForApi stores the value fo resources argument in the global cache of discovered API resources. This function should never be called directly. It is exported for usage in tests.
Types ¶
This section is empty.