MCPcopy
hub / github.com/fluid-cloudnative/fluid / transformCommonPart

Method transformCommonPart

pkg/ddc/alluxio/transform.go:127–248  ·  view source on GitHub ↗

2. Transform the common part

(runtime *datav1alpha1.AlluxioRuntime,
	dataset *datav1alpha1.Dataset,
	value *Alluxio,
)

Source from the content-addressed store, hash-verified

125
126// 2. Transform the common part
127func (e *AlluxioEngine) transformCommonPart(runtime *datav1alpha1.AlluxioRuntime,
128 dataset *datav1alpha1.Dataset,
129 value *Alluxio,
130) (err error) {
131 value.RuntimeIdentity.Namespace = runtime.Namespace
132 value.RuntimeIdentity.Name = runtime.Name
133
134 image := runtime.Spec.AlluxioVersion.Image
135 imageTag := runtime.Spec.AlluxioVersion.ImageTag
136 imagePullPolicy := runtime.Spec.AlluxioVersion.ImagePullPolicy
137 imagePullSecrets := runtime.Spec.ImagePullSecrets
138
139 value.Image, value.ImageTag, value.ImagePullPolicy, value.ImagePullSecrets = e.parseRuntimeImage(image, imageTag, imagePullPolicy, imagePullSecrets)
140
141 value.UserInfo = common.UserInfo{
142 User: 0,
143 // FSGroup: 0,
144 Group: 0,
145 }
146
147 // transform init users
148 e.transformInitUsers(runtime, value)
149
150 // TODO: support nodeAffinity
151
152 if len(runtime.Spec.Properties) > 0 {
153 value.Properties = runtime.Spec.Properties
154 } else {
155 value.Properties = map[string]string{}
156 }
157
158 // generate alluxio root ufs by dataset spec mounts
159 e.Log.Info("input", "mounts", dataset.Spec.Mounts, "common.RootDirPath", common.RootDirPath)
160 uRootPath, m := utils.UFSPathBuilder{}.GenAlluxioUFSRootPath(dataset.Spec.Mounts)
161 // attach mount options when direct mount ufs endpoint
162 if m != nil {
163 extractEncryptOption := !IsMountWithConfigMap()
164 if mOptions, err := e.genUFSMountOptions(*m, dataset.Spec.SharedOptions, dataset.Spec.SharedEncryptOptions, extractEncryptOption); err != nil {
165 return err
166 } else {
167 for k, v := range mOptions {
168 value.Properties[k] = v
169 }
170 }
171 }
172 e.Log.Info("output", "uRootPath", uRootPath, "m", m)
173 // set alluxio root ufs
174 value.Properties["alluxio.master.mount.table.root.ufs"] = uRootPath
175
176 // Set the max replication
177 dataReplicas := runtime.Spec.Data.Replicas
178 if dataReplicas <= 0 {
179 dataReplicas = 1
180 }
181 value.Properties["alluxio.user.file.replication.max"] = fmt.Sprintf("%d", dataReplicas)
182
183 if len(runtime.Spec.JvmOptions) > 0 {
184 value.JvmOptions = runtime.Spec.JvmOptions

Callers 1

transformMethod · 0.95

Calls 13

parseRuntimeImageMethod · 0.95
transformInitUsersMethod · 0.95
genUFSMountOptionsMethod · 0.95
getRuntimeInfoMethod · 0.95
transformTolerationsMethod · 0.95
transformShortCircuitMethod · 0.95
GetTieredLevelFunction · 0.92
FillSliceWithStringFunction · 0.92
IsMountWithConfigMapFunction · 0.85
GenAlluxioUFSRootPathMethod · 0.80

Tested by

no test coverage detected