utils

package
v0.9.1 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: 46 Imported by: 0

Documentation

Overview

Copyright 2023 The Fluid Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	KiB = 1024
	MiB = 1024 * KiB
	GiB = 1024 * MiB
	TiB = 1024 * GiB
	PiB = 1024 * TiB
	EiB = 1024 * PiB
)
View Source
const MountRoot string = "MOUNT_ROOT"

Variables

View Source
var (
	ServerlessPlatformKey string = ""
	ServerlessPlatformVal string = ""
)

Functions

func AddRuntimesIfNotExist

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

AddRuntimesIfNotExist adds newRuntime to runtimes and return the updated runtime slice

func AppContainerPostStartInjectEnabled added in v0.8.0

func AppContainerPostStartInjectEnabled(infos map[string]string) (match bool)

func AppControllerDisabled added in v0.8.0

func AppControllerDisabled(info map[string]string) (match bool)

func AppendOrOverrideVolume added in v0.9.0

func AppendOrOverrideVolume(volumes []corev1.Volume, vol corev1.Volume) []corev1.Volume

func AppendOrOverrideVolumeMounts added in v0.9.0

func AppendOrOverrideVolumeMounts(volumeMounts []corev1.VolumeMount, vm corev1.VolumeMount) []corev1.VolumeMount

func BytesSize added in v0.4.0

func BytesSize(size float64) string

BytesSize returns a human-readable size in bytes, kibibytes, mebibytes, gibibytes, or tebibytes, but with a B, kB, MB unit style. This is to make byte units be in consistent with Alluxio See https://github.com/Alluxio/alluxio/blob/master/core/common/src/main/java/alluxio/util/FormatUtils.java#L135

func CalculateDuration added in v0.6.0

func CalculateDuration(creationTime time.Time, finishTime time.Time) string

CalculateDuration generates a string of duration from creationTime and finishTime if finish time is zero, use current time as default

func ChangeNodeLabelWithPatchMode added in v0.6.0

func ChangeNodeLabelWithPatchMode(cli client.Client, node *v1.Node, labelsToModify common.LabelsToModify) (modifiedLabels []string, err error)

ChangeNodeLabelWithPatchMode updates the input labels in PATCH mode.

func ChangeNodeLabelWithUpdateMode added in v0.6.0

func ChangeNodeLabelWithUpdateMode(client client.Client, node *v1.Node, labelsToModify common.LabelsToModify) (modifiedLabels []string, err error)

ChangeNodeLabelWithUpdateMode updates the input labels in UPDATE mode.

func CheckMountPointBroken added in v0.7.0

func CheckMountPointBroken(mountPath string) (broken bool, err error)

func CheckMountReadyAndSubPathExist added in v0.9.0

func CheckMountReadyAndSubPathExist(fluidPath string, mountType string, subPath string) error

func CheckObject added in v0.8.0

func CheckObject(client client.Client, key types.NamespacedName, obj client.Object) (found bool, err error)

func ContainsAll added in v0.6.0

func ContainsAll(m map[string]string, slice []string) bool

ContainsAll checks if a map contains all the elements in a slice

func ContainsOwners added in v0.5.0

func ContainsOwners(owners []metav1.OwnerReference, dataset *datav1alpha1.Dataset) bool

ContainsOwners Determine whether the slice of owners contains the owner of a Dataset return true if contains the owner and return false if not.

func ContainsSelector added in v0.5.0

func ContainsSelector(labels map[string]string, selector map[string]string) bool

ContainsSelector Determine whether the labels contain the selector

func ContainsString

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

ContainsString Determine whether the string array contains a specific string return true if contains the string and return false if not.

func ContainsSubString added in v0.8.0

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

ContainsSubString Determine whether the string array contains a sub string return true if contains the string and return false if not.

func CreateRuntimeForReferenceDatasetIfNotExist added in v0.9.0

func CreateRuntimeForReferenceDatasetIfNotExist(client client.Client, dataset *datav1alpha1.Dataset) (err error)

CreateRuntimeForReferenceDatasetIfNotExist creates runtime for ReferenceDataset

func DumpJSON added in v0.8.0

func DumpJSON(o interface{}) string

DumpJSON returns the JSON encoding

func FillSliceWithString added in v0.5.0

func FillSliceWithString(str string, num int) *[]string

FillSliceWithString fills a slice with repeated given string

