Skip to content

Commit

Permalink
Update current feature
Browse files Browse the repository at this point in the history
  • Loading branch information
fjammes committed Jun 7, 2024
1 parent 8e62ca5 commit ddc7d16
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/k8s-school/ktbx/resources"
)

var install []string

// createCmd represents the create command
var createCmd = &cobra.Command{
Use: "create",
Expand Down Expand Up @@ -47,6 +49,8 @@ func init() {
auditlog := "auditlog"
createCmd.PersistentFlags().BoolP(auditlog, "a", false, "enable audit log inside API server, take precedence over configuration file 'auditlog' parameter")
viper.BindPFlag("kind."+auditlog, createCmd.PersistentFlags().Lookup(auditlog))

createCmd.PersistentFlags().StringSliceVarP(&install, "install", "i", []string{}, "install additional components (olm, argocd, argo-workflow)")
}

func createCluster() {
Expand Down Expand Up @@ -104,4 +108,24 @@ func createCluster() {
slog.Error("kubectl wait failed", "error", err)
os.Exit(1)
}

for _, i := range install {
switch i {
case "olm":
_, _, err = ExecCmd(resources.OlmInstallScript, false)
case "argocd":
_, _, err = ExecCmd(resources.ArgoCDInstallScript, false)
case "argowf":
_, _, err = ExecCmd(resources.ArgoWorkflowInstallScript, false)
case "helm":
_, _, err = ExecCmd(resources.HelmInstallScript, false)
default:
err = fmt.Errorf("unsupported component %s", i)
}
if err != nil {
slog.Error("Error while installing component", "error", err)
os.Exit(1)
}
}

}

0 comments on commit ddc7d16

Please sign in to comment.