diff --git a/steps.go b/steps.go index dcfd81d..51a2ab1 100644 --- a/steps.go +++ b/steps.go @@ -183,14 +183,15 @@ func AddLabelToIstioDestinatonRulesSelector( utils.LogInfo("9. Add the label as a selector in istio destination rules...") currentDestinationRule, err := istioClient.NetworkingV1alpha3().DestinationRules(namespace).Get(context.TODO(), applicationName, v1.GetOptions{}) - if strings.HasSuffix(err.Error(), "not found") { - utils.LogSuccess("9. Not Istio rules configured") - utils.LogInfo("============================================================") + if err != nil { + if strings.HasSuffix(err.Error(), "not found") { + utils.LogSuccess("9. Not Istio rules configured") + utils.LogInfo("============================================================") + } else { + fmt.Println(err) + utils.Check(err) + } } else { - fmt.Println(currentDestinationRule) - fmt.Println(err) - utils.Check(err) - var futureDestinationRule = currentDestinationRule if removeLabel { // Update the value of the label diff --git a/summary/webapp/router.go b/summary/webapp/router.go index 076dc2e..f62a889 100644 --- a/summary/webapp/router.go +++ b/summary/webapp/router.go @@ -62,12 +62,10 @@ func StartWebServer( err := utils.OpenURL("http://localhost:8080") utils.Check(err) - httpServerError := make(chan error, 1) go func() { - httpServerError <- http.ListenAndServe(":8080", nil) + httpServerError := http.ListenAndServe(":8080", nil) + if err := httpServerError; err != nil { + fmt.Println(err) + } }() - - if err := <-httpServerError; err != nil { - fmt.Println(err) - } } diff --git a/utils/check-arguments.go b/utils/check-arguments.go index 46cbdf9..a0309eb 100644 --- a/utils/check-arguments.go +++ b/utils/check-arguments.go @@ -6,11 +6,11 @@ import ( ) func CheckLabelKey(key string) error { - r, _ := regexp.Compile("^[a-z]{1}[a-z./]*[a-z]{1}$") + r, _ := regexp.Compile("^[a-z]{1}[a-z./-]*[a-z]{1}$") if r.MatchString(key) { return nil } else { - return fmt.Errorf("The label key does not respect this regex: ^[a-z]{1}[a-z./]*[a-z]{1}$") + return fmt.Errorf("The label key does not respect this regex: ^[a-z]{1}[a-z./-]*[a-z]{1}$") } } diff --git a/version.go b/version.go index cdff22c..e850fcd 100644 --- a/version.go +++ b/version.go @@ -8,8 +8,8 @@ import ( "github.com/fatih/color" ) -const Version string = "0.1.4" -const BuildDate string = "2024-08-12" +const Version string = "0.1.5" +const BuildDate string = "2024-09-24" func cliCommandDisplayHelp(args []string) { displayVersion := utils.StringInSlice("-v", args[1:]) || utils.StringInSlice("--version", args[1:])