func FilterVolumesByVolumeMounts added in v0.9.0

func FilterVolumesByVolumeMounts(volumes []corev1.Volume, volumeMounts []corev1.VolumeMount) []corev1.Volume

FilterVolumesByVolumeMounts returns volumes that exists in the volumeMounts

func FindVolumeByVolumeMount added in v0.9.0

func FindVolumeByVolumeMount(volumeMount corev1.VolumeMount, volumes []corev1.Volume) *corev1.Volume

func FromHumanSize added in v0.4.0

func FromHumanSize(size string) (int64, error)

FromHumanSize returns an integer from a human-readable specification of a size with 1024 as multiplier e.g.:

  1. 1 KiB = 1024 byte

func FromRawToObject added in v0.7.0

func FromRawToObject(raw []byte) (obj runtime.Object, err error)

FromRawToObject is used to convert from raw to the runtime object

func FuseSidecarEnabled added in v0.7.0

func FuseSidecarEnabled(infos map[string]string) (match bool)

func FuseSidecarUnprivileged added in v0.8.0

func FuseSidecarUnprivileged(infos map[string]string) (match bool)

func GetAccessModesOfDataset added in v0.5.0

func GetAccessModesOfDataset(client client.Client, name, namespace string) (accessModes []corev1.PersistentVolumeAccessMode, err error)

func GetAddressOfMaster added in v0.5.0

func GetAddressOfMaster(pod *v1.Pod) (nodeName string, ip string, rpcPort int32)

GetAddressOfMaster return the ip and port of engine master

func GetAlluxioRuntime

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

GetAlluxioRuntime gets Alluxio Runtime object with the given name and namespace

func GetBackupUserDir added in v0.6.0

func GetBackupUserDir(namespace string, name string) string

GetBackupUserDir generate the temp dir of backup user

func GetBoolValueFormEnv added in v0.8.0

func GetBoolValueFormEnv(key string, defaultValue bool) (value bool)

func GetChartsDirectory

func GetChartsDirectory() string

GetChartsDirectory gets the directory of the charts

func GetDataBackup added in v0.5.0

func GetDataBackup(client client.Client, name, namespace string) (*datav1alpha1.DataBackup, error)

GetDataBackup gets the DataBackup given its name and namespace

func GetDataBackupPodName added in v0.5.0

func GetDataBackupPodName(name string) string

GetDataBackupPodName returns DataBackup pod's name given the DataBackup's name

func GetDataBackupReleaseName added in v0.5.0

func GetDataBackupReleaseName(name string) string

GetDataBackupReleaseName returns DataBackup helm release's name given the DataBackup's name

func GetDataLoad

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

GetDataLoad gets the DataLoad given its name and namespace

func GetDataLoadJob added in v0.4.0

func GetDataLoadJob(client client.Client, name, namespace string) (*batchv1.Job, error)

GetDataLoadJob gets the DataLoad job given its name and namespace

func GetDataLoadJobName added in v0.4.0

func GetDataLoadJobName(releaseName string) string

GetDataLoadJobName returns DataLoad job's name given the DataLoad helm release's name

func GetDataLoadRef added in v0.4.0

func GetDataLoadRef(name, namespace string) string

GetDataLoadRef returns the identity of the DataLoad by combining its namespace and name. The identity is used for identifying current lock holder on the target dataset.

func GetDataLoadReleaseName added in v0.4.0

func GetDataLoadReleaseName(name string) string

GetDataLoadReleaseName returns DataLoad helm release's name given the DataLoad's name

func GetDataMigrate added in v0.9.0

func GetDataMigrate(client client.Client, name, namespace string) (*datav1alpha1.DataMigrate, error)

GetDataMigrate gets the DataMigrate given its name and namespace

func GetDataMigrateJob added in v0.9.0

func GetDataMigrateJob(client client.Client, name, namespace string) (*batchv1.Job, error)

GetDataMigrateJob gets the DataMigrate job given its name and namespace

func GetDataMigrateJobName added in v0.9.0

func GetDataMigrateJobName(releaseName string) string

GetDataMigrateJobName returns DataMigrate job's name given the DataMigrate helm release's name

func GetDataMigrateRef added in v0.9.0

func GetDataMigrateRef(name, namespace string) string

GetDataMigrateRef returns the identity of the DataMigrate by combining its namespace and name. The identity is used for identifying current lock holder on the target dataset.

