Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: post install catalog apps #2090

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/aws/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var (
ecrFlag bool
nodeTypeFlag string
nodeCountFlag string
installCatalogApps string

// RootCredentials
copyArgoCDPasswordToClipboardFlag bool
Expand Down Expand Up @@ -98,6 +99,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
createCmd.Flags().StringVar(&gitopsTemplateURLFlag, "gitops-template-url", "https://github.com/kubefirst/gitops-template.git", "the fully qualified url to the gitops-template repository to clone")
createCmd.Flags().StringVar(&installCatalogApps, "install-catalog-apps", "", "comma seperated values to install after provision")
createCmd.Flags().BoolVar(&useTelemetryFlag, "use-telemetry", true, "whether to emit telemetry")
createCmd.Flags().BoolVar(&ecrFlag, "ecr", false, "whether or not to use ecr vs the git provider")

Expand Down
8 changes: 7 additions & 1 deletion cmd/aws/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"

"github.com/aws/aws-sdk-go/aws"
"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/cluster"
"github.com/kubefirst/kubefirst/internal/gitShim"
"github.com/kubefirst/kubefirst/internal/launch"
Expand All @@ -34,6 +35,11 @@ func createAws(cmd *cobra.Command, args []string) error {

progress.DisplayLogHints(40)

isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps)
if !isValid {
return err
}

err = ValidateProvidedFlags(cliFlags.GitProvider)
if err != nil {
progress.Error(err.Error())
Expand Down Expand Up @@ -112,7 +118,7 @@ func createAws(cmd *cobra.Command, args []string) error {
progress.Error("unable to start kubefirst api")
}

provision.CreateMgmtCluster(gitAuth, cliFlags)
provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps)

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/civo/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var (
useTelemetryFlag bool
nodeTypeFlag string
nodeCountFlag string
installCatalogApps string

// RootCredentials
copyArgoCDPasswordToClipboardFlag bool
Expand Down Expand Up @@ -109,6 +110,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
createCmd.Flags().StringVar(&gitopsTemplateURLFlag, "gitops-template-url", "https://github.com/kubefirst/gitops-template.git", "the fully qualified url to the gitops-template repository to clone")
createCmd.Flags().StringVar(&installCatalogApps, "install-catalog-apps", "", "comma seperated values to install after provision")
createCmd.Flags().BoolVar(&useTelemetryFlag, "use-telemetry", true, "whether to emit telemetry")

return createCmd
Expand Down
14 changes: 7 additions & 7 deletions cmd/civo/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"os"

"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/cluster"
"github.com/kubefirst/kubefirst/internal/gitShim"
"github.com/kubefirst/kubefirst/internal/launch"
Expand All @@ -32,19 +33,18 @@ func createCivo(cmd *cobra.Command, args []string) error {

progress.DisplayLogHints(15)

isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps)
if !isValid {
return err
}

err = ValidateProvidedFlags(cliFlags.GitProvider)
if err != nil {
progress.Error(err.Error())
return nil
}

// If cluster setup is complete, return
clusterSetupComplete := viper.GetBool("kubefirst-checks.cluster-install-complete")
if clusterSetupComplete {
err = fmt.Errorf("this cluster install process has already completed successfully")
progress.Error(err.Error())
return nil
}

utilities.CreateK1ClusterDirectory(clusterNameFlag)

Expand Down Expand Up @@ -88,7 +88,7 @@ func createCivo(cmd *cobra.Command, args []string) error {
progress.Error("unable to start kubefirst api")
}

provision.CreateMgmtCluster(gitAuth, cliFlags)
provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps)

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/digitalocean/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var (
useTelemetryFlag bool
nodeTypeFlag string
nodeCountFlag string
installCatalogApps string

// RootCredentials
copyArgoCDPasswordToClipboardFlag bool
Expand Down Expand Up @@ -102,6 +103,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
createCmd.Flags().StringVar(&gitopsTemplateURLFlag, "gitops-template-url", "https://github.com/kubefirst/gitops-template.git", "the fully qualified url to the gitops-template repository to clone")
createCmd.Flags().StringVar(&installCatalogApps, "install-catalog-apps", "", "comma seperated values to install after provision")
createCmd.Flags().BoolVar(&useTelemetryFlag, "use-telemetry", true, "whether to emit telemetry")

return createCmd
Expand Down
8 changes: 7 additions & 1 deletion cmd/digitalocean/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/rs/zerolog/log"

"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/cluster"
"github.com/kubefirst/kubefirst/internal/gitShim"
"github.com/kubefirst/kubefirst/internal/launch"
Expand All @@ -33,6 +34,11 @@ func createDigitalocean(cmd *cobra.Command, args []string) error {

progress.DisplayLogHints(20)

isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps)
if !isValid {
return err
}

err = ValidateProvidedFlags(cliFlags.GitProvider)
if err != nil {
progress.Error(err.Error())
Expand Down Expand Up @@ -89,7 +95,7 @@ func createDigitalocean(cmd *cobra.Command, args []string) error {
progress.Error("unable to start kubefirst api")
}

provision.CreateMgmtCluster(gitAuth, cliFlags)
provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps)

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/google/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
forceDestroyFlag bool
nodeTypeFlag string
nodeCountFlag string
installCatalogApps string

// RootCredentials
copyArgoCDPasswordToClipboardFlag bool
Expand Down Expand Up @@ -106,6 +107,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
createCmd.Flags().StringVar(&gitopsTemplateURLFlag, "gitops-template-url", "https://github.com/kubefirst/gitops-template.git", "the fully qualified url to the gitops-template repository to clone")
createCmd.Flags().StringVar(&installCatalogApps, "install-catalog-apps", "", "comma seperated values to install after provision")
createCmd.Flags().BoolVar(&useTelemetryFlag, "use-telemetry", true, "whether to emit telemetry")
createCmd.Flags().BoolVar(&forceDestroyFlag, "force-destroy", false, "allows force destruction on objects (helpful for test environments, defaults to false)")
return createCmd
Expand Down
8 changes: 7 additions & 1 deletion cmd/google/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/rs/zerolog/log"

"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/cluster"
"github.com/kubefirst/kubefirst/internal/gitShim"
"github.com/kubefirst/kubefirst/internal/launch"
Expand All @@ -34,6 +35,11 @@ func createGoogle(cmd *cobra.Command, args []string) error {

progress.DisplayLogHints(20)

isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps)
if !isValid {
return err
}

err = ValidateProvidedFlags(cliFlags.GitProvider)
if err != nil {
progress.Error(err.Error())
Expand Down Expand Up @@ -87,7 +93,7 @@ func createGoogle(cmd *cobra.Command, args []string) error {
progress.Error("unable to start kubefirst api")
}

provision.CreateMgmtCluster(gitAuth, cliFlags)
provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps)

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/k3d/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
gitopsTemplateURLFlag string
gitopsTemplateBranchFlag string
useTelemetryFlag bool
installCatalogApps string

// RootCredentials
copyArgoCDPasswordToClipboardFlag bool
Expand Down Expand Up @@ -95,6 +96,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
createCmd.Flags().StringVar(&gitopsTemplateURLFlag, "gitops-template-url", "https://github.com/kubefirst/gitops-template.git", "the fully qualified url to the gitops-template repository to clone")
createCmd.Flags().StringVar(&installCatalogApps, "install-catalog-apps", "", "comma seperated values of catalog apps to install after provision")
createCmd.Flags().BoolVar(&useTelemetryFlag, "use-telemetry", true, "whether to emit telemetry")

return createCmd
Expand Down
13 changes: 12 additions & 1 deletion cmd/k3d/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/kubefirst/kubefirst-api/pkg/handlers"
"github.com/kubefirst/kubefirst-api/pkg/reports"
"github.com/kubefirst/kubefirst-api/pkg/wrappers"
"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/gitShim"
"github.com/kubefirst/kubefirst/internal/segment"
"github.com/kubefirst/kubefirst/internal/utilities"
Expand Down Expand Up @@ -105,6 +106,11 @@ func runK3d(cmd *cobra.Command, args []string) error {
return err
}

installCatalogAppsFlag, err := cmd.Flags().GetString("install-catalog-apps")
if err != nil {
return err
}

useTelemetryFlag, err := cmd.Flags().GetBool("use-telemetry")
if err != nil {
return err
Expand All @@ -119,6 +125,11 @@ func runK3d(cmd *cobra.Command, args []string) error {
utilities.CreateK1ClusterDirectory(clusterNameFlag)
helpers.DisplayLogHints()

isValid, catalogApps, err := catalog.ValidateCatalogApps(installCatalogAppsFlag)
if !isValid {
return err
}

switch gitProviderFlag {
case "github":
key, err := internalssh.GetHostKey("github.com")
Expand Down Expand Up @@ -1349,7 +1360,7 @@ func runK3d(cmd *cobra.Command, args []string) error {
// Set flags used to track status of active options
helpers.SetClusterStatusFlags(k3d.CloudProvider, config.GitProvider)

cluster := utilities.CreateClusterRecordFromRaw(useTelemetryFlag, cGitOwner, cGitUser, cGitToken, cGitlabOwnerGroupID, gitopsTemplateURLFlag, gitopsTemplateBranchFlag)
cluster := utilities.CreateClusterRecordFromRaw(useTelemetryFlag, cGitOwner, cGitUser, cGitToken, cGitlabOwnerGroupID, gitopsTemplateURLFlag, gitopsTemplateBranchFlag, catalogApps)

err = utilities.ExportCluster(cluster, kcfg)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions cmd/vultr/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var (
useTelemetryFlag bool
nodeTypeFlag string
nodeCountFlag string
installCatalogApps string

// RootCredentials
copyArgoCDPasswordToClipboardFlag bool
Expand Down Expand Up @@ -102,6 +103,7 @@ func Create() *cobra.Command {
createCmd.Flags().StringVar(&gitlabGroupFlag, "gitlab-group", "", "the GitLab group for the new gitops and metaphor projects - required if using gitlab")
createCmd.Flags().StringVar(&gitopsTemplateBranchFlag, "gitops-template-branch", "", "the branch to clone for the gitops-template repository")
createCmd.Flags().StringVar(&gitopsTemplateURLFlag, "gitops-template-url", "https://github.com/kubefirst/gitops-template.git", "the fully qualified url to the gitops-template repository to clone")
createCmd.Flags().StringVar(&installCatalogApps, "install-catalog-apps", "", "comma seperated values to install after provision")
createCmd.Flags().BoolVar(&useTelemetryFlag, "use-telemetry", true, "whether to emit telemetry")

return createCmd
Expand Down
8 changes: 7 additions & 1 deletion cmd/vultr/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"os"

"github.com/kubefirst/kubefirst/internal/catalog"
"github.com/kubefirst/kubefirst/internal/cluster"
"github.com/kubefirst/kubefirst/internal/gitShim"
"github.com/kubefirst/kubefirst/internal/launch"
Expand All @@ -33,6 +34,11 @@ func createVultr(cmd *cobra.Command, args []string) error {

progress.DisplayLogHints(15)

isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps)
if !isValid {
return err
}

err = ValidateProvidedFlags(cliFlags.GitProvider)
if err != nil {
progress.Error(err.Error())
Expand Down Expand Up @@ -89,7 +95,7 @@ func createVultr(cmd *cobra.Command, args []string) error {
progress.Error("unable to start kubefirst api")
}

provision.CreateMgmtCluster(gitAuth, cliFlags)
provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps)

return nil
}
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/dustin/go-humanize v1.0.1
github.com/go-git/go-git/v5 v5.6.1
github.com/hashicorp/vault/api v1.9.0
github.com/kubefirst/kubefirst-api v0.1.9
github.com/kubefirst/kubefirst-api v0.1.11
github.com/kubefirst/metrics-client v0.3.0
github.com/kubefirst/runtime v0.4.0
github.com/nxadm/tail v1.4.8
Expand Down Expand Up @@ -222,6 +222,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-github/v52 v52.0.0
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI=
github.com/google/go-github/v45 v45.2.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28=
github.com/google/go-github/v52 v52.0.0 h1:uyGWOY+jMQ8GVGSX8dkSwCzlehU3WfdxQ7GweO/JP7M=
github.com/google/go-github/v52 v52.0.0/go.mod h1:WJV6VEEUPuMo5pXqqa2ZCZEdbQqua4zAk2MZTIo+m+4=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down Expand Up @@ -719,8 +721,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubefirst/kubefirst-api v0.1.9 h1:HCPO2usOW64NS3B/zRL84qfADBNFfcbeKd3yWdbvf8I=
github.com/kubefirst/kubefirst-api v0.1.9/go.mod h1:hik4k99JDLrxxh25jYt6eYxYPhIodX1yxb4gh5tfJ3U=
github.com/kubefirst/kubefirst-api v0.1.11 h1:nRq0y40StwBCL/YwjzHXAURN+/SA63g6pzvQjAxgdOk=
github.com/kubefirst/kubefirst-api v0.1.11/go.mod h1:pAcgIJVYRvRldNMcdIbhcIuHeM+euNlfKVEd/JNS6c8=
github.com/kubefirst/metrics-client v0.3.0 h1:zCug82pEzeWhHhpeYQvdhytRNDxrLxX18dPQ5PSxY3s=
github.com/kubefirst/metrics-client v0.3.0/go.mod h1:GR7wsMcyYhd+EU67PeuMCBYFE6OJ7P/j5OI5BLOoRMc=
github.com/kubefirst/runtime v0.4.0 h1:BQzls1f6l5kV0uDcjp71GwM1x6xl3czX0jGkUu3e2AQ=
Expand Down
Loading
Loading