Skip to content

Commit

Permalink
release v2.4.0 (#2118)
Browse files Browse the repository at this point in the history
* release v2.4.0

* release v2.4.0
  • Loading branch information
CristhianF7 authored Mar 14, 2024
1 parent 747a331 commit e46b322
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 73 deletions.
73 changes: 1 addition & 72 deletions internal/launch/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,6 @@ func Up(additionalHelmFlags []string, inCluster bool, useTelemetry bool) {
}
}

dbInitialized := viper.GetBool("launch.database-initialized")
var dbHost, dbUser, dbPassword string

progress.AddStep("Initialize database")

if !dbInitialized {
viper.Set("launch.database-destination", "in-cluster")
viper.Set("launch.database-initialized", true)
viper.WriteConfig()
} else {
log.Info().Msg("Database has already been initialized, skipping")
}

progress.CompleteStep("Initialize database")

log.Info().Msgf("%s/%s", k3d.LocalhostOS, k3d.LocalhostARCH)

progress.AddStep("Download k3d")
Expand Down Expand Up @@ -355,63 +340,7 @@ func Up(additionalHelmFlags []string, inCluster bool, useTelemetry bool) {
}
}

switch viper.GetString("launch.database-destination") {
case "in-cluster":
installFlags = append(installFlags, "--create-namespace")
installFlags = append(installFlags, "--set")
installFlags = append(installFlags, "mongodb.enabled=true")

if k3d.LocalhostARCH == "arm64" {
installFlags = append(installFlags, "--set")
installFlags = append(installFlags, "mongodb.image.repository=arm64v8/mongo,mongodb.image.tag=latest,mongodb.persistence.mountPath=/data/db,mongodb.extraEnvVarsSecret=kubefirst-initial-secrets")
}
case "atlas":
installFlags = append(installFlags, "--set")
installFlags = append(installFlags, "mongodb.enabled=false")
installFlags = append(installFlags, "--set")
installFlags = append(installFlags, fmt.Sprintf("kubefirst-api.existingSecret=%s", secretName))
installFlags = append(installFlags, "--set")
installFlags = append(installFlags, fmt.Sprintf("kubefirst-api.atlasDbHost=%s", dbHost))
installFlags = append(installFlags, "--set")
installFlags = append(installFlags, fmt.Sprintf("kubefirst-api.atlasDbUsername=%s", dbUser))

// Create Namespace
_, err = kcfg.Clientset.CoreV1().Namespaces().Get(context.Background(), namespace, metav1.GetOptions{})
if err == nil {
log.Info().Msg("kubernetes Namespace already created - skipping")
} else if strings.Contains(err.Error(), "not found") {
_, err = kcfg.Clientset.CoreV1().Namespaces().Create(context.Background(), &v1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: namespace,
},
}, metav1.CreateOptions{})
if err != nil {
progress.Error(fmt.Sprintf("error creating kubernetes secret for initial secret: %s", err))
}
log.Info().Msg("Created Kubernetes Namespace for kubefirst")
}

// Create Secret
_, err = kcfg.Clientset.CoreV1().Secrets(namespace).Get(context.Background(), secretName, metav1.GetOptions{})
if err == nil {
log.Info().Msg(fmt.Sprintf("kubernetes secret %s/%s already created - skipping", namespace, secretName))
} else if strings.Contains(err.Error(), "not found") {
_, err = kcfg.Clientset.CoreV1().Secrets(namespace).Create(context.Background(), &v1.Secret{
Type: "Opaque",
ObjectMeta: metav1.ObjectMeta{
Name: secretName,
Namespace: namespace,
},
Data: map[string][]byte{
"mongodb-root-password": []byte(dbPassword),
},
}, metav1.CreateOptions{})
if err != nil {
progress.Error(fmt.Sprintf("error creating kubernetes secret for initial secret: %s", err))
}
log.Info().Msg("Created Kubernetes Secret for database authentication")
}
}
installFlags = append(installFlags, "--create-namespace")

// Install helm chart
a, b, err := pkg.ExecShellReturnStrings(helmClient, installFlags...)
Expand Down
2 changes: 1 addition & 1 deletion internal/launch/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const (
helmChartName = "kubefirst"
helmChartRepoName = "kubefirst"
helmChartRepoURL = "https://charts.kubefirst.com"
helmChartVersion = "2.3.9-rc27"
helmChartVersion = "2.4.0"
namespace = "kubefirst"
secretName = "kubefirst-initial-secrets"
)

0 comments on commit e46b322

Please sign in to comment.