func GetDataMigrateReleaseName added in v0.9.0

func GetDataMigrateReleaseName(name string) string

GetDataMigrateReleaseName returns DataMigrate helm release's name given the DataMigrate's name

func GetDataset

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

GetDataset gets the dataset. It returns a pointer to the dataset if successful.

func GetDatasetCondition

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

GetDatasetCondition returns dataset condition according to a given dataset condition type. If found, return index of the founded condition in the condition array and the founded condition itself, otherwise return -1 and nil.

func GetDurationValueFromEnv added in v0.8.0

func GetDurationValueFromEnv(key string, defaultValue time.Duration) (value time.Duration)

func GetEFCRuntime added in v0.9.0

func GetEFCRuntime(client client.Client, name, namespace string) (*data.EFCRuntime, error)

GetEFCRuntime gets EFC Runtime object with the given name and namespace

func GetEnvByKey added in v0.6.0

func GetEnvByKey(k string) (string, error)

func GetExclusiveKey added in v0.5.0

func GetExclusiveKey() string

GetExclusiveKey gets exclusive key

func GetExclusiveValue added in v0.5.0

func GetExclusiveValue(namespace, name string) string

GetExclusiveValue gets exclusive value

func GetGooseFSRuntime added in v0.6.0

func GetGooseFSRuntime(client client.Client, name, namespace string) (*data.GooseFSRuntime, error)

GetGooseFSRuntime gets GooseFS Runtime object with the given name and namespace

func GetInitUserEnv added in v0.6.0

func GetInitUserEnv(user *datav1alpha1.User) string

func GetInitUsersArgs added in v0.6.0

func GetInitUsersArgs(user *datav1alpha1.User) []string

func GetIntValueFormEnv added in v0.8.0

func GetIntValueFormEnv(key string) (value int, found bool)

func GetJindoRuntime added in v0.6.0

func GetJindoRuntime(client client.Client, name, namespace string) (*data.JindoRuntime, error)

GetJindoRuntime gets Jindo Runtime object with the given name and namespace

func GetJuiceFSRuntime added in v0.7.0

func GetJuiceFSRuntime(client client.Client, name, namespace string) (*data.JuiceFSRuntime, error)

GetJuiceFSRuntime gets JuiceFS Runtime object with the given name and namespace

func GetMountRoot added in v0.4.0

func GetMountRoot() (string, error)

GetMountRoot gets the value of the env variable named MOUNT_ROOT

func GetObjectMeta added in v0.9.0

func GetObjectMeta(object client.Object) (objectMeta metav1.Object, err error)

func GetOrDefault

func GetOrDefault(str *string, defaultValue string) string

GetOrDefault returns the default value unless there is a specified value.

func GetRpcPortFromMasterContainer added in v0.6.0

func GetRpcPortFromMasterContainer(container *v1.Container) (rpcPort int32)

func GetRuntimeByCategory added in v0.4.0

func GetRuntimeByCategory(runtimes []datav1alpha1.Runtime, category common.Category) (index int, runtime *datav1alpha1.Runtime)

func GetRuntimeCondition

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

GetRuntimeCondition gets a runtime condition given a runtime condition type. If found, return index of the founded condition in the condition array and the founded condition itself, otherwise return -1 and nil.

func GetRuntimeNameFromFusePod added in v0.7.0

func GetRuntimeNameFromFusePod(pod corev1.Pod) (runtimeName string, err error)

func GetStringValueFromEnv added in v0.8.0

func GetStringValueFromEnv(key string, defaultValue string) (value string)

func GetTargetDatasetOfMigrate added in v0.9.0

func GetTargetDatasetOfMigrate(client client.Client, dataMigrate datav1alpha1.DataMigrate) (targetDataset *datav1alpha1.Dataset, err error)

func GetThinRuntime added in v0.9.0

func GetThinRuntime(client client.Client, name, namespace string) (*data.ThinRuntime, error)

func GetThinRuntimeProfile added in v0.9.0

func GetThinRuntimeProfile(client client.Client, name string) (*data.ThinRuntimeProfile, error)

func HasDeletionTimestamp

func HasDeletionTimestamp(obj metav1.ObjectMeta) bool

HasDeletionTimestamp method that makes logic easier to read.

func Home

func Home() (string, error)

Home returns the home directory for the executing user. This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected.

func IgnoreAlreadyExists added in v0.8.0

func IgnoreAlreadyExists(err error) error

IgnoreAlreadyExists ignores already existes error

func IgnoreNoKindMatchError added in v0.9.0

func IgnoreNoKindMatchError(err error) error

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound ignores not found

func InjectCacheDirEnabled added in v0.7.0

func InjectCacheDirEnabled(infos map[string]string) (match bool)

func InjectMountPropagation added in v0.7.0

func InjectMountPropagation(datasetNames []string, pod *corev1.Pod)

func InjectNodeSelectorTerms added in v0.6.0

func InjectNodeSelectorTerms(requiredSchedulingTerms []corev1.NodeSelectorTerm, pod *corev1.Pod)

InjectRequiredSchedulingTerms inject the NodeSelectorTerms into a pod

func InjectPreferredSchedulingTerms added in v0.6.0

func InjectPreferredSchedulingTerms(preferredSchedulingTerms []corev1.PreferredSchedulingTerm, pod *corev1.Pod)

InjectPreferredSchedulingTerms inject the preferredSchedulingTerms into a pod

func InjectSidecarDone added in v0.7.0

func InjectSidecarDone(infos map[string]string) (match bool)

func IsDatasetConditionExist

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

IsDatasetConditionExist checks if the given dataset condition exists in the given dataset condition array.

func IsFusePod added in v0.7.0

func IsFusePod(pod corev1.Pod) bool

func IsMounted added in v0.7.0

func IsMounted(absPath string) (bool, error)

func IsPodManagedByFluid added in v0.9.0

func IsPodManagedByFluid(pod *corev1.Pod) bool

IsPodManagedByFluid checks if the given Pod is managed by Fluid.

func IsSetupDone added in v0.4.0

func IsSetupDone(dataset *datav1alpha1.Dataset) (done bool)

checks the setup is done

func IsSubPath added in v0.6.0

func IsSubPath(path, subPath string) bool

determine if subPath is a subdirectory of path

func IsTargetPathUnderFluidNativeMounts added in v0.6.0

func IsTargetPathUnderFluidNativeMounts(targetPath string, dataset datav1alpha1.Dataset) bool

IsTargetPathUnderFluidNativeMounts checks if targetPath is a subpath under some given native mount point. We check this for the reason that native mount points need extra metadata sync alluxioOperations.

func IsTimeTrackerDebugEnabled added in v0.8.0

func IsTimeTrackerDebugEnabled() bool

func IsTimeTrackerEnabled added in v0.8.0

func IsTimeTrackerEnabled() bool

func LoggingErrorExceptConflict added in v0.7.0

func LoggingErrorExceptConflict(logging logr.Logger, err error, info string, namespacedKey types.NamespacedName) (result error)

LoggingErrorExceptConflict logs error except for updating operation violates with etcd concurrency control

func NewDatasetCondition

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

NewDatasetCondition creates a new Cache condition.

func NewPprofServer added in v0.7.0

func NewPprofServer(setupLog logr.Logger, pprofAddr string, enableFullGoProfile bool)

func NewRuntime

func NewRuntime(name, namespace string, category common.Category, runtimeType string, replicas int32) 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)

NoRequeue returns the result of a reconcile invocation and no err The Object will not requeue

func Now

func Now() *metav1.Time

Now returns the current time

func ParseBackupRestorePath added in v0.5.0

func ParseBackupRestorePath(backupRestorePath string) (pvcName string, path string, err error)

ParseBackupRestorePath parse the BackupPath in spec of DataBackup or the RestorePath in spec of Dataset

func PatchLabels added in v0.9.0

func PatchLabels(cli client.Client, obj client.Object, labelsToModify common.LabelsToModify) (modifiedLabels []string, err error)

func PathExists

func PathExists(path string) bool

PathExists returns the specified path is exists or not

func RandomAlphaNumberString

func RandomAlphaNumberString(l int32) string

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

func RandomReplacePrefix added in v0.7.0

func RandomReplacePrefix(input string, l int) (output string)

func RandomString

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

RandomString returns a string of length l which is made up of runes randomly selected from `source`.

func RemoveDuplicateStr added in v0.7.0

func RemoveDuplicateStr(strSlice []string) []string

RemoveDuplicateStr removes duplicate string

func RemoveString

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

RemoveString removes strings in a array, which is equal to a given string.

