diff --git a/cmd/akamai/command.go b/cmd/akamai/command.go new file mode 100644 index 000000000..11a28fe21 --- /dev/null +++ b/cmd/akamai/command.go @@ -0,0 +1,132 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package akamai + +import ( + "fmt" + + "github.com/kubefirst/kubefirst-api/pkg/constants" + "github.com/kubefirst/kubefirst/internal/common" + "github.com/kubefirst/kubefirst/internal/progress" + "github.com/spf13/cobra" +) + +var ( + // Create + alertsEmailFlag string + ciFlag bool + cloudRegionFlag string + clusterNameFlag string + clusterTypeFlag string + dnsProviderFlag string + subdomainNameFlag string + domainNameFlag string + githubOrgFlag string + gitlabGroupFlag string + gitProviderFlag string + gitProtocolFlag string + gitopsTemplateURLFlag string + gitopsTemplateBranchFlag string + useTelemetryFlag bool + nodeTypeFlag string + nodeCountFlag string + installCatalogApps string + + // RootCredentials + copyArgoCDPasswordToClipboardFlag bool + copyKbotPasswordToClipboardFlag bool + copyVaultPasswordToClipboardFlag bool + + // Supported providers + supportedDNSProviders = []string{"cloudflare"} + supportedGitProviders = []string{"github", "gitlab"} + // Supported git protocols + supportedGitProtocolOverride = []string{"https", "ssh"} +) + +func NewCommand() *cobra.Command { + akamaiCmd := &cobra.Command{ + Use: "akamai", + Short: "kubefirst akamai installation", + Long: "kubefirst akamai", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("To learn more about akamai in kubefirst, run:") + fmt.Println(" kubefirst akamai --help") + + if progress.Progress != nil { + progress.Progress.Quit() + } + }, + } + + // wire up new commands + akamaiCmd.AddCommand(Create(), Destroy(), RootCredentials()) + + return akamaiCmd +} + +func Create() *cobra.Command { + createCmd := &cobra.Command{ + Use: "create", + Short: "create the kubefirst platform running on akamai kubernetes", + TraverseChildren: true, + RunE: createAkamai, + } + + akamaiDefaults := constants.GetCloudDefaults().Akamai + + // todo review defaults and update descriptions + createCmd.Flags().StringVar(&alertsEmailFlag, "alerts-email", "", "email address for let's encrypt certificate notifications (required)") + createCmd.MarkFlagRequired("alerts-email") + createCmd.Flags().BoolVar(&ciFlag, "ci", false, "if running kubefirst in ci, set this flag to disable interactive features") + createCmd.Flags().StringVar(&cloudRegionFlag, "cloud-region", "us-central", "the akamai region to provision infrastructure in") + createCmd.Flags().StringVar(&clusterNameFlag, "cluster-name", "kubefirst", "the name of the cluster to create") + createCmd.Flags().StringVar(&clusterTypeFlag, "cluster-type", "mgmt", "the type of cluster to create (i.e. mgmt|workload)") + createCmd.Flags().StringVar(&nodeCountFlag, "node-count", akamaiDefaults.NodeCount, "the node count for the cluster") + createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", akamaiDefaults.InstanceSize, "the instance size of the cluster to create") + createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "cloudflare", fmt.Sprintf("the dns provider - one of: %s", supportedDNSProviders)) + createCmd.Flags().StringVar(&subdomainNameFlag, "subdomain", "", "the subdomain to use for DNS records (Cloudflare)") + createCmd.Flags().StringVar(&domainNameFlag, "domain-name", "", "the DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)") + createCmd.MarkFlagRequired("domain-name") + createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders)) + createCmd.Flags().StringVar(&gitProtocolFlag, "git-protocol", "https", fmt.Sprintf("the git protocol - one of: %s", supportedGitProtocolOverride)) + createCmd.Flags().StringVar(&githubOrgFlag, "github-org", "", "the GitHub organization for the new gitops and metaphor repositories - required if using github") + 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 +} + +func Destroy() *cobra.Command { + destroyCmd := &cobra.Command{ + Use: "destroy", + Short: "destroy the kubefirst platform", + Long: "destroy the kubefirst platform running in akamai and remove all resources", + RunE: common.Destroy, + // PreRun: common.CheckDocker, + } + + return destroyCmd +} + +func RootCredentials() *cobra.Command { + authCmd := &cobra.Command{ + Use: "root-credentials", + Short: "retrieve root authentication information for platform components", + Long: "retrieve root authentication information for platform components", + RunE: common.GetRootCredentials, + } + + authCmd.Flags().BoolVar(©ArgoCDPasswordToClipboardFlag, "argocd", false, "copy the argocd password to the clipboard (optional)") + authCmd.Flags().BoolVar(©KbotPasswordToClipboardFlag, "kbot", false, "copy the kbot password to the clipboard (optional)") + authCmd.Flags().BoolVar(©VaultPasswordToClipboardFlag, "vault", false, "copy the vault password to the clipboard (optional)") + + return authCmd +} diff --git a/cmd/akamai/create.go b/cmd/akamai/create.go new file mode 100644 index 000000000..7dbf8ff74 --- /dev/null +++ b/cmd/akamai/create.go @@ -0,0 +1,128 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package akamai + +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/progress" + "github.com/kubefirst/kubefirst/internal/provision" + "github.com/kubefirst/kubefirst/internal/utilities" + "github.com/kubefirst/runtime/pkg" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func createAkamai(cmd *cobra.Command, args []string) error { + cliFlags, err := utilities.GetFlags(cmd, "akamai") + if err != nil { + progress.Error(err.Error()) + return nil + } + + 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 + + utilities.CreateK1ClusterDirectory(clusterNameFlag) + + gitAuth, err := gitShim.ValidateGitCredentials(cliFlags.GitProvider, cliFlags.GithubOrg, cliFlags.GitlabGroup) + + if err != nil { + progress.Error(err.Error()) + return nil + } + + // Validate git + executionControl := viper.GetBool(fmt.Sprintf("kubefirst-checks.%s-credentials", cliFlags.GitProvider)) + if !executionControl { + newRepositoryNames := []string{"gitops", "metaphor"} + newTeamNames := []string{"admins", "developers"} + + initGitParameters := gitShim.GitInitParameters{ + GitProvider: cliFlags.GitProvider, + GitToken: gitAuth.Token, + GitOwner: gitAuth.Owner, + Repositories: newRepositoryNames, + Teams: newTeamNames, + } + + err = gitShim.InitializeGitProvider(&initGitParameters) + if err != nil { + progress.Error(err.Error()) + return nil + } + } + viper.Set(fmt.Sprintf("kubefirst-checks.%s-credentials", cliFlags.GitProvider), true) + viper.WriteConfig() + + // k3dClusterCreationComplete := viper.GetBool("launch.deployed") + // if !k3dClusterCreationComplete { + // launch.Up(nil, true, cliFlags.UseTelemetry) + // } + + err = pkg.IsAppAvailable(fmt.Sprintf("%s/api/proxyHealth", cluster.GetConsoleIngresUrl()), "kubefirst api") + if err != nil { + progress.Error("unable to start kubefirst api") + } + + provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps) + + return nil +} + +func ValidateProvidedFlags(gitProvider string) error { + progress.AddStep("Validate provided flags") + + if os.Getenv("LINODE_TOKEN") == "" { + // telemetryShim.Transmit(useTelemetryFlag, segmentClient, segment.MetricCloudCredentialsCheckFailed, "LINODE_TOKEN environment variable was not set") + return fmt.Errorf("your LINODE_TOKEN is not set - please set and re-run your last command") + } + + // Validate required environment variables for dns provider + if dnsProviderFlag == "cloudflare" { + if os.Getenv("CF_API_TOKEN") == "" { + return fmt.Errorf("your CF_API_TOKEN environment variable is not set. Please set and try again") + } + } + + // 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") + + return nil +} diff --git a/cmd/aws/create.go b/cmd/aws/create.go index 2d53f4cd9..d34e0875d 100644 --- a/cmd/aws/create.go +++ b/cmd/aws/create.go @@ -20,8 +20,6 @@ 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" ) @@ -133,22 +131,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/beta.go b/cmd/beta.go index 2bf670435..02bafc654 100644 --- a/cmd/beta.go +++ b/cmd/beta.go @@ -9,6 +9,7 @@ package cmd import ( "fmt" + "github.com/kubefirst/kubefirst/cmd/akamai" "github.com/kubefirst/kubefirst/cmd/google" "github.com/kubefirst/kubefirst/cmd/k3s" "github.com/kubefirst/kubefirst/cmd/vultr" @@ -34,6 +35,7 @@ var betaCmd = &cobra.Command{ func init() { cobra.OnInitialize() betaCmd.AddCommand( + akamai.NewCommand(), k3s.NewCommand(), google.NewCommand(), vultr.NewCommand(), diff --git a/cmd/civo/create.go b/cmd/civo/create.go index 53864b535..38ab0a6a2 100644 --- a/cmd/civo/create.go +++ b/cmd/civo/create.go @@ -18,8 +18,6 @@ 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" ) @@ -108,22 +106,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 33e0f38ac..5eb03c0be 100644 --- a/cmd/digitalocean/create.go +++ b/cmd/digitalocean/create.go @@ -10,8 +10,6 @@ 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" @@ -20,7 +18,6 @@ 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" ) @@ -116,22 +113,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 87f393c10..22cba021d 100644 --- a/cmd/google/create.go +++ b/cmd/google/create.go @@ -10,8 +10,6 @@ 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" @@ -20,7 +18,6 @@ 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" _ "k8s.io/client-go/plugin/pkg/client/auth" @@ -110,22 +107,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/k3d/create.go b/cmd/k3d/create.go index 547e7520e..cdf3f1e36 100644 --- a/cmd/k3d/create.go +++ b/cmd/k3d/create.go @@ -42,7 +42,6 @@ import ( "github.com/kubefirst/runtime/pkg/k8s" "github.com/kubefirst/runtime/pkg/progressPrinter" "github.com/kubefirst/runtime/pkg/services" - internalssh "github.com/kubefirst/runtime/pkg/ssh" "github.com/kubefirst/runtime/pkg/terraform" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" @@ -130,22 +129,22 @@ func runK3d(cmd *cobra.Command, args []string) error { return err } - switch gitProviderFlag { - 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 gitProviderFlag { + // 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()) + // } + // } // Either user or org can be specified for github, not both if githubOrgFlag != "" && githubUserFlag != "" { @@ -450,11 +449,11 @@ func runK3d(cmd *cobra.Command, args []string) error { telemetry.SendEvent(segClient, telemetry.KbotSetupStarted, "") log.Info().Msg("creating an ssh key pair for your new cloud infrastructure") - sshPrivateKey, sshPublicKey, err = internalssh.CreateSshKeyPair() - if err != nil { - telemetry.SendEvent(segClient, telemetry.KbotSetupFailed, err.Error()) - return err - } + // sshPrivateKey, sshPublicKey, err = internalssh.CreateSshKeyPair() + // if err != nil { + // telemetry.SendEvent(segClient, telemetry.KbotSetupFailed, err.Error()) + // return err + // } log.Info().Msg("ssh key pair creation complete") viper.Set("kbot.private-key", sshPrivateKey) @@ -702,14 +701,14 @@ func runK3d(cmd *cobra.Command, args []string) error { log.Info().Msgf("error opening repo at: %s", config.MetaphorDir) } - err = internalssh.EvalSSHKey(&internalssh.EvalSSHKeyRequest{ - GitProvider: gitProviderFlag, - GitlabGroupFlag: gitlabGroupFlag, - GitToken: cGitToken, - }) - if err != nil { - return err - } + // err = internalssh.EvalSSHKey(&internalssh.EvalSSHKeyRequest{ + // GitProvider: gitProviderFlag, + // GitlabGroupFlag: gitlabGroupFlag, + // GitToken: cGitToken, + // }) + // if err != nil { + // return err + // } //Push to remotes and use https // Push gitops repo to remote diff --git a/cmd/vultr/create.go b/cmd/vultr/create.go index 0b3a5c2b9..0b8cd873c 100644 --- a/cmd/vultr/create.go +++ b/cmd/vultr/create.go @@ -18,8 +18,6 @@ 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" @@ -114,22 +112,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/go.mod b/go.mod index f02a6f52e..4e3609b41 100644 --- a/go.mod +++ b/go.mod @@ -168,7 +168,7 @@ require ( github.com/yuin/goldmark-emoji v1.0.1 // indirect go.opencensus.io v0.24.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect - golang.org/x/crypto v0.12.0 // indirect + golang.org/x/crypto v0.20.0 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/tools v0.12.0 // indirect @@ -221,7 +221,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect 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-cmp v0.6.0 // 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 @@ -264,11 +264,11 @@ require ( github.com/spf13/pflag v1.0.5 github.com/subosito/gotenv v1.4.2 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - golang.org/x/net v0.14.0 // indirect + golang.org/x/net v0.21.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.11.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.17.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/go.sum b/go.sum index 6b6f826a3..509bb66a7 100644 --- a/go.sum +++ b/go.sum @@ -528,8 +528,9 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -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-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/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= @@ -1236,8 +1237,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= +golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1362,8 +1363,8 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1501,8 +1502,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1512,8 +1513,8 @@ golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1529,8 +1530,8 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/internal/utilities/utilities.go b/internal/utilities/utilities.go index fe9222c2a..47651ed75 100644 --- a/internal/utilities/utilities.go +++ b/internal/utilities/utilities.go @@ -189,14 +189,16 @@ func CreateClusterDefinitionRecordFromRaw(gitAuth apiTypes.GitAuth, cliFlags typ } switch cloudProvider { - case "civo": - cl.CivoAuth.Token = os.Getenv("CIVO_TOKEN") + case "akamai": + cl.AkamaiAuth.Token = os.Getenv("LINODE_TOKEN") case "aws": // ToDo: where to get credentials? cl.AWSAuth.AccessKeyID = viper.GetString("kubefirst.state-store-creds.access-key-id") cl.AWSAuth.SecretAccessKey = viper.GetString("kubefirst.state-store-creds.secret-access-key-id") cl.AWSAuth.SessionToken = viper.GetString("kubefirst.state-store-creds.token") cl.ECR = cliFlags.Ecr + case "civo": + cl.CivoAuth.Token = os.Getenv("CIVO_TOKEN") case "digitalocean": cl.DigitaloceanAuth.Token = os.Getenv("DO_TOKEN") cl.DigitaloceanAuth.SpacesKey = os.Getenv("DO_SPACES_KEY")