Fully working oc-k8s
This commit is contained in:
@@ -20,6 +20,8 @@ var REPOS = []string{
|
||||
"oc-workspace",
|
||||
}
|
||||
|
||||
var officialRegistry = "opencloudregistry"
|
||||
|
||||
func Help_Service() {
|
||||
fmt.Println(`
|
||||
Service commands: oc-k8s <action> services
|
||||
@@ -27,15 +29,25 @@ Service commands: oc-k8s <action> services
|
||||
help - Show this help message
|
||||
|
||||
Usage:
|
||||
oc-k8s create services -f [env_folder] -r [release] -b [branch] -t [target]
|
||||
oc-k8s create services -f [env_folder] -r [release] -b [branch] -t [target] -build [true|false]
|
||||
env_folder - Helm config folder (required, default: .)
|
||||
release - Release values name (required, default: dev)
|
||||
branch - Git branch to build (default: main)
|
||||
target - make target (default: all)
|
||||
build - build mode (default: true)
|
||||
oc-k8s help services `)
|
||||
}
|
||||
|
||||
func Create_Service(folder string, release string, branch string, target string) error {
|
||||
func Create_Service(folder string, release string, branch string, target string, build bool) error {
|
||||
if build {
|
||||
return buildService(folder, release, branch, target)
|
||||
}
|
||||
utils.Exec("sed -i -e 's/: oc/: " + officialRegistry + "/g' " + folder + "/" + release + "-values.yaml")
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildService(folder string, release string, branch string, target string) error {
|
||||
utils.Exec("sed -i -e 's/" + officialRegistry + "/oc/g' " + folder + "/" + release + "-values.yaml")
|
||||
scheme := "http"
|
||||
hostname := "beta.opencloud.com"
|
||||
clusterName := "opencloud"
|
||||
@@ -62,7 +74,7 @@ func Create_Service(folder string, release string, branch string, target string)
|
||||
}
|
||||
}
|
||||
fmt.Println("Repository '" + repo + "' now exists. Pulling latest changes...")
|
||||
utils.Exec("cd " + repo + " && git checkout " + branch + " && git pull")
|
||||
utils.Exec("cd " + repo + " && git pull") // " && git checkout " + branch +
|
||||
fmt.Println("Build '" + repo + "'...")
|
||||
if err := utils.Exec("cd " + repo + " && export CLUSTER_NAME=" + clusterName + " && export HOST=" + scheme + "://" + hostname + ":" + pport + " && export KUBERNETES_SERVICE_HOST=" + host + " && export KUBERNETES_SERVICE_PORT=" + port + " && export KUBE_CA=" + ca + " && export KUBE_CERT=" + cert + " && export KUBE_DATA=" + key + " && make " + target); err != nil {
|
||||
fmt.Println("ERR", err)
|
||||
@@ -72,3 +84,5 @@ func Create_Service(folder string, release string, branch string, target string)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// opencloudregistry.hub.docker.com
|
||||
|
||||
Reference in New Issue
Block a user