func ReplacePrefix added in v0.7.0

func ReplacePrefix(input, suffix string) (output string)

ReplacePrefix replaces the input with suffix string

func RequeueAfterInterval

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

RequeueAfterInterval returns the result of a reconcile invocation with a given requeue interval and no err The Object will requeue after the given requeue interval

func RequeueIfError

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

RequeueIfError returns the result of a reconciler invocation and the err The Object will requeue when err is not nil

func RequeueImmediately

func RequeueImmediately() (ctrl.Result, error)

RequeueImmediately returns the result of a reconciler invocation and no err The Object will requeue immediately whether the err is nil or not

func RequeueImmediatelyUnlessGenerationChanged

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

RequeueImmediatelyUnlessGenerationChanged 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 ResourceRequirementsEqual added in v0.8.0

func ResourceRequirementsEqual(source corev1.ResourceRequirements,
	target corev1.ResourceRequirements) bool

func ServerfulFuseEnabled added in v0.9.0

func ServerfulFuseEnabled(infos map[string]string) (match bool)

func ServerlessEnabled added in v0.7.0

func ServerlessEnabled(infos map[string]string) (match bool)

func ServerlessPlatformMatched added in v0.8.0

func ServerlessPlatformMatched(infos map[string]string) (match bool)

func SortIpAddresses added in v0.9.0

func SortIpAddresses(ips []string) (orderedIps []string)

func SplitSchemaAddr

func SplitSchemaAddr(addr string) (string, string)

SplitSchemaAddr splits the address string into 2 parts: proto and addr. Proto is set to "tcp" in default. It returns proto and addr separately.

func SubtractString added in v0.6.0

func SubtractString(x []string, y []string) []string

SubtractString returns the subtraction between two string slice

func TimeTrack added in v0.6.0

func TimeTrack(start time.Time, processName string, keysAndValues ...interface{})

TimeTrack tracks the time cost for some process with some optional information. For example, to track the processing time of a function, just add the following code at the beginning of your function:

defer utils.TimeTrack(time.Now(), <func-name>, <keysAndValues>...)

func ToYaml

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

ToYaml converts values from json format to yaml format and stores the values to the file. It will return err when failed to marshal value or write file.

func TranformQuantityToUnits added in v0.5.0

func TranformQuantityToUnits(q *resource.Quantity) (value string)

TransformQuantityToUnits returns a human-readable size in bytes, kibibytes, mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB").

func TransformEFCUnitToQuantity added in v0.9.0

func TransformEFCUnitToQuantity(value string) (q *resource.Quantity)

func TransformQuantityToAlluxioUnit added in v0.6.0

func TransformQuantityToAlluxioUnit(q *resource.Quantity) (value string)

TransformQuantityToAlluxioUnit transform a given input quantity to another one that can be recognized by Alluxio. This is necessary because Alluxio takes decimal byte units(e.g. KB, MB, GB, etc.) as binary byte units(e.g. Ki, Mi, Gi)

func TransformQuantityToEFCUnit added in v0.9.0

func TransformQuantityToEFCUnit(q *resource.Quantity) (value string)

TransformQuantityToEFCUnit transform a given input quantity to another one that can be recognized by EFC. This is necessary because EFC takes decimal byte units(e.g. KB, MB, GB, etc.) as binary byte units(e.g. Ki, Mi, Gi)

func TransformQuantityToGooseFSUnit added in v0.6.0

func TransformQuantityToGooseFSUnit(q *resource.Quantity) (value string)

TransformQuantityToGooseFSUnit transform a given input quantity to another one that can be recognized by GooseFS. This is necessary because GooseFS takes decimal byte units(e.g. KB, MB, GB, etc.) as binary byte units(e.g. Ki, Mi, Gi)

func TransformQuantityToJindoUnit added in v0.6.0

func TransformQuantityToJindoUnit(q *resource.Quantity) (value string)

TransfromQuantityToJindoUnit transform a given input quantity to another one that can be recognized by Jindo.

func TransformRequirementsToResources

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

func TrimCapabilities added in v0.8.0

func TrimCapabilities(inputs []corev1.Capability, excludeNames []string) (outputs []corev1.Capability)

func TrimVolumeMounts added in v0.7.0

func TrimVolumeMounts(inputs []corev1.VolumeMount, excludeNames []string) (outputs []corev1.VolumeMount)

