Repository: fluid-cloudnative/fluid (go)

Issue:
[DOC]fix typo in monitoring.md
**Provide a link to that doc page:**
https://github.com/fluid-cloudnative/fluid/blob/master/docs/zh/operation/monitoring.md
**What is the defect and your suggestions on improvement:**
docs\zh\operation\monitoring.md:132:64: corrected "Prometheous" to "Prometheus"
docs\zh\operation\monitoring.md:137:17: corrected "Prometheous" to "Prometheus"
docs\zh\operation\monitoring.md:137:61: corrected "Prometheous" to "Prometheus"

Pull request:
fix typo in monitoring.md
<!-- 
Please make sure you have read and understood the contributing guidelines;
https://github.com/fluid-cloudnative/fluid/blob/master/CONTRIBUTING.md-->

### Ⅰ. Describe what this PR does
Fixed #3785 
The pr is to fix some typo below:
docs\zh\operation\monitoring.md:132:64: corrected "Prometheous" to "Prometheus"
docs\zh\operation\monitoring.md:137:17: corrected "Prometheous" to "Prometheus"
docs\zh\operation\monitoring.md:137:61: corrected "Prometheous" to "Prometheus"

Patch:
diff --git a/charts/fluid/fluid/templates/controller/vineyardruntime_controller.yaml b/charts/fluid/fluid/templates/controller/vineyardruntime_controller.yaml
index efaab4f0..55b26d52 100644
--- a/charts/fluid/fluid/templates/controller/vineyardruntime_controller.yaml
+++ b/charts/fluid/fluid/templates/controller/vineyardruntime_controller.yaml
@@ -60,6 +60,18 @@ spec:
         - name: MOUNT_ROOT
           value: {{ .Values.runtime.mountRoot | quote }}
         {{- end }}
+        {{- if .Values.runtime.vineyard.master.image }}
+        - name: VINEYARD_MASTER_IMAGE_ENV
+          value: {{ .Values.runtime.vineyard.master.image | quote }}
+        {{- end }}
+        {{- if .Values.runtime.vineyard.worker.image }}
+        - name: VINEYARD_WORKER_IMAGE_ENV
+          value: {{ .Values.runtime.vineyard.worker.image | quote }}
+        {{- end }}
+        {{- if .Values.runtime.vineyard.fuse.image }}
+        - name: VINEYARD_FUSE_IMAGE_ENV
+          value: {{ .Values.runtime.vineyard.fuse.image | quote }}
+        {{- end }}
         {{- if .Values.runtime.syncRetryDuration }}
         - name: FLUID_SYNC_RETRY_DURATION
           value: {{ .Values.runtime.syncRetryDuration | quote }}
diff --git a/charts/fluid/fluid/values.yaml b/charts/fluid/fluid/values.yaml
index fcac8ff7..adea4ba1 100644
--- a/charts/fluid/fluid/values.yaml
+++ b/charts/fluid/fluid/values.yaml
@@ -149,6 +149,12 @@ runtime:
     controller:
       image: fluidcloudnative/vineyardruntime-controller:v1.0.0-10382d2
       imagePullPolicy: Always
+    master:
+      image: bitnami/etcd:3.5.10
+    worker:
+      image: vineyardcloudnative/vineyardd:v0.21.5
+    fuse:
+      image: vineyardcloudnative/vineyard-fluid-fuse:v0.21.5
 
 webhook:
   enabled: true
diff --git a/docs/zh/operation/monitoring.md b/docs/zh/operation/monitoring.md
index e0c358f4..0d2387d3 100644
--- a/docs/zh/operation/monitoring.md
+++ b/docs/zh/operation/monitoring.md
@@ -129,12 +129,12 @@ spec:
         quota: 1Gi
         high: "0.95"
         low: "0.7"
