Skip to content

Commit 1fcacbd

Browse files
authored
Merge pull request #41 from kubero-dev/feature/improve-install-procedure
Update prompt messages for better clarity and user interaction.
2 parents e2029d9 + 22da385 commit 1fcacbd

File tree

1 file changed

+75
-67
lines changed

1 file changed

+75
-67
lines changed

cmd/kuberoCli/install.go

Lines changed: 75 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func installOLM() {
259259
return
260260
}
261261

262-
olmInstall := promptLine("2) Install OLM", "[y,n]", "n")
262+
olmInstall := promptLine("2) Install OLM (optional)", "[y,n]", "n")
263263
if olmInstall != "y" {
264264
installOlm = false
265265
return
@@ -493,6 +493,8 @@ func installKuberoUi() {
493493

494494
createNamespace("kubero")
495495

496+
gitops := promptLine("Enable GitOps Feature", "[y,n]", "n")
497+
496498
kuberoSecretInstalled, _ := exec.Command("kubectl", "get", "secret", "kubero-secrets", "-n", "kubero").Output()
497499
if len(kuberoSecretInstalled) > 0 {
498500
_, _ = cfmt.Println("{{✓ Kubero Secret exists}}::lightGreen")
@@ -528,53 +530,56 @@ func installKuberoUi() {
528530
//"--from-literal=KUBERO_USERS="+userDBencoded, // DEPRECATED in v3.0.0
529531
)
530532

531-
githubConfigure := promptLine("Configure Github", "[y,n]", "n")
532-
githubPersonalAccessToken := ""
533-
if githubConfigure == "y" {
534-
githubPersonalAccessToken = promptLine("Github personal access token", "", "")
535-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITHUB_PERSONAL_ACCESS_TOKEN="+githubPersonalAccessToken)
536-
}
533+
if gitops == "y" {
534+
535+
githubConfigure := promptLine("Configure Github", "[y,n]", "n")
536+
githubPersonalAccessToken := ""
537+
if githubConfigure == "y" {
538+
githubPersonalAccessToken = promptLine("Github personal access token", "", "")
539+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITHUB_PERSONAL_ACCESS_TOKEN="+githubPersonalAccessToken)
540+
}
537541

538-
giteaConfigure := promptLine("Configure Gitea", "[y,n]", "n")
539-
giteaPersonalAccessToken := ""
540-
giteaBaseUrl := ""
541-
if giteaConfigure == "y" {
542-
giteaPersonalAccessToken = promptLine("Gitea personal access token", "", "")
543-
giteaBaseUrl = promptLine("Gitea URL", "http://localhost:3000", "")
544-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITEA_PERSONAL_ACCESS_TOKEN="+giteaPersonalAccessToken)
545-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITEA_BASEURL="+giteaBaseUrl)
546-
}
542+
giteaConfigure := promptLine("Configure Gitea", "[y,n]", "n")
543+
giteaPersonalAccessToken := ""
544+
giteaBaseUrl := ""
545+
if giteaConfigure == "y" {
546+
giteaPersonalAccessToken = promptLine("Gitea personal access token", "", "")
547+
giteaBaseUrl = promptLine("Gitea URL", "http://localhost:3000", "")
548+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITEA_PERSONAL_ACCESS_TOKEN="+giteaPersonalAccessToken)
549+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITEA_BASEURL="+giteaBaseUrl)
550+
}
547551

548-
gogsConfigure := promptLine("Configure Gogs", "[y,n]", "n")
549-
gogsPersonalAccessToken := ""
550-
gogsBaseUrl := ""
551-
if gogsConfigure == "y" {
552-
gogsPersonalAccessToken = promptLine("Gogs personal access token", "", "")
553-
gogsBaseUrl = promptLine("Gogs URL", "http://localhost:3000", "")
554-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GOGS_PERSONAL_ACCESS_TOKEN="+gogsPersonalAccessToken)
555-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GOGS_BASEURL="+gogsBaseUrl)
556-
}
552+
gogsConfigure := promptLine("Configure Gogs", "[y,n]", "n")
553+
gogsPersonalAccessToken := ""
554+
gogsBaseUrl := ""
555+
if gogsConfigure == "y" {
556+
gogsPersonalAccessToken = promptLine("Gogs personal access token", "", "")
557+
gogsBaseUrl = promptLine("Gogs URL", "http://localhost:3000", "")
558+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GOGS_PERSONAL_ACCESS_TOKEN="+gogsPersonalAccessToken)
559+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GOGS_BASEURL="+gogsBaseUrl)
560+
}
557561

558-
gitlabConfigure := promptLine("Configure Gitlab", "[y,n]", "n")
559-
gitlabPersonalAccessToken := ""
560-
gitlabBaseUrl := ""
561-
if gitlabConfigure == "y" {
562-
gitlabPersonalAccessToken = promptLine("Gitlab personal access token", "", "")
563-
gitlabBaseUrl = promptLine("Gitlab URL", "http://localhost:3080", "")
564-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITLAB_PERSONAL_ACCESS_TOKEN="+gitlabPersonalAccessToken)
565-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITLAB_BASEURL="+gitlabBaseUrl)
566-
}
562+
gitlabConfigure := promptLine("Configure Gitlab", "[y,n]", "n")
563+
gitlabPersonalAccessToken := ""
564+
gitlabBaseUrl := ""
565+
if gitlabConfigure == "y" {
566+
gitlabPersonalAccessToken = promptLine("Gitlab personal access token", "", "")
567+
gitlabBaseUrl = promptLine("Gitlab URL", "http://localhost:3080", "")
568+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITLAB_PERSONAL_ACCESS_TOKEN="+gitlabPersonalAccessToken)
569+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=GITLAB_BASEURL="+gitlabBaseUrl)
570+
}
567571

568-
bitbucketConfigure := promptLine("Configure Bitbucket", "[y,n]", "n")
569-
bitbucketUsername := ""
570-
bitbucketAppPassword := ""
571-
if bitbucketConfigure == "y" {
572-
bitbucketUsername = promptLine("Bitbucket Username", "", "")
573-
bitbucketAppPassword = promptLine("Bitbucket App Password", "", "")
574-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=BITBUCKET_USERNAME="+bitbucketUsername)
575-
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=BITBUCKET_APP_PASSWORD="+bitbucketAppPassword)
576-
}
572+
bitbucketConfigure := promptLine("Configure Bitbucket", "[y,n]", "n")
573+
bitbucketUsername := ""
574+
bitbucketAppPassword := ""
575+
if bitbucketConfigure == "y" {
576+
bitbucketUsername = promptLine("Bitbucket Username", "", "")
577+
bitbucketAppPassword = promptLine("Bitbucket App Password", "", "")
578+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=BITBUCKET_USERNAME="+bitbucketUsername)
579+
createSecretCommand.Args = append(createSecretCommand.Args, "--from-literal=BITBUCKET_APP_PASSWORD="+bitbucketAppPassword)
580+
}
577581

582+
}
578583
createSecretCommand.Args = append(createSecretCommand.Args, "-n", "kubero")
579584

580585
_, kuberoErr := createSecretCommand.Output()
@@ -630,39 +635,42 @@ func installKuberoUi() {
630635
}
631636
}
632637

633-
kuberoUIRegistry := promptLine("Enable BuildPipeline for Kubero", "[y/n]", "n")
634-
if kuberoUIRegistry == "y" {
635-
kuberoUIConfig.Spec.Registry.Enabled = true
638+
if gitops == "y" {
636639

637-
kuberoUICreateRegistry := promptLine("Create a local Registry for Kubero", "[y/n]", "n")
638-
if kuberoUICreateRegistry == "y" {
639-
kuberoUIConfig.Spec.Registry.Create = true
640+
kuberoUIRegistry := promptLine("Enable Buildpipeline for Kubero (BETA)", "[y/n]", "n")
641+
if kuberoUIRegistry == "y" {
642+
kuberoUIConfig.Spec.Registry.Enabled = true
640643

641-
kuberoUIRegistryStorage := promptLine("Registry storage size", "", "10Gi")
642-
kuberoUIConfig.Spec.Registry.Storage = kuberoUIRegistryStorage
644+
kuberoUICreateRegistry := promptLine("Create a local Registry for Kubero", "[y/n]", "n")
645+
if kuberoUICreateRegistry == "y" {
646+
kuberoUIConfig.Spec.Registry.Create = true
643647

644-
storageClassList := getAvailableStorageClasses()
648+
kuberoUIRegistryStorage := promptLine("Registry storage size", "", "10Gi")
649+
kuberoUIConfig.Spec.Registry.Storage = kuberoUIRegistryStorage
645650

646-
kuberoUIRegistryStorageClassName := selectFromList("Registry storage class", storageClassList, "")
647-
kuberoUIConfig.Spec.Registry.StorageClassName = kuberoUIRegistryStorageClassName
648-
}
651+
storageClassList := getAvailableStorageClasses()
652+
653+
kuberoUIRegistryStorageClassName := selectFromList("Registry storage class", storageClassList, "")
654+
kuberoUIConfig.Spec.Registry.StorageClassName = kuberoUIRegistryStorageClassName
655+
}
649656

650-
kuberoUIRegistryHost := promptLine("Registry", "[registry.kubero.mydomain.com]", "")
651-
kuberoUIConfig.Spec.Registry.Host = kuberoUIRegistryHost
657+
kuberoUIRegistryHost := promptLine("Registry", "[registry.kubero.mydomain.com]", "")
658+
kuberoUIConfig.Spec.Registry.Host = kuberoUIRegistryHost
652659

653-
kuberoUIRegistrySubPath := promptLine("SubPath (optional) ", "[example/foo/bar]", "")
654-
kuberoUIConfig.Spec.Registry.SubPath = kuberoUIRegistrySubPath
660+
kuberoUIRegistrySubpath := promptLine("Subpath (optional) ", "[example/foo/bar]", "")
661+
kuberoUIConfig.Spec.Registry.Subpath = kuberoUIRegistrySubpath
655662

656-
kuberoUIConfig.Spec.Registry.Port = 443
663+
kuberoUIConfig.Spec.Registry.Port = 443
657664

658-
kuberoUIRegistryUsername := promptLine("Registry username", "", "admin")
659-
kuberoUIConfig.Spec.Registry.Account.Username = kuberoUIRegistryUsername
665+
kuberoUIRegistryUsername := promptLine("Registry username", "", "admin")
666+
kuberoUIConfig.Spec.Registry.Account.Username = kuberoUIRegistryUsername
660667

661-
kuberoUIRegistryPassword := promptLine("Registry password", "", generateRandomString(12, ""))
662-
kuberoUIConfig.Spec.Registry.Account.Password = kuberoUIRegistryPassword
668+
kuberoUIRegistryPassword := promptLine("Registry password", "", generateRandomString(12, ""))
669+
kuberoUIConfig.Spec.Registry.Account.Password = kuberoUIRegistryPassword
663670

664-
kuberoUIRegistryPasswordBytes, _ := bcrypt.GenerateFromPassword([]byte(kuberoUIRegistryPassword), 14)
665-
kuberoUIConfig.Spec.Registry.Account.Hash = string(kuberoUIRegistryPasswordBytes)
671+
kuberoUIRegistryPasswordBytes, _ := bcrypt.GenerateFromPassword([]byte(kuberoUIRegistryPassword), 14)
672+
kuberoUIConfig.Spec.Registry.Account.Hash = string(kuberoUIRegistryPasswordBytes)
673+
}
666674
}
667675

668676
/* DEPRECATED in v3.0.0
@@ -882,7 +890,7 @@ func installMonitoring() {
882890

883891
func installCertManager() {
884892

885-
install := promptLine("6) Install SSL CertManager", "[y,n]", "y")
893+
install := promptLine("6) Install SSL Cert Manager", "[y,n]", "y")
886894
if install != "y" {
887895
return
888896
}

0 commit comments

Comments
 (0)