From e71ef60b3a9889eb1e94b3ec194528635ff839e4 Mon Sep 17 00:00:00 2001 From: FogDong Date: Mon, 18 Jul 2022 20:06:35 +0800 Subject: [PATCH 1/3] Fix: fix dex parameter in velaux addon Signed-off-by: FogDong --- addons/velaux/resources/parameter.cue | 2 +- addons/velaux/resources/velaux.cue | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/velaux/resources/parameter.cue b/addons/velaux/resources/parameter.cue index 5d13d8e4..41c07959 100644 --- a/addons/velaux/resources/parameter.cue +++ b/addons/velaux/resources/parameter.cue @@ -20,5 +20,5 @@ parameter: { // +usage=Specify the names of imagePullSecret for private image registry, eg. "{a,b,c}" imagePullSecrets?: [...string] // +usage=Specify whether to enable the dex - dex: *"false" | "true" + dex: *false | bool } diff --git a/addons/velaux/resources/velaux.cue b/addons/velaux/resources/velaux.cue index 104b5d72..4e348cfc 100644 --- a/addons/velaux/resources/velaux.cue +++ b/addons/velaux/resources/velaux.cue @@ -23,7 +23,7 @@ output: { if parameter["serviceType"] != _|_ { exposeType: parameter["serviceType"] } - if parameter["dex"] == "true" { + if parameter["dex"] == true { env: [ { name: "KUBEVELA_API_URL" @@ -35,12 +35,12 @@ output: { }, ] } - if parameter["dex"] == "false" { + if parameter["dex"] != true { env: [ { name: "KUBEVELA_API_URL" value: "apiserver.vela-system:8000" - }, + } ] } } From ed4ab52e4ed5d7eca83970ed40747738f62fc378 Mon Sep 17 00:00:00 2001 From: FogDong Date: Mon, 18 Jul 2022 20:07:47 +0800 Subject: [PATCH 2/3] change the version Signed-off-by: FogDong --- addons/velaux/metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/velaux/metadata.yaml b/addons/velaux/metadata.yaml index 7d5c6b64..02ac0790 100644 --- a/addons/velaux/metadata.yaml +++ b/addons/velaux/metadata.yaml @@ -1,5 +1,5 @@ name: velaux -version: v1.5.0-alpha.3 +version: v1.5.0-alpha.4 description: KubeVela User Experience (UX). An extensible, application-oriented delivery and management Dashboard. icon: https://static.kubevela.net/images/logos/KubeVela%20-03.png url: https://kubevela.io From dabc103325cf68914814fb996b8e3b6ca181bb7a Mon Sep 17 00:00:00 2001 From: FogDong Date: Tue, 19 Jul 2022 17:56:48 +0800 Subject: [PATCH 3/3] fix version Signed-off-by: FogDong --- addons/velaux/metadata.yaml | 2 +- test/e2e-test/addon-test/main.go | 34 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/addons/velaux/metadata.yaml b/addons/velaux/metadata.yaml index 02ac0790..7d5c6b64 100644 --- a/addons/velaux/metadata.yaml +++ b/addons/velaux/metadata.yaml @@ -1,5 +1,5 @@ name: velaux -version: v1.5.0-alpha.4 +version: v1.5.0-alpha.3 description: KubeVela User Experience (UX). An extensible, application-oriented delivery and management Dashboard. icon: https://static.kubevela.net/images/logos/KubeVela%20-03.png url: https://kubevela.io diff --git a/test/e2e-test/addon-test/main.go b/test/e2e-test/addon-test/main.go index 34649a75..b92d4ef1 100644 --- a/test/e2e-test/addon-test/main.go +++ b/test/e2e-test/addon-test/main.go @@ -29,7 +29,7 @@ import ( ) type AddonMeta struct { - Name string `json:"name"` + Name string `json:"name"` Dependencies []Dependency `json:"dependencies"` } @@ -57,7 +57,7 @@ func main() { } // will check all needed enabled addons according to changed files. -func determineNeedEnableAddon (changedFile []string) map[string]bool { +func determineNeedEnableAddon(changedFile []string) map[string]bool { needEnabledAddon := map[string]bool{} globalRex := regexp.MustCompile(globalRexPattern) regx := regexp.MustCompile(regexPattern) @@ -86,9 +86,9 @@ func determineNeedEnableAddon (changedFile []string) map[string]bool { } for addon := range needEnabledAddon { - if err := checkAffectedAddon(addon, needEnabledAddon); err != nil { - panic(err) - } + if err := checkAffectedAddon(addon, needEnabledAddon); err != nil { + panic(err) + } } for addon := range needEnabledAddon { @@ -110,7 +110,7 @@ func checkAffectedAddon(addonName string, needEnabledAddon map[string]bool) erro if err != nil { return err } - for _, subDir := range dir { + for _, subDir := range dir { if subDir.IsDir() { meta, err := readAddonMeta(subDir.Name()) if err != nil { @@ -128,12 +128,12 @@ func checkAffectedAddon(addonName string, needEnabledAddon map[string]bool) erro return nil } -func putInAllAddons (addons map[string]bool) error { +func putInAllAddons(addons map[string]bool) error { dir, err := ioutil.ReadDir("./addons") if err != nil { return err } - for _, subDir := range dir { + for _, subDir := range dir { if subDir.IsDir() { fmt.Println(subDir.Name()) addons[subDir.Name()] = true @@ -143,7 +143,7 @@ func putInAllAddons (addons map[string]bool) error { } // these addons are depended by changed addons. -func checkAddonDependency(addon string, changedAddon map[string]bool ) { +func checkAddonDependency(addon string, changedAddon map[string]bool) { meta, err := readAddonMeta(addon) if err != nil { panic(err) @@ -169,7 +169,7 @@ func readAddonMeta(addonName string) (*AddonMeta, error) { // This func will enable addon by order rely-on addon's relationShip dependency, // this func is so dummy now that the order is written manually, we can generated a dependency DAG workflow in the furture. -func enableAddonsByOrder (changedAddon map[string]bool) error { +func enableAddonsByOrder(changedAddon map[string]bool) error { dirPattern := "addons/%s" if changedAddon["fluxcd"] { if err := enableOneAddon(fmt.Sprintf(dirPattern, "fluxcd")); err != nil { @@ -219,7 +219,7 @@ func enableAddonsByOrder (changedAddon map[string]bool) error { } func enableOneAddon(dir string) error { - cmd := exec.Command("vela","addon", "enable", dir) + cmd := exec.Command("vela", "addon", "enable", dir) fmt.Println(cmd.String()) stdout, err := cmd.StdoutPipe() cmd.Stderr = cmd.Stdout @@ -238,13 +238,14 @@ func enableOneAddon(dir string) error { } } if err = cmd.Wait(); err != nil { + checkAppStatus(dir) return err } return nil } -func disableOneAddon (addonName string) error { - cmd := exec.Command("vela","addon", "disable", addonName) +func disableOneAddon(addonName string) error { + cmd := exec.Command("vela", "addon", "disable", addonName) fmt.Println(cmd.String()) stdout, err := cmd.StdoutPipe() cmd.Stderr = cmd.Stdout @@ -268,10 +269,9 @@ func disableOneAddon (addonName string) error { return nil } - // this func can be used for debug when addon enable failed. -func checkAppStatus(addonName string) { - cmd := exec.Command("vela","status", "-n", "vela-system", "addon-" + addonName) +func checkAppStatus(addonName string) { + cmd := exec.Command("vela", "status", "-n", "vela-system", "addon-"+addonName) fmt.Println(cmd.String()) stdout, err := cmd.StdoutPipe() cmd.Stderr = cmd.Stdout @@ -296,7 +296,7 @@ func checkAppStatus(addonName string) { // this func can be used for debug when addon enable failed. func checkPodStatus(namespace string) { - cmd := exec.Command("kubectl","get pods", "-n", namespace) + cmd := exec.Command("kubectl", "get pods", "-n", namespace) fmt.Println(cmd.String()) stdout, err := cmd.StdoutPipe() cmd.Stderr = cmd.Stdout