utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRuntimesIfNotExist

func AddRuntimesIfNotExist(runtimes []data.Runtime, newRuntime data.Runtime) (updatedRuntimes []data.Runtime)

AddRuntimesIfNotExist

func ContainsString

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

func FindDataLoadWithPredicate

func FindDataLoadWithPredicate(c client.Client, namespace string, predFunc func(dl datav1alpha1.AlluxioDataLoad) bool) (dataload *datav1alpha1.AlluxioDataLoad, err error)

* list all DataLoad objects in a specific namespace and return the first one that satisfies a predicate. * The predicate should be a function which returns a bool given a DataLoad object

func GetAlluxioRuntime

func GetAlluxioRuntime(client client.Client, name, namespace string) (*data.AlluxioRuntime, error)

Get Alluxio Runtime object given name and namespace

func GetChartsDirectory

func GetChartsDirectory() string

Get the directory of charts

func GetDataLoad

func GetDataLoad(client client.Client, name, namespace string) (*datav1alpha1.AlluxioDataLoad, error)

* Get DataLoad object with name and namespace.

func GetDataset

func GetDataset(client client.Client, name, namespace string) (*datav1alpha1.Dataset, error)

* Get the dataset

func GetDatasetCondition

func GetDatasetCondition(conditions []datav1alpha1.DatasetCondition,
	condType datav1alpha1.DatasetConditionType) (index int, condition *datav1alpha1.DatasetCondition)

func GetJobNameFromReleaseName

func GetJobNameFromReleaseName(releaseName string) string

* Return the related job name given a release name. * A release name should be like <dataset>-load-<random_suffix>, * and the returned job name will be like <dataset>-loader-job-<random_suffix>

func GetOrDefault

func GetOrDefault(str *string, defaultValue string) string

func GetRuntimeCondition

func GetRuntimeCondition(conditions []data.RuntimeCondition,
	condType data.RuntimeConditionType) (index int, condition *data.RuntimeCondition)

func HasDeletionTimestamp

func HasDeletionTimestamp(obj metav1.ObjectMeta) bool

HasDeletionTimestamp method that makes logic easier to read.

func Home

func Home() (string, error)

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound ignores not found

func IsDatasetConditionExist

func IsDatasetConditionExist(conditions []datav1alpha1.DatasetCondition,
	cond datav1alpha1.DatasetCondition) (found bool)

func NewDatasetCondition

func NewDatasetCondition(conditionType datav1alpha1.DatasetConditionType, reason, message string, status v1.ConditionStatus) datav1alpha1.DatasetCondition

NewDatasetCondition creates a new Cache condition.

func NewReleaseName

func NewReleaseName(datasetName string) string

* Generate a new release Name for DataLoad

func NewRuntime

func NewRuntime(name, namespace string, category common.Category, runtimeType string) data.Runtime

NewRuntimeCondition creates a new Cache condition.

func NewRuntimeCondition

func NewRuntimeCondition(conditionType data.RuntimeConditionType, reason, message string, status v1.ConditionStatus) data.RuntimeCondition

NewRuntimeCondition creates a new Cache condition.

func NoRequeue

func NoRequeue() (ctrl.Result, error)

No requeue

func Now

func Now() *metav1.Time

func PathExists

func PathExists(path string) bool

func RandomAlphaNumberString

func RandomAlphaNumberString(l int32) string

Return a string of length l which is made up of runes randomly selected from [0-9a-z]

func RandomString

func RandomString(source []rune, l int32) string

Return a string of length l which is made up of runes randomly selected from `source`

func RemoveString

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

func RequeueAfterInterval

func RequeueAfterInterval(interval time.Duration) (ctrl.Result, error)

func RequeueIfError

func RequeueIfError(err error) (ctrl.Result, error)

func RequeueImmediately

func RequeueImmediately() (ctrl.Result, error)

func RequeueImmediatelyUnlessGenerationChanged

func RequeueImmediatelyUnlessGenerationChanged(prevGeneration, curGeneration int64) (ctrl.Result, error)

Helper function which requeues immediately if the object generation has not changed. Otherwise, since the generation change will trigger an immediate update anyways, this will not requeue. This prevents some cases where two reconciliation loops will occur.

func SplitSchemaAddr

func SplitSchemaAddr(addr string) (string, string)

func ToYaml

func ToYaml(values interface{}, file *os.File) error

func TransformRequirementsToResources

func TransformRequirementsToResources(res corev1.ResourceRequirements) (cRes common.Resources)

func UpdateDatasetCondition

func UpdateDatasetCondition(conditions []datav1alpha1.DatasetCondition, condition datav1alpha1.DatasetCondition) []datav1alpha1.DatasetCondition

SetDatasetCondition updates the dataset to include the provided condition. If the condition that we are about to add already exists and has the same status and reason then we are not going to update.

func UpdateRuntimeCondition

func UpdateRuntimeCondition(conditions []data.RuntimeCondition, condition data.RuntimeCondition) []data.RuntimeCondition

SetDatasetCondition updates the dataset to include the provided condition. If the condition that we are about to add already exists and has the same status and reason then we are not going to update.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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