forked from fluid-cloudnative/fluid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make alluxio image configurable (fluid-cloudnative#380)
* Make alluxio image configurable * Make alluxio image configurable, to #31235919 * Make alluxio image configurable, to #31235919 * Make alluxio image configurable, to #31235919
- Loading branch information
Showing
15 changed files
with
193 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,13 @@ Fluid需要使用`make`命令进行项目构建,使用以下命令安装`make` | |
|
||
## 编译、运行和调试 | ||
|
||
### 安装`controller-gen` | ||
|
||
```shell | ||
$ go get sigs.k8s.io/controller-tools/cmd/[email protected] | ||
$ cp $GOPATH/bin/controller-gen /usr/local/bin/ | ||
``` | ||
|
||
### 获取Fluid源码 | ||
|
||
```shell | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package common | ||
|
||
// Runtime for Alluxio | ||
const ( | ||
ALLUXIO_RUNTIME = "alluxio" | ||
|
||
ALLUXIO_NAMESPACE = "alluxio-system" | ||
|
||
ALLUXIO_CHART = ALLUXIO_RUNTIME | ||
|
||
ALLUXIO_DATA_LOADER_IMAGE_ENV = "AlluxioDataLoaderImage" | ||
|
||
// DEFAULT_ALLUXIO_DATA_LOADER_IMAGE = "registry.cn-huhehaote.aliyuncs.com/alluxio/alluxio-data-loader:v2.2.0" | ||
|
||
ALLUXIO_INIT_IMAGE_ENV = "ALLUXIO_INIT_IMAGE_ENV" | ||
|
||
ALLUXIO_RUNTIME_IMAGE_ENV = "ALLUXIO_RUNTIME_IMAGE_ENV" | ||
|
||
ALLUXIO_FUSE_IMAGE_ENV = "ALLUXIO_FUSE_IMAGE_ENV" | ||
|
||
ALLUXIO_DATALOAD_IMAGE_ENV = "ALLUXIO_DATALOAD_IMAGE_ENV" | ||
|
||
DEFAULT_ALLUXIO_INIT_IMAGE = "registry.cn-hangzhou.aliyuncs.com/fluid/init-users:v0.3.0-1467caa" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package docker | ||
|
||
import ( | ||
"os" | ||
"regexp" | ||
"strings" | ||
) | ||
|
||
// ParseDockerImage extracts repo and tag from image. An empty string is returned if no tag is discovered. | ||
func ParseDockerImage(image string) (name string, tag string) { | ||
matches := strings.Split(image, ":") | ||
if len(matches) >= 2 { | ||
name = matches[0] | ||
tag = matches[1] | ||
} else if len(matches) == 1 { | ||
name = matches[0] | ||
tag = "latest" | ||
// return matches[0], "latest" | ||
} | ||
return | ||
} | ||
|
||
// GetImageRepoTagFromEnv parse the image and tag from environment varaibles, if it's not existed or | ||
func GetImageRepoTagFromEnv(envName, defaultImage string, defaultTag string) (image, tag string) { | ||
|
||
image = defaultImage | ||
tag = defaultTag | ||
|
||
if value, existed := os.LookupEnv(envName); existed { | ||
if matched, err := regexp.MatchString("^\\S+:\\S+$", value); err == nil && matched { | ||
k, v := ParseDockerImage(value) | ||
if len(k) > 0 { | ||
image = k | ||
|
||
} | ||
if len(v) > 0 { | ||
tag = v | ||
|
||
} | ||
} | ||
} | ||
|
||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package docker | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestParseDockerImage(t *testing.T) { | ||
var testCases = []struct { | ||
input string | ||
image string | ||
tag string | ||
}{ | ||
{"test:abc", "test", "abc"}, | ||
{"test", "test", "latest"}, | ||
} | ||
for _, tc := range testCases { | ||
image, tag := ParseDockerImage(tc.input) | ||
if tc.image != image { | ||
t.Errorf("expected image %#v, got %#v", | ||
tc.image, image) | ||
} | ||
|
||
if tc.tag != tag { | ||
t.Errorf("expected tag %#v, got %#v", | ||
tc.tag, tag) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters