diff --git a/.github/ISSUE_TEMPLATE/bugs.yml b/.github/ISSUE_TEMPLATE/bugs.yml index b1b76a4b0..e870ce36c 100644 --- a/.github/ISSUE_TEMPLATE/bugs.yml +++ b/.github/ISSUE_TEMPLATE/bugs.yml @@ -20,11 +20,13 @@ body: multiple: true options: - None specific + - Akamai - AWS - Civo - DigitalOcean - Google Cloud - k3d (local) + - K3s - Vultr validations: required: true @@ -75,7 +77,7 @@ body: id: os attributes: label: Which Operating System? - description: Please add the architecture in the issue description. If you selected "Others", please specify in the textarea. + description: Please add the architecture in the issue description. If you selected "Other", please specify in the issue. options: - None specific - macOS diff --git a/.github/workflows/check-signed.yml b/.github/workflows/check-signed.yml index f110c7836..ceea37b4b 100644 --- a/.github/workflows/check-signed.yml +++ b/.github/workflows/check-signed.yml @@ -1,14 +1,14 @@ --- -name: Validate if commits in PR are signed -on: pull_request +name: Validate if commits are signed +on: [pull_request, pull_request_target] jobs: signed-commits-check: runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v3.5.3 + - name: Check out the repository code + uses: actions/checkout@v4.1.4 - - name: Check signed commits in PR + - name: Check if the commits are signed uses: 1Password/check-signed-commits-action@v1 diff --git a/README.md b/README.md index 5e9df11ea..e47e03191 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,14 @@ Each of our platforms have install guides that detail the prerequesites, command - [k3d (local)](https://docs.kubefirst.io/k3d/overview/) - [AWS](https://docs.kubefirst.io/aws/overview/) - [Civo](https://docs.kubefirst.io/civo/overview/) +- [DigitalOcean](https://docs.kubefirst.io/do/overview/) In beta: -- [DigitalOcean](https://docs.kubefirst.io/do/overview/) - [Google Cloud](https://docs.kubefirst.io/gcp/overview/) - [Vultr](https://docs.kubefirst.io/vultr/overview/) +- Akamai (docs coming soon) `kubefirst beta akamai create --help` +- K3s (docs coming soon) `kubefirst beta k3s create --help` ## Overview diff --git a/cmd/akamai/create.go b/cmd/akamai/create.go index 1df59c68f..24b2a208d 100644 --- a/cmd/akamai/create.go +++ b/cmd/akamai/create.go @@ -10,6 +10,7 @@ import ( "fmt" "os" + "github.com/rs/zerolog/log" "github.com/kubefirst/kubefirst/internal/catalog" "github.com/kubefirst/kubefirst/internal/cluster" "github.com/kubefirst/kubefirst/internal/gitShim" @@ -18,6 +19,7 @@ import ( "github.com/kubefirst/kubefirst/internal/provision" "github.com/kubefirst/kubefirst/internal/utilities" "github.com/kubefirst/runtime/pkg" + internalssh "github.com/kubefirst/runtime/pkg/ssh" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -106,22 +108,22 @@ func ValidateProvidedFlags(gitProvider string) error { } } - // switch gitProvider { - // case "github": - // key, err := internalssh.GetHostKey("github.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "github.com", key.Type()) - // } - // case "gitlab": - // key, err := internalssh.GetHostKey("gitlab.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) - // } - // } + switch gitProvider { + case "github": + key, err := internalssh.GetHostKey("github.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "github.com", key.Type()) + } + case "gitlab": + key, err := internalssh.GetHostKey("gitlab.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) + } + } progress.CompleteStep("Validate provided flags") diff --git a/cmd/aws/create.go b/cmd/aws/create.go index d34e0875d..2d53f4cd9 100644 --- a/cmd/aws/create.go +++ b/cmd/aws/create.go @@ -20,6 +20,8 @@ import ( "github.com/kubefirst/kubefirst/internal/utilities" "github.com/kubefirst/runtime/pkg" awsinternal "github.com/kubefirst/runtime/pkg/aws" + internalssh "github.com/kubefirst/runtime/pkg/ssh" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -131,22 +133,22 @@ func ValidateProvidedFlags(gitProvider string) error { } } - // switch gitProvider { - // case "github": - // key, err := internalssh.GetHostKey("github.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "github.com", key.Type()) - // } - // case "gitlab": - // key, err := internalssh.GetHostKey("gitlab.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) - // } - // } + switch gitProvider { + case "github": + key, err := internalssh.GetHostKey("github.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "github.com", key.Type()) + } + case "gitlab": + key, err := internalssh.GetHostKey("gitlab.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) + } + } progress.CompleteStep("Validate provided flags") diff --git a/cmd/civo/create.go b/cmd/civo/create.go index 38ab0a6a2..53864b535 100644 --- a/cmd/civo/create.go +++ b/cmd/civo/create.go @@ -18,6 +18,8 @@ import ( "github.com/kubefirst/kubefirst/internal/provision" "github.com/kubefirst/kubefirst/internal/utilities" "github.com/kubefirst/runtime/pkg" + internalssh "github.com/kubefirst/runtime/pkg/ssh" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -106,22 +108,22 @@ func ValidateProvidedFlags(gitProvider string) error { } } - // switch gitProvider { - // case "github": - // key, err := internalssh.GetHostKey("github.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "github.com", key.Type()) - // } - // case "gitlab": - // key, err := internalssh.GetHostKey("gitlab.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) - // } - // } + switch gitProvider { + case "github": + key, err := internalssh.GetHostKey("github.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "github.com", key.Type()) + } + case "gitlab": + key, err := internalssh.GetHostKey("gitlab.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) + } + } progress.CompleteStep("Validate provided flags") diff --git a/cmd/digitalocean/create.go b/cmd/digitalocean/create.go index 5eb03c0be..8d9a1eb79 100644 --- a/cmd/digitalocean/create.go +++ b/cmd/digitalocean/create.go @@ -18,6 +18,8 @@ import ( "github.com/kubefirst/kubefirst/internal/provision" "github.com/kubefirst/kubefirst/internal/utilities" "github.com/kubefirst/runtime/pkg" + internalssh "github.com/kubefirst/runtime/pkg/ssh" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -113,22 +115,22 @@ func ValidateProvidedFlags(gitProvider string) error { } } - // switch gitProvider { - // case "github": - // key, err := internalssh.GetHostKey("github.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "github.com", key.Type()) - // } - // case "gitlab": - // key, err := internalssh.GetHostKey("gitlab.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) - // } - // } + switch gitProvider { + case "github": + key, err := internalssh.GetHostKey("github.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "github.com", key.Type()) + } + case "gitlab": + key, err := internalssh.GetHostKey("gitlab.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) + } + } progress.CompleteStep("Validate provided flags") diff --git a/cmd/google/create.go b/cmd/google/create.go index 22cba021d..ce613c227 100644 --- a/cmd/google/create.go +++ b/cmd/google/create.go @@ -18,6 +18,8 @@ import ( "github.com/kubefirst/kubefirst/internal/provision" "github.com/kubefirst/kubefirst/internal/utilities" "github.com/kubefirst/runtime/pkg" + internalssh "github.com/kubefirst/runtime/pkg/ssh" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" _ "k8s.io/client-go/plugin/pkg/client/auth" @@ -107,22 +109,22 @@ func ValidateProvidedFlags(gitProvider string) error { progress.Error("Unable to read GOOGLE_APPLICATION_CREDENTIALS file") } - // switch gitProvider { - // case "github": - // key, err := internalssh.GetHostKey("github.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "github.com", key.Type()) - // } - // case "gitlab": - // key, err := internalssh.GetHostKey("gitlab.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) - // } - // } + switch gitProvider { + case "github": + key, err := internalssh.GetHostKey("github.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "github.com", key.Type()) + } + case "gitlab": + key, err := internalssh.GetHostKey("gitlab.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) + } + } progress.CompleteStep("Validate provided flags") diff --git a/cmd/vultr/create.go b/cmd/vultr/create.go index 0b8cd873c..0b3a5c2b9 100644 --- a/cmd/vultr/create.go +++ b/cmd/vultr/create.go @@ -18,6 +18,8 @@ import ( "github.com/kubefirst/kubefirst/internal/provision" "github.com/kubefirst/kubefirst/internal/utilities" "github.com/kubefirst/runtime/pkg" + internalssh "github.com/kubefirst/runtime/pkg/ssh" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -112,22 +114,22 @@ func ValidateProvidedFlags(gitProvider string) error { } } - // switch gitProvider { - // case "github": - // key, err := internalssh.GetHostKey("github.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "github.com", key.Type()) - // } - // case "gitlab": - // key, err := internalssh.GetHostKey("gitlab.com") - // if err != nil { - // return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") - // } else { - // log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) - // } - // } + switch gitProvider { + case "github": + key, err := internalssh.GetHostKey("github.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "github.com", key.Type()) + } + case "gitlab": + key, err := internalssh.GetHostKey("gitlab.com") + if err != nil { + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy") + } else { + log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) + } + } progress.CompleteStep("Validate provided flags") diff --git a/images/kubefirst-arch.png b/images/kubefirst-arch.png index 3e5c7036e..b610fcaca 100644 Binary files a/images/kubefirst-arch.png and b/images/kubefirst-arch.png differ diff --git a/internal/common/common.go b/internal/common/common.go index 4b74a533d..c24ac9f0c 100644 --- a/internal/common/common.go +++ b/internal/common/common.go @@ -60,6 +60,7 @@ func CheckForVersionUpdate() { // versionCheck compares local to remote version func versionCheck() (res *CheckResponse, skip bool) { var latestVersion string + flatVersion := strings.ReplaceAll(configs.K1Version, "v", "") resp, err := http.Get("https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/k/kubefirst.rb") @@ -91,10 +92,10 @@ func versionCheck() (res *CheckResponse, skip bool) { latestVersion = matches[1] return &CheckResponse{ - Current: configs.K1Version, - Outdated: latestVersion < configs.K1Version, - Latest: latestVersion == configs.K1Version, - New: configs.K1Version > latestVersion, + Current: flatVersion, + Outdated: latestVersion < flatVersion, + Latest: latestVersion == flatVersion, + New: flatVersion > latestVersion, }, false } diff --git a/internal/launch/cmd.go b/internal/launch/cmd.go index c308a36e6..8fd1bd07e 100644 --- a/internal/launch/cmd.go +++ b/internal/launch/cmd.go @@ -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") @@ -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...) diff --git a/internal/launch/constants.go b/internal/launch/constants.go index 66a15739d..0a63a8ee8 100644 --- a/internal/launch/constants.go +++ b/internal/launch/constants.go @@ -11,7 +11,7 @@ const ( helmChartName = "kubefirst" helmChartRepoName = "kubefirst" helmChartRepoURL = "https://charts.kubefirst.com" - helmChartVersion = "2.3.9-rc27" + helmChartVersion = "2.4.8" namespace = "kubefirst" secretName = "kubefirst-initial-secrets" ) diff --git a/internal/utilities/utilities.go b/internal/utilities/utilities.go index 05ca01d70..fbe03dd6e 100644 --- a/internal/utilities/utilities.go +++ b/internal/utilities/utilities.go @@ -213,6 +213,7 @@ func CreateClusterDefinitionRecordFromRaw(gitAuth apiTypes.GitAuth, cliFlags typ if err != nil { progress.Error("Unable to read GOOGLE_APPLICATION_CREDENTIALS file") } + defer jsonFile.Close() jsonContent, _ := ioutil.ReadAll(jsonFile)