99 "os"
1010 "os/exec"
1111 "strconv"
12+ "strings"
1213 "time"
1314
1415 "encoding/json"
@@ -279,7 +280,8 @@ func installOLM() {
279280 if len (olmCRDInstalled ) > 0 {
280281 cfmt .Println ("{{✓ OLM CRD's allredy installed}}::lightGreen" )
281282 } else {
282- olmSpinner .Start ("run command : kubectl create -f " + olmURL + "/olm.yaml" )
283+ cfmt .Println (" run command : kubectl create -f " + olmURL + "/olm.yaml" )
284+ olmSpinner .Start ("Installing OLM CRDs" )
283285 _ , olmCRDErr := exec .Command ("kubectl" , "create" , "-f" , olmURL + "/crds.yaml" ).Output ()
284286 if olmCRDErr != nil {
285287 fmt .Println ("" )
@@ -290,7 +292,8 @@ func installOLM() {
290292 }
291293 }
292294
293- olmSpinner .Start ("run command : kubectl create -f " + olmURL + "/olm.yaml" )
295+ cfmt .Println (" run command : kubectl create -f " + olmURL + "/olm.yaml" )
296+ olmSpinner .Start ("Install OLM" )
294297
295298 _ , olmOLMErr := exec .Command ("kubectl" , "create" , "-f" , olmURL + "/olm.yaml" ).Output ()
296299 if olmOLMErr != nil {
@@ -301,7 +304,8 @@ func installOLM() {
301304 olmSpinner .Success ("OLM installed sucessfully" )
302305
303306 olmWaitSpinner := spinner .New ("Wait for OLM to be ready" )
304- olmWaitSpinner .Start ("run command : kubectl wait --for=condition=available deployment/olm-operator -n " + namespace + " --timeout=180s" )
307+ cfmt .Println (" run command : kubectl wait --for=condition=available deployment/olm-operator -n " + namespace + " --timeout=180s" )
308+ olmWaitSpinner .Start ("Wait for OLM to be ready" )
305309 _ , olmWaitErr := exec .Command ("kubectl" , "wait" , "--for=condition=available" , "deployment/olm-operator" , "-n" , namespace , "--timeout=180s" ).Output ()
306310 if olmWaitErr != nil {
307311 olmWaitSpinner .Error ("Failed to run command. Try runnig this command manually: kubectl wait --for=condition=available deployment/olm-operator -n " + namespace + " --timeout=180s" )
@@ -310,7 +314,8 @@ func installOLM() {
310314 olmWaitSpinner .Success ("OLM is ready" )
311315
312316 olmWaitCatalogSpinner := spinner .New ("Wait for OLM Catalog to be ready" )
313- olmWaitCatalogSpinner .Start ("run command : kubectl wait --for=condition=available deployment/catalog-operator -n " + namespace + " --timeout=180s" )
317+ cfmt .Println (" run command : kubectl wait --for=condition=available deployment/catalog-operator -n " + namespace + " --timeout=180s" )
318+ olmWaitCatalogSpinner .Start ("Wait for OLM Catalog to be ready" )
314319 _ , olmWaitCatalogErr := exec .Command ("kubectl" , "wait" , "--for=condition=available" , "deployment/catalog-operator" , "-n" , namespace , "--timeout=180s" ).Output ()
315320 if olmWaitCatalogErr != nil {
316321 olmWaitCatalogSpinner .Error ("Failed to run command. Try runnig this command manually: kubectl wait --for=condition=available deployment/catalog-operator -n " + namespace + " --timeout=180s" )
@@ -379,7 +384,8 @@ func installIngress() {
379384 // incressController verion can bot be loaded from github api, since the return is alphabetic
380385 ingressSpinner := spinner .New ("Install Ingress" )
381386 URL := "https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-" + ingressControllerVersion + "/deploy/static/provider/" + ingressProvider + "/deploy.yaml"
382- ingressSpinner .Start ("run command : kubectl apply -f " + URL )
387+ cfmt .Println (" run command : kubectl apply -f " + URL )
388+ ingressSpinner .Start ("Install Ingress" )
383389 _ , ingressErr := exec .Command ("kubectl" , "apply" , "-f" , URL ).Output ()
384390 if ingressErr != nil {
385391 ingressSpinner .Error ("Failed to run command. Try runnig this command manually: kubectl apply -f " + URL )
@@ -411,7 +417,8 @@ func installKuberoOperator() {
411417func installKuberoOLMOperator () {
412418
413419 kuberoSpinner := spinner .New ("Install Kubero Operator" )
414- kuberoSpinner .Start ("run command : kubectl apply -f https://operatorhub.io/install/kubero-operator.yaml" )
420+ cfmt .Println (" run command : kubectl apply -f https://operatorhub.io/install/kubero-operator.yaml" )
421+ kuberoSpinner .Start ("Install Kubero Operator" )
415422 _ , kuberoErr := exec .Command ("kubectl" , "apply" , "-f" , "https://operatorhub.io/install/kubero-operator.yaml" ).Output ()
416423 if kuberoErr != nil {
417424 fmt .Println ("" )
@@ -434,7 +441,8 @@ func installKuberoOLMOperator() {
434441func installKuberoOperatorSlim () {
435442
436443 kuberoSpinner := spinner .New ("Install Kubero Operator" )
437- kuberoSpinner .Start ("run command : kubectl apply -f https://raw.githubusercontent.com/kubero-dev/kubero-operator/main/deploy/operator.yaml" )
444+ cfmt .Println (" run command : kubectl apply -f https://raw.githubusercontent.com/kubero-dev/kubero-operator/main/deploy/operator.yaml" )
445+ kuberoSpinner .Start ("Install Kubero Operator" )
438446 _ , kuberoErr := exec .Command ("kubectl" , "apply" , "-f" , "https://raw.githubusercontent.com/kubero-dev/kubero-operator/main/deploy/operator.yaml" ).Output ()
439447 if kuberoErr != nil {
440448 fmt .Println ("" )
@@ -587,7 +595,15 @@ func installKuberoUi() {
587595 }
588596 kuberoUIConfig .Spec .Ingress .Hosts [0 ].Host = arg_domain
589597
590- webhookURL := promptLine ("URL to which the webhooks should be sent (localhost fails with GitHub)" , "" , "https://" + arg_domain + "/api/repo/webhooks" )
598+ // Warn if domain contains kubero.net
599+
600+ webhookDomin := arg_domain
601+ if strings .Contains (arg_domain , "kubero.localhost" ) {
602+ cfmt .Println ("{{⚠ kubero.localhost might not be reachable won't get any Webhooks. GitHub will fail to connect your pipeline. }}::yellow" )
603+ webhookDomin = "webhook.local.kubero.net"
604+ }
605+
606+ webhookURL := promptLine ("URL to which the webhooks should be sent (localhost fails with GitHub)" , "" , "https://" + webhookDomin + "/api/repo/webhooks" )
591607 kuberoUIConfig .Spec .Kubero .WebhookURL = webhookURL
592608
593609 kuberoUIssl := promptLine ("Enable SSL for the Kubero UI" , "[y/n]" , "y" )
@@ -610,15 +626,19 @@ func installKuberoUi() {
610626 kuberoUIConfig .Spec .Registry .Enabled = true
611627
612628 kuberoUICreateRegistry := promptLine ("Create a local Registry for Kubero" , "[y/n]" , "n" )
629+
613630 if kuberoUICreateRegistry == "y" {
614631 kuberoUIConfig .Spec .Registry .Create = true
615- }
632+ kuberoUIConfig .Spec .Registry .Host = "registry.local.kubero.net" // registry.local.kubero.net points to localhost 127.0.0.1
633+ kuberoUIConfig .Spec .Registry .Port = 80
634+ } else {
616635
617- kuberoUIRegistryPort := promptLine ("Registry port" , "" , "443" )
618- kuberoUIConfig .Spec .Registry .Port , _ = strconv .Atoi (kuberoUIRegistryPort )
636+ kuberoUIRegistryPort := promptLine ("Registry port" , "" , "443" )
637+ kuberoUIConfig .Spec .Registry .Port , _ = strconv .Atoi (kuberoUIRegistryPort )
619638
620- kuberoUIRegistryHost := promptLine ("Registry domain" , "" , "registry." + arg_domain )
621- kuberoUIConfig .Spec .Registry .Host = kuberoUIRegistryHost
639+ kuberoUIRegistryHost := promptLine ("Registry domain" , "" , "registry.yourdomain.com" )
640+ kuberoUIConfig .Spec .Registry .Host = kuberoUIRegistryHost
641+ }
622642
623643 kuberoUIRegistryUsername := promptLine ("Registry username" , "" , "admin" )
624644 kuberoUIConfig .Spec .Registry .Account .Username = kuberoUIRegistryUsername
@@ -734,7 +754,8 @@ func installMonitoring() {
734754 spinner := spinner .New ("enable metrics" )
735755 if promptLine ("Create local Prometheus instance" , "[y/n]" , "y" ) == "y" {
736756 URL := "https://raw.githubusercontent.com/kubero-dev/kubero-operator/main/config/samples/application_v1alpha1_kuberoprometheus.yaml"
737- spinner .Start ("run command : kubectl apply -f " + URL )
757+ cfmt .Println (" run command : kubectl apply -f " + URL )
758+ spinner .Start ("Installing Prometheus" )
738759 _ , ingressErr := exec .Command ("kubectl" , "apply" , "-n" , "kubero" , "-f" , URL ).Output ()
739760 if ingressErr != nil {
740761 spinner .Error ("Failed to run command. Try runnig this command manually: kubectl apply -f " + URL )
@@ -754,7 +775,8 @@ func installMonitoring() {
754775 }
755776
756777 if promptLine ("Enable Kubemetrtics" , "[y/n]" , "y" ) == "y" {
757- spinner .Start ("run command : kubectl patch kuberoes kubero -n kubero --type=merge" )
778+ cfmt .Println (" run command : kubectl patch kuberoes kubero -n kubero --type=merge" )
779+ spinner .Start ("Enabling Metrics" )
758780
759781 patch := `{
760782 "spec": {
@@ -770,7 +792,7 @@ func installMonitoring() {
770792 if patchResult != nil {
771793 spinner .Error ("Failed to patch the kubero prometheus CRD to enable kube metrics" , patchResult .Error (), patch )
772794 }
773- spinner .Success ("metrics enabled sucessfully" )
795+ spinner .Success ("Metrics enabled sucessfully" )
774796
775797 }
776798
@@ -866,7 +888,8 @@ func installCertManagerSlim() {
866888 certManagerSpinner := spinner .New ("Install Cert Manager" )
867889 //certmanagerUrl := "https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml"
868890 certmanagerUrl := "https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yaml"
869- certManagerSpinner .Start ("run command : kubectl create -f " + certmanagerUrl )
891+ cfmt .Println (" run command : kubectl create -f " + certmanagerUrl )
892+ certManagerSpinner .Start ("Installing Cert Manager" )
870893 _ , certManagerErr := exec .Command ("kubectl" , "create" , "-f" , certmanagerUrl ).Output ()
871894 if certManagerErr != nil {
872895 certManagerSpinner .Error ("Failed to run command. Try runnig this command manually: kubectl create -f " + certmanagerUrl )
@@ -931,7 +954,8 @@ func installOLMCertManager() {
931954 }
932955
933956 certManagerSpinner := spinner .New ("Install Cert Manager" )
934- certManagerSpinner .Start ("run command : kubectl create -f https://operatorhub.io/install/cert-manager.yaml" )
957+ cfmt .Println (" run command : kubectl create -f https://operatorhub.io/install/cert-manager.yaml" )
958+ certManagerSpinner .Start ("Installing Cert Manager" )
935959 _ , certManagerErr := exec .Command ("kubectl" , "create" , "-f" , "https://operatorhub.io/install/cert-manager.yaml" ).Output ()
936960 if certManagerErr != nil {
937961 certManagerSpinner .Error ("Failed to run command. Try runnig this command manually: kubectl create -f https://operatorhub.io/install/cert-manager.yaml" )
@@ -960,7 +984,7 @@ func installOLMCertManager() {
960984
961985func writeCLIconfig () {
962986
963- ingressInstall := promptLine ("8) Write the Kubero CLI config" , "[y,n]" , "y " )
987+ ingressInstall := promptLine ("8) Write the Kubero CLI config" , "[y,n]" , "n " )
964988 if ingressInstall != "y" {
965989 return
966990 }
0 commit comments