func TrimVolumes added in v0.7.0

func TrimVolumes(inputs []corev1.Volume, excludeNames []string) (outputs []corev1.Volume)

TrimVolumes trims the volumes

func UnionMapsWithOverride added in v0.8.0

func UnionMapsWithOverride(map1 map[string]string, map2 map[string]string) map[string]string

UnionMapsWithOverride unions two maps into one. If either of the maps is empty, return the other one. If both maps share the same key, the value in map2 overrides the corresponding value in map1.

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 UpdateMountStatus added in v0.6.0

func UpdateMountStatus(client client.Client, name string, namespace string, phase datav1alpha1.DatasetPhase) error

UpdateMountStatus updates the mount status of the dataset according to the given phase

func UpdateRuntimeCondition

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

UpdateRuntimeCondition updates the runtime 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 WorkerSidecarEnabled added in v0.7.0

func WorkerSidecarEnabled(infos map[string]string) (match bool)

Types

type UFSPathBuilder added in v0.6.0

type UFSPathBuilder struct{}

func (UFSPathBuilder) GenAlluxioMountPath added in v0.6.0

func (u UFSPathBuilder) GenAlluxioMountPath(curMount datav1alpha1.Mount, mounts []datav1alpha1.Mount) string

dataset.spec.mounts mount to alluxio instance strategy:

strategy && priority: 1. if set dataset.spec.mounts[x].path 2. if only one item use default root path "/" 3. "/" + dataset.spec.mounts[x].name

func (UFSPathBuilder) GenAlluxioUFSRootPath added in v0.6.0

func (u UFSPathBuilder) GenAlluxioUFSRootPath(items []datav1alpha1.Mount) (string, *datav1alpha1.Mount)

value for alluxio instance configuration :

alluxio.master.mount.table.root.ufs

two situations

  1. mount local storage root path as alluxio root path e.g. : alluxio fs mount /underFSStorage /
  2. direct mount ufs endpoint as alluxio root path e.g. : alluxio fs mount http://fluid.io/apache/spark/spark-3.0.2 /

func (UFSPathBuilder) GenLocalStoragePath added in v0.6.0

func (u UFSPathBuilder) GenLocalStoragePath(curMount datav1alpha1.Mount) string

generate local storage path by mount info

func (UFSPathBuilder) GetLocalStorageRootDir added in v0.6.0

func (u UFSPathBuilder) GetLocalStorageRootDir() string

this value will be the default value for the alluxio configuration:

alluxio.master.mount.table.root.ufs

e.g. :

$ alluxio fs mount
/underFSStorage  on  /  (local, capacity=0B, used=-1B, not read-only, not shared, properties={})

type UFSToUpdate added in v0.6.0

type UFSToUpdate struct {
	// contains filtered or unexported fields
}

UFSToUpdate records the mountPath to change in virtual file system of dataset

func NewUFSToUpdate added in v0.6.0

func NewUFSToUpdate(ds *datav1alpha1.Dataset) *UFSToUpdate

NewUFSToUpdate get UFSToUpdate according the given dataset

func (*UFSToUpdate) AddMountPaths added in v0.7.0

func (u *UFSToUpdate) AddMountPaths(mountPaths []string)

AddMountPaths add mounted path to ToAdd

func (*UFSToUpdate) AnalyzePathsDelta added in v0.6.0

func (u *UFSToUpdate) AnalyzePathsDelta() (specMountPaths, mountedMountPaths []string)

AnalyzePathsDelta analyze the ToAdd and ToRemove from the spec and mounted mountPaths of dataset No need for a mount point with Fluid native scheme('local://' and 'pvc://') to be mounted

func (*UFSToUpdate) ShouldUpdate added in v0.6.0

func (u *UFSToUpdate) ShouldUpdate() bool

ShouldUpdate check if needs to update the mount points according to ToAdd and ToRemove

func (*UFSToUpdate) ToAdd added in v0.6.0

func (u *UFSToUpdate) ToAdd() []string

ToAdd get the mountPaths to add into virtual file system of dataset

func (*UFSToUpdate) ToRemove added in v0.6.0

func (u *UFSToUpdate) ToRemove() []string

ToRemove get the mountPaths to remove from virtual file system of dataset

Directories

Path Synopsis
applications
pod
dataset
runtimes
webhook

Jump to

Keyboard shortcuts

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