-  # 默认在v0.5.0版本之后，alluxio runtime已经开启了Prometheous数据，如果需要关闭可以主动设置disablePrometheus: true
+  # 默认在v0.5.0版本之后，alluxio runtime已经开启了Prometheus数据，如果需要关闭可以主动设置disablePrometheus: true
   # disablePrometheus: false  
 EOF
 ```
 
-> 注意：默认Prometheous是开启的。如果需要关闭Prometheous，可以设置 disablePrometheus: true, 默认为 false
+> 注意：默认Prometheus是开启的。如果需要关闭Prometheus，可以设置 disablePrometheus: true, 默认为 false
 
 6. 查看监控
 在 grafana HOME 中知道名为Fluid-Prometheus-Grafana-Monitor视图即可，如下所示:
diff --git a/pkg/common/vineyard.go b/pkg/common/vineyard.go
index cbf0d336..99b3178c 100644
--- a/pkg/common/vineyard.go
+++ b/pkg/common/vineyard.go
@@ -21,6 +21,12 @@ const (
 
 	VineyardChart = VineyardRuntime
 
+	VineyardMasterImageEnv = "VINEYARD_MASTER_IMAGE_ENV"
+
+	VineyardWorkerImageEnv = "VINEYARD_WORKER_IMAGE_ENV"
+
+	VineyardFuseImageEnv = "VINEYARD_FUSE_IMAGE_ENV"
+
 	VineyardFuseIsGlobal = true
 
 	DefaultVineyardMasterImage = "bitnami/etcd:3.5.10"
diff --git a/pkg/ddc/jindocache/transform.go b/pkg/ddc/jindocache/transform.go
index 306b4b46..66f04858 100644
--- a/pkg/ddc/jindocache/transform.go
+++ b/pkg/ddc/jindocache/transform.go
@@ -270,6 +270,10 @@ func (e *JindoCacheEngine) transformMaster(runtime *datav1alpha1.JindoRuntime, m
 		// to parse cacheset
 		cachesetName := mount.Name
 		cachesetPath := mount.MountPoint
+		if strings.HasPrefix(mount.MountPoint, common.VolumeScheme.String()) {
+			ufsVolumesPath := utils.UFSPathBuilder{}.GenLocalStoragePath(mount)
+			cachesetPath = "local://" + ufsVolumesPath
+		}
 		cacheStrategy := "DISTRIBUTED"
 		metaPolicy := "ALWAYS"
 		readCacheReplica := 1
diff --git a/pkg/ddc/vineyard/transform.go b/pkg/ddc/vineyard/transform.go
index 750cbdd1..d6a777cb 100644
--- a/pkg/ddc/vineyard/transform.go
+++ b/pkg/ddc/vineyard/transform.go
@@ -15,9 +15,10 @@ package vineyard
 
 import (
 	"fmt"
-	"github.com/fluid-cloudnative/fluid/pkg/common"
 	"time"
 
+	"github.com/fluid-cloudnative/fluid/pkg/common"
+
 	datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
 	"github.com/fluid-cloudnative/fluid/pkg/utils"
 	"github.com/fluid-cloudnative/fluid/pkg/utils/transfromer"
diff --git a/pkg/ddc/vineyard/utils.go b/pkg/ddc/vineyard/utils.go
index cdcf2c6b..4b1f68e0 100644
--- a/pkg/ddc/vineyard/utils.go
+++ b/pkg/ddc/vineyard/utils.go
@@ -25,6 +25,7 @@ import (
 	datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
 	"github.com/fluid-cloudnative/fluid/pkg/common"
 	"github.com/fluid-cloudnative/fluid/pkg/utils"
+	"github.com/fluid-cloudnative/fluid/pkg/utils/docker"
 )
 
 // getRuntime gets the vineyard runtime
@@ -128,20 +129,26 @@ func (e *VineyardEngine) parseMasterImage(image string, tag string, imagePullPol
 	}
 
 	if len(image) == 0 {
-		masterImageInfo := strings.Split(common.DefaultVineyardMasterImage, ":")
-		if len(masterImageInfo) < 1 {
-			panic("invalid default vineyard master image!")
-		} else {
-			image = masterImageInfo[0]
+		image = docker.GetImageRepoFromEnv(common.VineyardMasterImageEnv)
+		if len(image) == 0 {
+			masterImageInfo := strings.Split(common.DefaultVineyardMasterImage, ":")
+			if len(masterImageInfo) < 1 {
+				panic("invalid default vineyard master image!")
+			} else {
+				image = masterImageInfo[0]
+			}
 		}
 	}
 
 	if len(tag) == 0 {
-		masterImageInfo := strings.Split(common.DefaultVineyardMasterImage, ":")
-		if len(masterImageInfo) < 2 {
-			panic("invalid default vineyard master image!")
-		} else {
-			tag = masterImageInfo[1]
+		tag = docker.GetImageTagFromEnv(common.VineyardMasterImageEnv)
+		if len(tag) == 0 {
+			masterImageInfo := strings.Split(common.DefaultVineyardMasterImage, ":")
+			if len(masterImageInfo) < 2 {
+				panic("invalid default vineyard master image!")
+			} else {
+				tag = masterImageInfo[1]
+			}
 		}
 	}
 
@@ -154,20 +161,26 @@ func (e *VineyardEngine) parseWorkerImage(image string, tag string, imagePullPol
 	}
 
 	if len(image) == 0 {
-		workerImageInfo := strings.Split(common.DefaultVineyardWorkerImage, ":")
-		if len(workerImageInfo) < 1 {
-			panic("invalid default vineyard worker image!")
-		} else {
-			image = workerImageInfo[0]
+		image = docker.GetImageRepoFromEnv(common.VineyardWorkerImageEnv)
+		if len(image) == 0 {
+			workerImageInfo := strings.Split(common.DefaultVineyardWorkerImage, ":")
+			if len(workerImageInfo) < 1 {
+				panic("invalid default vineyard worker image!")
+			} else {
+				image = workerImageInfo[0]
+			}
 		}
 	}
 
 	if len(tag) == 0 {
-		workerImageInfo := strings.Split(common.DefaultVineyardWorkerImage, ":")
-		if len(workerImageInfo) < 2 {
-			panic("invalid default vineyard worker image!")
-		} else {
-			tag = workerImageInfo[1]
+		tag = docker.GetImageTagFromEnv(common.VineyardWorkerImageEnv)
+		if len(tag) == 0 {
+			workerImageInfo := strings.Split(common.DefaultVineyardWorkerImage, ":")
+			if len(workerImageInfo) < 2 {
+				panic("invalid default vineyard worker image!")
+			} else {
+				tag = workerImageInfo[1]
+			}
 		}
 	}
 
@@ -180,20 +193,26 @@ func (e *VineyardEngine) parseFuseImage(image string, tag string, imagePullPolic
 	}
 
 	if len(image) == 0 {
-		fuseImageInfo := strings.Split(common.DefultVineyardFuseImage, ":")
-		if len(fuseImageInfo) < 1 {
-			panic("invalid default vineyard fuse image!")
-		} else {
-			image = fuseImageInfo[0]
+		image = docker.GetImageRepoFromEnv(common.VineyardFuseImageEnv)
+		if len(image) == 0 {
+			fuseImageInfo := strings.Split(common.DefultVineyardFuseImage, ":")
+			if len(fuseImageInfo) < 1 {
+				panic("invalid default vineyard fuse image!")
+			} else {
+				image = fuseImageInfo[0]
+			}
 		}
 	}
 
 	if len(tag) == 0 {
-		fuseImageInfo := strings.Split(common.DefultVineyardFuseImage, ":")
-		if len(fuseImageInfo) < 2 {
-			panic("invalid default vineyard fuse image!")
-		} else {
-			tag = fuseImageInfo[1]
+		tag = docker.GetImageTagFromEnv(common.VineyardFuseImageEnv)
+		if len(tag) == 0 {
+			fuseImageInfo := strings.Split(common.DefultVineyardFuseImage, ":")
+			if len(fuseImageInfo) < 2 {
+				panic("invalid default vineyard fuse image!")
+			} else {
+				tag = fuseImageInfo[1]
+			}
 		}
 	}
 


Test patch:
diff --git a/pkg/ddc/vineyard/transform_test.go b/pkg/ddc/vineyard/transform_test.go
index 3c626d3c..a6c15e6e 100755
--- a/pkg/ddc/vineyard/transform_test.go
+++ b/pkg/ddc/vineyard/transform_test.go
@@ -14,7 +14,9 @@ limitations under the License.
 package vineyard
 
 import (
+	"os"
 	"reflect"
+	"strings"
 	"testing"
 
 	datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
@@ -37,25 +39,47 @@ func TestTransformFuse(t *testing.T) {
 		o.Development = true
 	}))
 
-	var tests = []struct {
+	var tests = map[string]struct {
 		runtime   *datav1alpha1.VineyardRuntime
 		value     *Vineyard
 		expect    []string
 		expectEnv map[string]string
 	}{
-		{&datav1alpha1.VineyardRuntime{
-			Spec: datav1alpha1.VineyardRuntimeSpec{
-				Fuse: datav1alpha1.VineyardSockSpec{
-					Image:           "dummy-fuse-image",
-					ImageTag:        "dummy-tag",
-					ImagePullPolicy: "IfNotPresent",
-					Env:             map[string]string{"TEST_ENV": "true"},
-					CleanPolicy:     "OnRuntimeDeleted",
+		"test image, imageTag and pullPolicy": {
+			runtime: &datav1alpha1.VineyardRuntime{
+				Spec: datav1alpha1.VineyardRuntimeSpec{
+					Fuse: datav1alpha1.VineyardSockSpec{
+						Image:           "dummy-fuse-image",
+						ImageTag:        "dummy-tag",
+						ImagePullPolicy: "IfNotPresent",
+						Env:             map[string]string{"TEST_ENV": "true"},
+						CleanPolicy:     "OnRuntimeDeleted",
+					},
+				},
+			},
+			value:     &Vineyard{},
+			expect:    []string{"dummy-fuse-image", "dummy-tag", "IfNotPresent", "OnRuntimeDeleted"},
+			expectEnv: map[string]string{"TEST_ENV": "true"},
+		},
+		"test image, imageTag and pullPolicy from env": {
+			runtime: &datav1alpha1.VineyardRuntime{
+				Spec: datav1alpha1.VineyardRuntimeSpec{
+					Fuse: datav1alpha1.VineyardSockSpec{
+						ImagePullPolicy: "IfNotPresent",
+						Env:             map[string]string{"TEST_ENV": "true"},
+						CleanPolicy:     "OnRuntimeDeleted",
+					},
 				},
 			},
-		}, &Vineyard{}, []string{"dummy-fuse-image", "dummy-tag", "IfNotPresent", "OnRuntimeDeleted"}, map[string]string{"TEST_ENV": "true"}},
+			value:     &Vineyard{},
+			expect:    []string{"image-from-env", "image-tag-from-env", "IfNotPresent", "OnRuntimeDeleted"},
+			expectEnv: map[string]string{"TEST_ENV": "true"},
+		},
 	}
-	for _, test := range tests {
+	for k, test := range tests {
+		if strings.Contains(k, "env") {
+			os.Setenv("VINEYARD_FUSE_IMAGE_ENV", "image-from-env:image-tag-from-env")
+		}
 		engine := &VineyardEngine{}
 		engine.Log = ctrl.Log
 		engine.transformFuse(test.runtime, test.value)
@@ -75,6 +99,9 @@ func TestTransformFuse(t *testing.T) {
 		if !reflect.DeepEqual(test.value.Fuse.Env, test.expectEnv) {
 			t.Errorf("Expected Fuse Env %v, got %v", test.expectEnv, test.value.Fuse.Env)
 		}
+		if strings.Contains(k, "env") {
+			os.Unsetenv("VINEYARD_FUSE_IMAGE_ENV")
+		}
 	}
 }
 
@@ -103,11 +130,32 @@ func TestTransformMaster(t *testing.T) {
 				},
 			},
 		},
+		"test image, imageTag and pullPolicy from env": {
+			runtime: &datav1alpha1.VineyardRuntime{
+				Spec: datav1alpha1.VineyardRuntimeSpec{
+					Master: datav1alpha1.MasterSpec{
+						VineyardCompTemplateSpec: datav1alpha1.VineyardCompTemplateSpec{
+							ImagePullPolicy: "IfNotPresent",
+						},
+					},
+				},
+			},
+			wantValue: &Vineyard{
+				Master: Master{
+					Image:           "image-from-env",
+					ImageTag:        "image-tag-from-env",
+					ImagePullPolicy: "IfNotPresent",
+				},
+			},
+		},
 	}
 
 	engine := &VineyardEngine{Log: fake.NullLogger()}
 	ds := &datav1alpha1.Dataset{}
 	for k, v := range testCases {
+		if strings.Contains(k, "env") {
+			os.Setenv("VINEYARD_MASTER_IMAGE_ENV", "image-from-env:image-tag-from-env")
+		}
 		gotValue := &Vineyard{}
 		if err := engine.transformMasters(v.runtime, ds, gotValue); err == nil {
 			if gotValue.Master.Image != v.wantValue.Master.Image {
@@ -132,6 +180,9 @@ func TestTransformMaster(t *testing.T) {
 				)
 			}
 		}
+		if strings.Contains(k, "env") {
+			os.Unsetenv("VINEYARD_MASTER_IMAGE_ENV")
+		}
 	}
 }
 
@@ -160,10 +211,33 @@ func TestTransformWorker(t *testing.T) {
 				},
 			},
 		},
+		"test replicas, image, imageTag and pullPolicy from env": {
+			runtime: &datav1alpha1.VineyardRuntime{
+				Spec: datav1alpha1.VineyardRuntimeSpec{
+					Replicas: 3,
+					Worker: datav1alpha1.VineyardCompTemplateSpec{
+						Replicas:        2,
+						Image:           "test-image",
+						ImageTag:        "test-tag",
+						ImagePullPolicy: "IfNotPresent",
+					},
+				},
+			},
+			wantValue: &Vineyard{
+				Worker: Worker{
+					Image:           "image-from-env",
+					ImageTag:        "image-tag-from-env",
+					ImagePullPolicy: "IfNotPresent",
+				},
+			},
+		},
 	}
 
 	engine := &VineyardEngine{Log: fake.NullLogger()}
 	for k, v := range testCases {
+		if strings.Contains(k, "env") {
+			os.Setenv("VINEYARD_WORKER_IMAGE_ENV", "image-from-env:image-tag-from-env")
+		}
 		gotValue := &Vineyard{}
 		engine.runtimeInfo, _ = base.BuildRuntimeInfo("test", "test", "vineyard", v.runtime.Spec.TieredStore)
 		if err := engine.transformWorkers(v.runtime, gotValue); err == nil {
@@ -196,6 +270,9 @@ func TestTransformWorker(t *testing.T) {
 				)
 			}
 		}
+		if strings.Contains(k, "env") {
+			os.Unsetenv("VINEYARD_WORKER_IMAGE_ENV")
+		}
 	}
 }