Skip to content

Commit 437a140

Browse files
committed
improve installation steps
1 parent 425a7c2 commit 437a140

File tree

2 files changed

+54
-40
lines changed

2 files changed

+54
-40
lines changed

cmd/kuberoCli/install.go

Lines changed: 53 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"math/rand"
99
"os"
1010
"os/exec"
11-
"strconv"
1211
"strings"
1312
"time"
1413

@@ -70,17 +69,17 @@ required binaries:
7069
return
7170
case "":
7271
printInstallSteps()
73-
installKubernetes()
74-
checkCluster()
75-
installOLM()
76-
installIngress()
77-
installMetrics()
78-
installCertManager()
79-
installKuberoOperator()
80-
installMonitoring()
81-
installKpack()
82-
installKuberoUi()
83-
writeCLIconfig()
72+
installKubernetes() // 1
73+
checkCluster() //
74+
installOLM() // 2
75+
installKuberoOperator() // 3
76+
installIngress() // 4
77+
installMetrics() // 5
78+
installCertManager() // 6
79+
installMonitoring() // 7
80+
installKpack() // 8
81+
installKuberoUi() // 9
82+
writeCLIconfig() // 10
8483
printDNSinfo()
8584
finalMessage()
8685
return
@@ -146,13 +145,14 @@ func printInstallSteps() {
146145
Steps to install kubero:
147146
1. Create a kubernetes cluster {{(optional)}}::gray
148147
2. Install the OLM {{(optional)}}::gray
149-
3. Install the ingress controller {{(required)}}::gray
150-
4. Install the metrics server {{(optional, but recommended)}}::gray
151-
5. Install the cert-manager {{(optional)}}::gray
152-
6. Install the kubero operator {{(required)}}::gray
148+
3. Install the kubero operator {{(required)}}::gray
149+
4. Install the ingress controller {{(required)}}::gray
150+
5. Install the metrics server {{(optional, but recommended)}}::gray
151+
6. Install the cert-manager {{(optional)}}::gray
153152
7. Install the monitoring stack {{(optional, but recommended)}}::gray
154-
8. Install the kubero UI {{(optional, but highly recommended)}}::gray
155-
9. Write the kubero CLI config
153+
8. Install the buildpacks for buildpacks.io {{(optional)}}::gray
154+
9. Install the kubero UI {{(optional, but highly recommended)}}::gray
155+
10. Write the kubero CLI config
156156
`)
157157
}
158158

@@ -357,7 +357,7 @@ func installMetrics() {
357357
cfmt.Println("{{✓ Metrics is allredy enabled}}::lightGreen")
358358
return
359359
}
360-
install := promptLine("4) Install Kubernetes internal metrics service (required for HPA, Horizontal Pod Autoscaling)", "[y,n]", "y")
360+
install := promptLine("5) Install Kubernetes internal metrics service (required for HPA, Horizontal Pod Autoscaling)", "[y,n]", "y")
361361
if install != "y" {
362362
return
363363
}
@@ -381,7 +381,7 @@ func installIngress() {
381381
return
382382
}
383383

384-
ingressInstall := promptLine("3) Install Ingress", "[y,n]", "y")
384+
ingressInstall := promptLine("4) Install Ingress", "[y,n]", "y")
385385
if ingressInstall != "y" {
386386
return
387387
} else {
@@ -425,7 +425,7 @@ func installIngress() {
425425

426426
func installKuberoOperator() {
427427

428-
cfmt.Println("\n {{6) Install Kubero Operator}}::bold")
428+
cfmt.Println("\n {{3) Install Kubero Operator}}::bold")
429429

430430
kuberoInstalled, _ := exec.Command("kubectl", "get", "operator", "kubero-operator.operators").Output()
431431
if len(kuberoInstalled) > 0 {
@@ -476,14 +476,23 @@ func installKuberoOperatorSlim() {
476476
log.Fatal(kuberoErr)
477477
}
478478

479-
kuberoSpinner.UpdateMessage("Wait for Kubero Operator to be ready")
479+
kuberoSpinner.UpdateMessage("Wait for Kubero Operator CRD's to be installed")
480480
var kuberoWait []byte
481481
for len(kuberoWait) == 0 {
482482
// kubectl api-resources --api-group=application.kubero.dev --no-headers=true
483483
kuberoWait, _ = exec.Command("kubectl", "api-resources", "--api-group=application.kubero.dev", "--no-headers=true").Output()
484484
time.Sleep(1 * time.Second)
485485
}
486+
kuberoSpinner.UpdateMessage("Kubero Operator CRD's installed")
486487

488+
time.Sleep(5 * time.Second)
489+
// kubectl wait --for=condition=available deployment/kubero -n kubero --timeout=180s
490+
kuberoSpinner.UpdateMessage("Wait for Kubero Operator to be ready")
491+
_, olmWaitErr := exec.Command("kubectl", "wait", "--for=condition=available", "deployment/kubero-operator-controller-manager", "-n", "kubero-operator-system", "--timeout=300s").Output()
492+
if olmWaitErr != nil {
493+
kuberoSpinner.Error("Failed to wait for Kubero UI to become ready")
494+
log.Fatal(olmWaitErr)
495+
}
487496
kuberoSpinner.Success("Kubero Operator installed sucessfully")
488497

489498
}
@@ -664,10 +673,13 @@ func installKuberoUi() {
664673
kuberoUIConfig.Spec.Registry.StorageClassName = kuberoUIRegistryStorageClassName
665674
}
666675

667-
kuberoUIRegistryHost := promptLine("Registry domain", "", "")
676+
kuberoUIRegistryHost := promptLine("Registry", "[registry.kubero.mydomain.com]", "")
668677
kuberoUIConfig.Spec.Registry.Host = kuberoUIRegistryHost
669-
kuberoUIRegistryPort := promptLine("Registry port", "", "443")
670-
kuberoUIConfig.Spec.Registry.Port, _ = strconv.Atoi(kuberoUIRegistryPort)
678+
679+
kuberoUIRegistrySubpath := promptLine("Subpath (optional) ", "[example/foo/bar]", "")
680+
kuberoUIConfig.Spec.Registry.Subpath = kuberoUIRegistrySubpath
681+
682+
kuberoUIConfig.Spec.Registry.Port = 443
671683

672684
kuberoUIRegistryUsername := promptLine("Registry username", "", "admin")
673685
kuberoUIConfig.Spec.Registry.Account.Username = kuberoUIRegistryUsername
@@ -751,7 +763,7 @@ func installKuberoUi() {
751763

752764
time.Sleep(5 * time.Second)
753765
// kubectl wait --for=condition=available deployment/kubero -n kubero --timeout=180s
754-
_, olmWaitErr := exec.Command("kubectl", "wait", "--for=condition=available", "deployment/kubero", "-n", "kubero", "--timeout=180s").Output()
766+
_, olmWaitErr := exec.Command("kubectl", "wait", "--for=condition=available", "deployment/kubero", "-n", "kubero", "--timeout=300s").Output()
755767
if olmWaitErr != nil {
756768
kuberoUISpinner.Error("Failed to wait for Kubero UI to become ready")
757769
log.Fatal(olmWaitErr)
@@ -775,23 +787,24 @@ func installMonitoring() {
775787
spinner := spinner.New("enable metrics")
776788
if promptLine("7.1) Create local Prometheus instance", "[y/n]", "y") == "y" {
777789
URL := "https://raw.githubusercontent.com/kubero-dev/kubero-operator/main/config/samples/application_v1alpha1_kuberoprometheus.yaml"
778-
cfmt.Println(" run command : kubectl apply -f " + URL)
790+
cfmt.Println(" run command : kubectl apply -n kubero -f " + URL)
779791
spinner.Start("Installing Prometheus")
780792
_, ingressErr := exec.Command("kubectl", "apply", "-n", "kubero", "-f", URL).Output()
781793
if ingressErr != nil {
782794
spinner.Error("Failed to run command. Try runnig this command manually: kubectl apply -f " + URL)
783795
log.Fatal(ingressErr)
784796
}
785-
786-
spinner.UpdateMessage("Waiting for Prometheus to be ready")
787-
788-
time.Sleep(5 * time.Second)
789-
// kubectl wait --for=condition=available deployment/kubero -n kubero --timeout=180s
790-
_, olmWaitErr := exec.Command("kubectl", "wait", "--for=condition=available", "deployment/kubero-prometheus-server", "-n", "kubero", "--timeout=180s").Output()
791-
if olmWaitErr != nil {
792-
spinner.Error("Failed to wait for Prometheus to become ready")
793-
log.Fatal(olmWaitErr)
794-
}
797+
/*
798+
spinner.UpdateMessage("Waiting for Prometheus to be ready")
799+
800+
time.Sleep(5 * time.Second)
801+
// kubectl wait --for=condition=available deployment/kubero -n kubero --timeout=180s
802+
_, olmWaitErr := exec.Command("kubectl", "wait", "--for=condition=available", "deployment/kubero-prometheus-server", "-n", "kubero", "--timeout=300s").Output()
803+
if olmWaitErr != nil {
804+
spinner.Error("Failed to wait for Prometheus to become ready")
805+
log.Fatal(olmWaitErr)
806+
}
807+
*/
795808
spinner.Success("Prometheus installed sucessfully")
796809
}
797810

@@ -886,7 +899,7 @@ func installMonitoring() {
886899

887900
func installCertManager() {
888901

889-
install := promptLine("5) Install SSL Certmanager", "[y,n]", "y")
902+
install := promptLine("6) Install SSL Certmanager", "[y,n]", "y")
890903
if install != "y" {
891904
return
892905
}
@@ -940,10 +953,10 @@ func installCertManagerClusterissuer(namespace string) {
940953
var certmanagerClusterIssuer CertmanagerClusterIssuer
941954
yaml.Unmarshal(kf.Body(), &certmanagerClusterIssuer)
942955

943-
arg_certmanagerContact := promptLine("5.1) Letsencrypt ACME contact email", "", "[email protected]")
956+
arg_certmanagerContact := promptLine("6.1) Letsencrypt ACME contact email", "", "[email protected]")
944957
certmanagerClusterIssuer.Spec.Acme.Email = arg_certmanagerContact
945958

946-
clusterissuer := promptLine("5.2) Clusterissuer Name", "", "letsencrypt-prod")
959+
clusterissuer := promptLine("6.2) Clusterissuer Name", "", "letsencrypt-prod")
947960
certmanagerClusterIssuer.Metadata.Name = clusterissuer
948961

949962
certmanagerClusterIssuerYaml, _ := yaml.Marshal(certmanagerClusterIssuer)

cmd/kuberoCli/install.types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ type KuberoUIConfig struct {
161161
Enabled bool `yaml:"enabled"`
162162
Create bool `yaml:"create"`
163163
Host string `yaml:"host"`
164+
Subpath string `yaml:"subpath"`
164165
Account struct {
165166
Username string `yaml:"username"`
166167
Password string `yaml:"password"`

0 commit comments

Comments
 (0)