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
- Variables
- func AddRuntimesIfNotExist(runtimes []datav1alpha1.Runtime, newRuntime datav1alpha1.Runtime) (updatedRuntimes []datav1alpha1.Runtime)
- func AppContainerPostStartInjectEnabled(infos map[string]string) (match bool)
- func AppControllerDisabled(info map[string]string) (match bool)
- func AppendOrOverrideVolume(volumes []corev1.Volume, vol corev1.Volume) []corev1.Volume
- func AppendOrOverrideVolumeMounts(volumeMounts []corev1.VolumeMount, vm corev1.VolumeMount) []corev1.VolumeMount
- func BytesSize(size float64) string
- func CalculateDuration(creationTime time.Time, finishTime time.Time) string
- func ChangeNodeLabelWithPatchMode(cli client.Client, node *v1.Node, labelsToModify common.LabelsToModify) (modifiedLabels []string, err error)
- func ChangeNodeLabelWithUpdateMode(client client.Client, node *v1.Node, labelsToModify common.LabelsToModify) (modifiedLabels []string, err error)
- func CheckMountPointBroken(mountPath string) (broken bool, err error)
- func CheckMountReadyAndSubPathExist(fluidPath string, mountType string, subPath string) (err error)
- func CheckObject(client client.Client, key types.NamespacedName, obj client.Object) (found bool, err error)
- func CheckValidateEnvName(key string) (err error)
- func ContainsAll(m map[string]string, slice []string) bool
- func ContainsOwners(owners []metav1.OwnerReference, dataset *datav1alpha1.Dataset) bool
- func ContainsSelector(labels map[string]string, selector map[string]string) bool
- func ContainsString(slice []string, s string) bool
- func ContainsSubString(slice []string, s string) bool
- func ConvertDashToUnderscore(s string) string
- func CreateRuntimeForReferenceDatasetIfNotExist(client client.Client, dataset *datav1alpha1.Dataset) (err error)
- func CreateSymlink(targetPath, mountPath string) error
- func DumpJSON(o interface{}) string
- func FillSliceWithString(str string, num int) *[]string
- func FilterVolumesByVolumeMounts(volumes []corev1.Volume, volumeMounts []corev1.VolumeMount) []corev1.Volume
- func FindVolumeByVolumeMount(volumeMount corev1.VolumeMount, volumes []corev1.Volume) *corev1.Volume
- func FromHumanSize(size string) (int64, error)
- func FromRawToObject(raw []byte) (obj runtime.Object, err error)
- func FuseSidecarPrivileged(infos map[string]string) (match bool)
- func FuseSidecarUnprivileged(infos map[string]string) (match bool)
- func GetAccessModesOfDataset(client client.Client, name, namespace string) (accessModes []corev1.PersistentVolumeAccessMode, err error)
- func GetAddressOfMaster(pod *v1.Pod) (nodeName string, ip string, rpcPort int32)
- func GetAlluxioRuntime(client client.Client, name, namespace string) (*datav1alpha1.AlluxioRuntime, error)
- func GetBackupUserDir(namespace string, name string) string
- func GetBoolValueFromEnv(key string, defaultValue bool) (value bool)
- func GetChartsDirectory() string
- func GetCommonLabelName(isDeprecated bool, namespace string, name string) string
- func GetDataBackup(client client.Client, name, namespace string) (*datav1alpha1.DataBackup, error)
- func GetDataBackupPodName(name string) string
- func GetDataBackupReleaseName(name string) string
- func GetDataLoad(client client.Client, name, namespace string) (*datav1alpha1.DataLoad, error)
- func GetDataLoadJobName(releaseName string) string
- func GetDataLoadReleaseName(name string) string
- func GetDataMigrate(client client.Client, name, namespace string) (*datav1alpha1.DataMigrate, error)
- func GetDataMigrateJobName(releaseName string) string
- func GetDataMigrateReleaseName(name string) string
- func GetDataProcess(client client.Client, name, namespace string) (*datav1alpha1.DataProcess, error)
- func GetDataProcessJobName(releaseName string) string
- func GetDataProcessReleaseName(name string) string
- func GetDataset(client client.Client, name, namespace string) (*datav1alpha1.Dataset, error)
- func GetDatasetCondition(conditions []datav1alpha1.DatasetCondition, ...) (index int, condition *datav1alpha1.DatasetCondition)
- func GetDurationValueFromEnv(key string, defaultValue time.Duration) (value time.Duration)
- func GetEFCRuntime(client client.Client, name, namespace string) (*datav1alpha1.EFCRuntime, error)
- func GetEnvByKey(k string) (string, error)
- func GetExclusiveKey() string
- func GetExclusiveValue(namespace, name string) string
- func GetGooseFSRuntime(client client.Client, name, namespace string) (*datav1alpha1.GooseFSRuntime, error)
- func GetInitUserEnv(user *datav1alpha1.User) string
- func GetInitUsersArgs(user *datav1alpha1.User) []string
- func GetIntValueFromEnv(key string) (value int, found bool)
- func GetJindoRuntime(client client.Client, name, namespace string) (*datav1alpha1.JindoRuntime, error)
- func GetJuiceFSRuntime(client client.Client, name, namespace string) (*datav1alpha1.JuiceFSRuntime, error)
- func GetLabelNameForDisk(isDeprecated bool, runtimeType string, namespace string, name string) string
- func GetLabelNameForMemory(isDeprecated bool, runtimeType string, namespace string, name string) string
- func GetLabelNameForTotal(isDeprecated bool, runtimeType string, namespace string, name string) string
- func GetMountRoot() (string, error)
- func GetObjectMeta(object client.Object) (objectMeta metav1.Object, err error)
- func GetOperationStatus(obj client.Object) (*datav1alpha1.OperationStatus, error)
- func GetOrDefault(str *string, defaultValue string) string
- func GetPVCStorageCapacityOfDataset(client client.Client, name, namespace string) (storageCapacity resource.Quantity, err error)
- func GetParallelOperationWorkersName(releaseName string) string
- func GetPrecedingOperationStatus(client client.Client, opRef *datav1alpha1.OperationRef, opRefNamespace string) (*datav1alpha1.OperationStatus, error)
- func GetRpcPortFromMasterContainer(container *v1.Container) (rpcPort int32)
- func GetRuntimeByCategory(runtimes []datav1alpha1.Runtime, category common.Category) (index int, runtime *datav1alpha1.Runtime)
- func GetRuntimeCondition(conditions []data.RuntimeCondition, condType data.RuntimeConditionType) (index int, condition *data.RuntimeCondition)
- func GetRuntimeLabelName(isDeprecated bool, runtimeType string, namespace string, name string) string
- func GetRuntimeNameFromFusePod(pod corev1.Pod) (runtimeName string, err error)
- func GetServerlessPlatfrom(infos map[string]string) (platform string)
- func GetStoragetLabelName(read common.ReadType, storage common.StorageType, isDeprecated bool, ...) string
- func GetStringValueFromEnv(key string, defaultValue string) (value string)
- func GetTargetDatasetOfMigrate(client client.Client, dataMigrate *datav1alpha1.DataMigrate) (targetDataset *datav1alpha1.Dataset, err error)
- func GetThinRuntime(client client.Client, name, namespace string) (*datav1alpha1.ThinRuntime, error)
- func GetThinRuntimeProfile(client client.Client, name string) (*datav1alpha1.ThinRuntimeProfile, error)
- func GetVineyardRuntime(client client.Client, name, namespace string) (*datav1alpha1.VineyardRuntime, error)
- func HasDeletionTimestamp(obj metav1.ObjectMeta) bool
- func Home() (string, error)
- func IgnoreAlreadyExists(err error) error
- func IgnoreNoKindMatchError(err error) error
- func IgnoreNotFound(err error) error
- func InjectCacheDirEnabled(infos map[string]string) (match bool)
- func InjectMountPropagation(datasetNames []string, pod *corev1.Pod)
- func InjectNodeSelectorRequirements(matchExpressions []v1.NodeSelectorRequirement, affinity *v1.Affinity) *v1.Affinity
- func InjectNodeSelectorTerms(requiredSchedulingTerms []corev1.NodeSelectorTerm, pod *corev1.Pod)
- func InjectPreferredSchedulingTerms(preferredSchedulingTerms []corev1.PreferredSchedulingTerm, pod *corev1.Pod)
- func InjectPreferredSchedulingTermsToAffinity(terms []v1.PreferredSchedulingTerm, affinity *v1.Affinity) *v1.Affinity
- func InjectSidecarDone(infos map[string]string) (match bool)
- func IntersectIntegerSets(map1 map[int]bool, map2 map[int]bool) map[int]bool
- func IsDatasetConditionExist(conditions []datav1alpha1.DatasetCondition, cond datav1alpha1.DatasetCondition) (found bool)
- func IsFusePod(pod corev1.Pod) bool
- func IsMounted(absPath string) (bool, error)
- func IsPodManagedByFluid(pod *corev1.Pod) bool
- func IsSetupDone(dataset *datav1alpha1.Dataset) (done bool)
- func IsSubPath(path, subPath string) bool
- func IsTargetPathUnderFluidNativeMounts(targetPath string, dataset datav1alpha1.Dataset) bool
- func IsTimeTrackerDebugEnabled() bool
- func IsTimeTrackerEnabled() bool
- func ListDataOperationJobByCronjob(c client.Client, cronjobNamespacedName types.NamespacedName) ([]batchv1.Job, error)
- func LoggingErrorExceptConflict(logging logr.Logger, err error, info string, ...) (result error)
- func NeedCleanUp(opStatus *datav1alpha1.OperationStatus, ...) bool
- func NewDatasetCondition(conditionType datav1alpha1.DatasetConditionType, reason, message string, ...) datav1alpha1.DatasetCondition
- func NewPprofServer(setupLog logr.Logger, pprofAddr string, enableFullGoProfile bool)
- func NewRuntime(name, namespace string, category common.Category, runtimeType string, ...) datav1alpha1.Runtime
- func NewRuntimeCondition(conditionType data.RuntimeConditionType, reason, message string, ...) data.RuntimeCondition
- func NoRequeue() (ctrl.Result, error)
- func Now() *metav1.Time
- func ParseBackupRestorePath(backupRestorePath string) (pvcName string, path string, err error)
- func PatchLabels(cli client.Client, obj client.Object, labelsToModify common.LabelsToModify) (modifiedLabels []string, err error)
- func PathExists(path string) bool
- func RandomAlphaNumberString(l int32) string
- func RandomReplacePrefix(input string, l int) (output string)
- func RandomString(source []rune, l int32) string
- func RemoveDuplicateStr(strSlice []string) []string
- func RemoveNotFoundDatasetRef(client client.Client, dataset datav1alpha1.Dataset, log logr.Logger) ([]string, error)
- func RemoveString(slice []string, s string) (result []string)
- func RemoveSymlink(targetPath string) (bool, error)
- func ReplacePrefix(input, suffix string) (output string)
- func RequeueAfterInterval(interval time.Duration) (ctrl.Result, error)
- func RequeueIfError(err error) (ctrl.Result, error)
- func RequeueImmediately() (ctrl.Result, error)
- func RequeueImmediatelyUnlessGenerationChanged(prevGeneration, curGeneration int64) (ctrl.Result, error)
- func ResourceRequirementsEqual(source corev1.ResourceRequirements, target corev1.ResourceRequirements) bool
- func ServerfulFuseEnabled(infos map[string]string) (match bool)
- func ServerlessEnabled(infos map[string]string) (match bool)
- func SetValueIfKeyAbsent(m map[string]string, key string, value string)
- func SkipSidecarPostStartInject(infos map[string]string) (match bool)
- func SortIpAddresses(ips []string) (orderedIps []string)
- func SplitSchemaAddr(addr string) (string, string)
- func SubtractString(x []string, y []string) []string
- func TimeTrack(start time.Time, processName string, keysAndValues ...interface{})
- func Timeleft(opStatus *datav1alpha1.OperationStatus, ...) (*time.Duration, error)
- func ToYaml(values interface{}, file *os.File) error
- func TranformQuantityToUnits(q *resource.Quantity) (value string)
- func TransformEFCUnitToQuantity(value string) (q *resource.Quantity)
- func TransformQuantityToAlluxioUnit(q *resource.Quantity) (value string)
- func TransformQuantityToEFCUnit(q *resource.Quantity) (value string)
- func TransformQuantityToGooseFSUnit(q *resource.Quantity) (value string)
- func TransformQuantityToJindoUnit(q *resource.Quantity) (value string)
- func TransformRequirementsToResources(res corev1.ResourceRequirements) (cRes common.Resources)
- func TrimCapabilities(inputs []corev1.Capability, excludeNames []string) (outputs []corev1.Capability)
- func TrimVolumeMounts(inputs []corev1.VolumeMount, excludeNames []string) (outputs []corev1.VolumeMount)
- func TrimVolumes(inputs []corev1.Volume, excludeNames []string) (outputs []corev1.Volume)
- func UnionMapsWithOverride(map1 map[string]string, map2 map[string]string) map[string]string
- func UpdateDatasetCondition(conditions []datav1alpha1.DatasetCondition, ...) []datav1alpha1.DatasetCondition
- func UpdateMountStatus(client client.Client, name string, namespace string, ...) error
- func UpdateRuntimeCondition(conditions []data.RuntimeCondition, condition data.RuntimeCondition) []data.RuntimeCondition
- type UFSPathBuilder
- func (u UFSPathBuilder) GenAlluxioUFSRootPath(items []datav1alpha1.Mount) (string, *datav1alpha1.Mount)
- func (u UFSPathBuilder) GenLocalStoragePath(curMount datav1alpha1.Mount) string
- func (u UFSPathBuilder) GenUFSPathInUnifiedNamespace(mount datav1alpha1.Mount) string
- func (u UFSPathBuilder) GetLocalStorageRootDir() string
- type UFSToUpdate
- type VolumeLocks
Constants ¶
const ( PlatformDefault = "Default" PlatformUnprivileged = "Unprivileged" )
---- Utils functions to decide serverless platform ----
const ( KiB = 1024 MiB = 1024 * KiB GiB = 1024 * MiB TiB = 1024 * GiB PiB = 1024 * TiB EiB = 1024 * PiB )
const ( PVCStorageAnnotation = "pvc.fluid.io/resources.requests.storage" DefaultStorageCapacity = "100Pi" )
const MountRoot string = "MOUNT_ROOT"
Variables ¶
var ( ServerlessPlatformKey string = "" ServerlessPlatformVal string = "" )
Functions ¶
func AddRuntimesIfNotExist ¶
func AddRuntimesIfNotExist(runtimes []datav1alpha1.Runtime, newRuntime datav1alpha1.Runtime) (updatedRuntimes []datav1alpha1.Runtime)
AddRuntimesIfNotExist adds newRuntime to runtimes and return the updated runtime slice
func AppContainerPostStartInjectEnabled ¶ added in v0.8.0
func AppControllerDisabled ¶ added in v0.8.0
func AppendOrOverrideVolume ¶ added in v0.9.0
func AppendOrOverrideVolumeMounts ¶ added in v0.9.0
func AppendOrOverrideVolumeMounts(volumeMounts []corev1.VolumeMount, vm corev1.VolumeMount) []corev1.VolumeMount
func BytesSize ¶ added in v0.4.0
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
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 CheckMountReadyAndSubPathExist ¶ added in v0.9.0
func CheckObject ¶ added in v0.8.0
func CheckValidateEnvName ¶ added in v1.0.0
func ContainsAll ¶ added in v0.6.0
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
ContainsSelector Determine whether the labels contain the selector
func ContainsString ¶
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
ContainsSubString Determine whether the string array contains a sub string return true if contains the string and return false if not.
func ConvertDashToUnderscore ¶ added in v1.0.0
ConvertDashToUnderscore converts all dash "-" characters in a string to underscore "_" characters.
func CreateRuntimeForReferenceDatasetIfNotExist ¶ added in v0.9.0
func CreateRuntimeForReferenceDatasetIfNotExist(client client.Client, dataset *datav1alpha1.Dataset) (err error)
CreateRuntimeForReferenceDatasetIfNotExist creates runtime for ReferenceDataset
func CreateSymlink ¶ added in v1.0.0
func DumpJSON ¶ added in v0.8.0
func DumpJSON(o interface{}) string
DumpJSON returns the JSON encoding
func FillSliceWithString ¶ added in v0.5.0
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 FromHumanSize ¶ added in v0.4.0
FromHumanSize returns an integer from a human-readable specification of a size with 1024 as multiplier e.g.:
- 1 KiB = 1024 byte
func FromRawToObject ¶ added in v0.7.0
FromRawToObject is used to convert from raw to the runtime object
func FuseSidecarPrivileged ¶ added in v1.0.1
FuseSidecarPrivileged decides if the injected fuse sidecar should be privileged, only used when fuse sidecar should be injected - sidecar is privileged only when setting serverless.fluid.io/inject=true without unprivileged.sidecar.fluid.io/inject=true
func FuseSidecarUnprivileged ¶ added in v0.8.0
FuseSidecarUnprivileged decides if the injected fuse sidecar should be unprivileged, only used when fuse sidecar should be injected - serverlessPlatform implies injecting unprivileged fuse sidecar - serverless.fluid.io/inject=true + unprivileged.sidecar.fluid.io/inject=true implies injecting unprivileged fuse sidecar,
func GetAccessModesOfDataset ¶ added in v0.5.0
func GetAddressOfMaster ¶ added in v0.5.0
GetAddressOfMaster return the ip and port of engine master
func GetAlluxioRuntime ¶
func GetAlluxioRuntime(client client.Client, name, namespace string) (*datav1alpha1.AlluxioRuntime, error)
GetAlluxioRuntime gets Alluxio Runtime object with the given name and namespace
func GetBackupUserDir ¶ added in v0.6.0
GetBackupUserDir generate the temp dir of backup user
func GetBoolValueFromEnv ¶ added in v0.9.2
func GetChartsDirectory ¶
func GetChartsDirectory() string
GetChartsDirectory gets the directory of the charts
func GetCommonLabelName ¶ added in v1.0.2
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
GetDataBackupPodName returns DataBackup pod's name given the DataBackup's name
func GetDataBackupReleaseName ¶ added in v0.5.0
GetDataBackupReleaseName returns DataBackup helm release's name given the DataBackup's name
func GetDataLoad ¶
GetDataLoad gets the DataLoad given its name and namespace
func GetDataLoadJobName ¶ added in v0.4.0
GetDataLoadJobName returns DataLoad job's name given the DataLoad helm release's name
func GetDataLoadReleaseName ¶ added in v0.4.0
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 GetDataMigrateJobName ¶ added in v0.9.0
GetDataMigrateJobName returns DataMigrate job(or cronjob)'s name given the DataMigrate helm release's name
func GetDataMigrateReleaseName ¶ added in v0.9.0
GetDataMigrateReleaseName returns DataMigrate helm release's name given the DataMigrate's name
func GetDataProcess ¶ added in v1.0.0
func GetDataProcess(client client.Client, name, namespace string) (*datav1alpha1.DataProcess, error)
func GetDataProcessJobName ¶ added in v1.0.0
func GetDataProcessReleaseName ¶ added in v1.0.0
GetDataProcessReleaseName returns the helm release name given the DataProcess's name.
func GetDataset ¶
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 GetEFCRuntime ¶ added in v0.9.0
func GetEFCRuntime(client client.Client, name, namespace string) (*datav1alpha1.EFCRuntime, error)
GetEFCRuntime gets EFC Runtime object with the given name and namespace
func GetEnvByKey ¶ added in v0.6.0
func GetExclusiveKey ¶ added in v0.5.0
func GetExclusiveKey() string
GetExclusiveKey gets exclusive key
func GetExclusiveValue ¶ added in v0.5.0
GetExclusiveValue gets exclusive value
func GetGooseFSRuntime ¶ added in v0.6.0
func GetGooseFSRuntime(client client.Client, name, namespace string) (*datav1alpha1.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 GetIntValueFromEnv ¶ added in v0.9.2
func GetJindoRuntime ¶ added in v0.6.0
func GetJindoRuntime(client client.Client, name, namespace string) (*datav1alpha1.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) (*datav1alpha1.JuiceFSRuntime, error)
GetJuiceFSRuntime gets JuiceFS Runtime object with the given name and namespace
func GetLabelNameForDisk ¶ added in v1.0.2
func GetLabelNameForMemory ¶ added in v1.0.2
func GetLabelNameForTotal ¶ added in v1.0.2
func GetMountRoot ¶ added in v0.4.0
GetMountRoot gets the value of the env variable named MOUNT_ROOT
func GetObjectMeta ¶ added in v0.9.0
func GetOperationStatus ¶ added in v1.0.0
func GetOperationStatus(obj client.Object) (*datav1alpha1.OperationStatus, error)
func GetOrDefault ¶
GetOrDefault returns the default value unless there is a specified value.
func GetPVCStorageCapacityOfDataset ¶ added in v1.0.1
func GetParallelOperationWorkersName ¶ added in v1.0.0
GetParallelOperationWorkersName Get the workers statefulset name according the helm release name
func GetPrecedingOperationStatus ¶ added in v1.0.0
func GetPrecedingOperationStatus(client client.Client, opRef *datav1alpha1.OperationRef, opRefNamespace string) (*datav1alpha1.OperationStatus, error)
func GetRpcPortFromMasterContainer ¶ added in v0.6.0
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 GetRuntimeLabelName ¶ added in v1.0.2
func GetRuntimeNameFromFusePod ¶ added in v0.7.0
func GetServerlessPlatfrom ¶ added in v1.0.0
func GetStoragetLabelName ¶ added in v1.0.2
func GetStringValueFromEnv ¶ added in v0.8.0
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) (*datav1alpha1.ThinRuntime, error)
func GetThinRuntimeProfile ¶ added in v0.9.0
func GetThinRuntimeProfile(client client.Client, name string) (*datav1alpha1.ThinRuntimeProfile, error)
func GetVineyardRuntime ¶ added in v1.0.0
func GetVineyardRuntime(client client.Client, name, namespace string) (*datav1alpha1.VineyardRuntime, error)
GetVineyardRuntime gets Vineyard Runtime object with the given name and namespace
func HasDeletionTimestamp ¶
func HasDeletionTimestamp(obj metav1.ObjectMeta) bool
HasDeletionTimestamp method that makes logic easier to read.
func Home ¶
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
IgnoreAlreadyExists ignores already existes error
func IgnoreNoKindMatchError ¶ added in v0.9.0
func InjectCacheDirEnabled ¶ added in v0.7.0
func InjectMountPropagation ¶ added in v0.7.0
func InjectNodeSelectorRequirements ¶ added in v1.0.1
func InjectNodeSelectorRequirements(matchExpressions []v1.NodeSelectorRequirement, affinity *v1.Affinity) *v1.Affinity
InjectNodeSelectorRequirements injects(not append) a node selector term to affinity‘s nodeAffinity.
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 InjectPreferredSchedulingTermsToAffinity ¶ added in v1.0.1
func InjectSidecarDone ¶ added in v0.7.0
func IntersectIntegerSets ¶ added in v1.0.0
IntersectIntegerSets returns the intersection of integer set 1 and set 2.
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 IsPodManagedByFluid ¶ added in v0.9.0
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 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 ListDataOperationJobByCronjob ¶ added in v1.0.0
func ListDataOperationJobByCronjob(c client.Client, cronjobNamespacedName types.NamespacedName) ([]batchv1.Job, error)
ListDataOperationJobByCronjob gets the DataOperation(i.e. DataMigrate, DataLoad) job by cronjob given its name and namespace
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 NeedCleanUp ¶ added in v1.0.0
func NeedCleanUp(opStatus *datav1alpha1.OperationStatus, operation dataoperation.OperationInterface) bool
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 NewRuntime ¶
func NewRuntime(name, namespace string, category common.Category, runtimeType string, replicas int32) datav1alpha1.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 ¶
NoRequeue returns the result of a reconcile invocation and no err The Object will not requeue
func ParseBackupRestorePath ¶ added in v0.5.0
ParseBackupRestorePath parse the BackupPath in spec of DataBackup or the RestorePath in spec of Dataset
func PatchLabels ¶ added in v0.9.0
func PathExists ¶
PathExists returns the specified path is exists or not
func RandomAlphaNumberString ¶
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 RandomString ¶
RandomString returns a string of length l which is made up of runes randomly selected from `source`.
func RemoveDuplicateStr ¶ added in v0.7.0
RemoveDuplicateStr removes duplicate string
func RemoveNotFoundDatasetRef ¶ added in v1.0.0
func RemoveNotFoundDatasetRef(client client.Client, dataset datav1alpha1.Dataset, log logr.Logger) ([]string, error)
RemoveNotFoundDatasetRef checks datasetRef existence and remove if reference dataset is not found
func RemoveString ¶
RemoveString removes strings in a array, which is equal to a given string.
func RemoveSymlink ¶ added in v1.0.0
func ReplacePrefix ¶ added in v0.7.0
ReplacePrefix replaces the input with suffix string
func RequeueAfterInterval ¶
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 ¶
RequeueIfError returns the result of a reconciler invocation and the err The Object will requeue when err is not nil
func RequeueImmediately ¶
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
ServerfulFuseEnabled decides if FUSE CSI related optimization should be injected, e.g. HostToContainer mountPropagation for FUSE Recovery feature.
func ServerlessEnabled ¶ added in v0.7.0
ServerlessEnabled decides if fuse sidecar should be injected, whether privileged or unprivileged - serverlessPlatform implies injecting unprivileged fuse sidecar - serverless.fluid.io/inject=true implies injecting (privileged/unprivileged) fuse sidecar, - deprecated fuse.sidecar.fluid.io/inject=true is the deprecated version of serverless.fluid.io/inject=true
func SetValueIfKeyAbsent ¶ added in v1.0.1
SetValueIfKeyAbsent sets value when key is not found in the map.
func SkipSidecarPostStartInject ¶ added in v1.0.0
func SortIpAddresses ¶ added in v0.9.0
func SplitSchemaAddr ¶
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
SubtractString returns the subtraction between two string slice
func TimeTrack ¶ added in v0.6.0
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 Timeleft ¶ added in v1.0.0
func Timeleft(opStatus *datav1alpha1.OperationStatus, operation dataoperation.OperationInterface) (*time.Duration, error)
Timeleft return not nil remaining time if data operation has completion time and set ttlAfterFinished
func ToYaml ¶
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
TransformQuantityToUnits returns a human-readable size in bytes, kibibytes, mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB").
func TransformEFCUnitToQuantity ¶ added in v0.9.0
func TransformQuantityToAlluxioUnit ¶ added in v0.6.0
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
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
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
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
TrimVolumes trims the volumes
func UnionMapsWithOverride ¶ added in v0.8.0
UnionMapsWithOverride unions two maps into one. If both maps are empty or nil, return an empty map. If both maps share the same key, the value in map2 overrides the 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.
Types ¶
type UFSPathBuilder ¶ added in v0.6.0
type UFSPathBuilder struct{}
func (UFSPathBuilder) GenAlluxioUFSRootPath ¶ added in v0.6.0
func (u UFSPathBuilder) GenAlluxioUFSRootPath(items []datav1alpha1.Mount) (string, *datav1alpha1.Mount)
GenAlluxioUFSRootPath determines which mount point should be mounted on the root path of the unified namespace in Alluxio engine. Commonly there are two cases:
- If a `mount` item is the only item defined in `dataset.sepc.mounts[*]` and its ufs path equals to "/", its `mountpoint` should be on the root path. e.g. alluxio fs mount s3://mybucket /
- Otherwise, pick `/underFSStorage` as the default root path. e.g. alluxio fs mount /underFSStorage / && alluxio fs mount s3://mybucket /mybucket
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) GenUFSPathInUnifiedNamespace ¶ added in v1.0.2
func (u UFSPathBuilder) GenUFSPathInUnifiedNamespace(mount datav1alpha1.Mount) string
GenUFSPathInUnifiedNamespace generates a path in the cache engine's unified namespace for the given mount. It follows the convention defined internally by Fluid:
1. if `dataset.spec.mounts[*].path` is set to a absolute path, pick `path`. 2. otherwise, pick `/{dataset.spec.mounts[*].name}`
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
type VolumeLocks ¶ added in v0.9.2
type VolumeLocks struct {
// contains filtered or unexported fields
}
func NewVolumeLocks ¶ added in v0.9.2
func NewVolumeLocks() *VolumeLocks
func (*VolumeLocks) Release ¶ added in v0.9.2
func (lock *VolumeLocks) Release(volumeID string)
Release releases lock in volume level
func (*VolumeLocks) TryAcquire ¶ added in v0.9.2
func (lock *VolumeLocks) TryAcquire(volumeID string) bool
TryAcquire tries to acquire the lock for operating on resourceID and returns true if successful. If another operation is already using resourceID, returns false.
Source Files ¶
- affinity.go
- annotations.go
- byte_size.go
- capabilities.go
- charts.go
- common.go
- crtl_utils.go
- databackup.go
- dataload.go
- datamigrate.go
- dataoperation.go
- dataprocess.go
- dataset.go
- dataset_condition.go
- dataset_reference.go
- dataset_runtime.go
- env.go
- errors.go
- excluisve.go
- fluid.go
- home.go
- init_user.go
- json.go
- label.go
- map.go
- mount.go
- net.go
- pprof.go
- quantity.go
- random.go
- raw.go
- resources.go
- runtime_checkers.go
- runtime_condition.go
- runtimes.go
- slice.go
- symlink.go
- time_tracker.go
- ufs_path_builder.go
- unix.go
- volume_lock.go
- volumes.go
- webhook.go
- yaml.go