From 3225e4f5bff6181abcfe0722aacb4cffa5ef9162 Mon Sep 17 00:00:00 2001 From: Patrick D'appollonio <930925+patrickdappollonio@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:01:01 -0400 Subject: [PATCH 1/3] Remove unused functions. Bump to Go 1.23. Run `gofmt` on all files. --- cmd/akamai/create.go | 25 ++++++++-------- cmd/civo/quota.go | 1 - cmd/k3d/create.go | 25 ++++++++-------- cmd/k3d/destroy.go | 2 +- go.mod | 6 +--- go.sum | 21 ++++++++------ internal/common/common.go | 13 --------- internal/gitShim/containerRegistryAuth.go | 1 - internal/launch/cmd.go | 2 +- internal/progress/message.go | 3 +- internal/provisionLogs/message.go | 31 -------------------- internal/utilities/utilities.go | 35 ----------------------- main.go | 6 ++-- 13 files changed, 45 insertions(+), 126 deletions(-) delete mode 100644 internal/provisionLogs/message.go diff --git a/cmd/akamai/create.go b/cmd/akamai/create.go index ed0177ce..dcf6b83f 100644 --- a/cmd/akamai/create.go +++ b/cmd/akamai/create.go @@ -29,20 +29,20 @@ func createAkamai(cmd *cobra.Command, args []string) error { cliFlags, err := utilities.GetFlags(cmd, "akamai") if err != nil { progress.Error(err.Error()) - return nil + return fmt.Errorf("failed to get flags: %w", err) } progress.DisplayLogHints(25) isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) if !isValid { - return err + return fmt.Errorf("catalog validation failed: %w", err) } err = ValidateProvidedFlags(cliFlags.GitProvider) if err != nil { progress.Error(err.Error()) - return nil + return fmt.Errorf("failed to validate provided flags: %w", err) } // If cluster setup is complete, return @@ -52,7 +52,7 @@ func createAkamai(cmd *cobra.Command, args []string) error { gitAuth, err := gitShim.ValidateGitCredentials(cliFlags.GitProvider, cliFlags.GithubOrg, cliFlags.GitlabGroup) if err != nil { progress.Error(err.Error()) - return nil + return fmt.Errorf("failed to validate git credentials: %w", err) } // Validate git @@ -72,11 +72,13 @@ func createAkamai(cmd *cobra.Command, args []string) error { err = gitShim.InitializeGitProvider(&initGitParameters) if err != nil { progress.Error(err.Error()) - return nil + return fmt.Errorf("failed to initialize git provider: %w", err) } } viper.Set(fmt.Sprintf("kubefirst-checks.%s-credentials", cliFlags.GitProvider), true) - viper.WriteConfig() + if err := viper.WriteConfig(); err != nil { + return fmt.Errorf("failed to write viper config: %w", err) + } k3dClusterCreationComplete := viper.GetBool("launch.deployed") isK1Debug := strings.ToLower(os.Getenv("K1_LOCAL_DEBUG")) == "true" @@ -88,10 +90,10 @@ func createAkamai(cmd *cobra.Command, args []string) error { err = pkg.IsAppAvailable(fmt.Sprintf("%s/api/proxyHealth", cluster.GetConsoleIngresUrl()), "kubefirst api") if err != nil { progress.Error("unable to start kubefirst api") + return fmt.Errorf("failed to check kubefirst api availability: %w", err) } provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps) - return nil } @@ -99,7 +101,6 @@ 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") } @@ -114,16 +115,16 @@ func ValidateProvidedFlags(gitProvider string) error { 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") + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan github.com >> ~/.ssh/known_hosts` to remedy: %w", err) } else { - log.Info().Msgf("%s %s\n", "github.com", key.Type()) + log.Info().Msgf("%q %s", "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") + return fmt.Errorf("known_hosts file does not exist - please run `ssh-keyscan gitlab.com >> ~/.ssh/known_hosts` to remedy: %w", err) } else { - log.Info().Msgf("%s %s\n", "gitlab.com", key.Type()) + log.Info().Msgf("%q %s", "gitlab.com", key.Type()) } } diff --git a/cmd/civo/quota.go b/cmd/civo/quota.go index a4f5eef3..8107528f 100644 --- a/cmd/civo/quota.go +++ b/cmd/civo/quota.go @@ -81,7 +81,6 @@ func returnCivoQuotaEvaluation(cloudRegion string) (string, int, int, error) { if err != nil { log.Info().Msgf("failed to fetch civo quota: %s", err) return "", 0, 0, err - } // Container for quota response as a map diff --git a/cmd/k3d/create.go b/cmd/k3d/create.go index dd60016a..0749ff7c 100644 --- a/cmd/k3d/create.go +++ b/cmd/k3d/create.go @@ -303,7 +303,7 @@ func runK3d(cmd *cobra.Command, args []string) error { // todo // Since it's possible to stop and restart, cGitOwner may need to be reset - //if cGitOwner == "" { + // if cGitOwner == "" { // switch gitProviderFlag { // case "github": // cGitOwner = viper.GetString("flags.github-owner") @@ -520,7 +520,7 @@ func runK3d(cmd *cobra.Command, args []string) error { gitopsDirectoryTokens.UseTelemetry = "false" } - //* generate http credentials for git auth over https + // * generate http credentials for git auth over https httpAuth := &githttps.BasicAuth{ Username: cGitUser, Password: cGitToken, @@ -530,7 +530,7 @@ func runK3d(cmd *cobra.Command, args []string) error { log.Info().Msgf("generate public keys failed: %s\n", err.Error()) } - //* download dependencies to `$HOME/.k1/tools` + // * download dependencies to `$HOME/.k1/tools` if !viper.GetBool("kubefirst-checks.tools-downloaded") { log.Info().Msg("installing kubefirst dependencies") @@ -557,7 +557,7 @@ func runK3d(cmd *cobra.Command, args []string) error { MetaphorProductionIngressURL: fmt.Sprintf("metaphor-production.%s", k3d.DomainName), } - //* git clone and detokenize the gitops repository + // * git clone and detokenize the gitops repository // todo improve this logic for removing `kubefirst clean` // if !viper.GetBool("template-repo.gitops.cloned") || viper.GetBool("template-repo.gitops.removed") { progressPrinter.IncrementTracker("preflight-checks", 1) @@ -683,7 +683,7 @@ func runK3d(cmd *cobra.Command, args []string) error { } } - //* push detokenized gitops-template repository content to new remote + // * push detokenized gitops-template repository content to new remote progressPrinter.AddTracker("pushing-gitops-repos-upstream", "Pushing git repositories", 1) progressPrinter.SetupProgress(progressPrinter.TotalOfTrackers(), false) @@ -756,7 +756,7 @@ func runK3d(cmd *cobra.Command, args []string) error { progressPrinter.IncrementTracker("pushing-gitops-repos-upstream", 1) } - //* create k3d resources + // * create k3d resources progressPrinter.AddTracker("creating-k3d-cluster", "Creating k3d cluster", 1) progressPrinter.SetupProgress(progressPrinter.TotalOfTrackers(), false) @@ -905,7 +905,7 @@ func runK3d(cmd *cobra.Command, args []string) error { progressPrinter.SetupProgress(progressPrinter.TotalOfTrackers(), false) argoCDInstallPath := fmt.Sprintf("github.com:konstructio/manifests/argocd/k3d?ref=%s", constants.KubefirstManifestRepoRef) - //* install argo + // * install argo executionControl = viper.GetBool("kubefirst-checks.argocd-install") if !executionControl { telemetry.SendEvent(segClient, telemetry.ArgoCDInstallStarted, "") @@ -944,7 +944,7 @@ func runK3d(cmd *cobra.Command, args []string) error { } var argocdPassword string - //* argocd pods are ready, get and set credentials + // * argocd pods are ready, get and set credentials executionControl = viper.GetBool("kubefirst-checks.argocd-credentials-set") if !executionControl { log.Info().Msg("Setting argocd username and password credentials") @@ -1024,7 +1024,7 @@ func runK3d(cmd *cobra.Command, args []string) error { } } - //* argocd sync registry and start sync waves + // * argocd sync registry and start sync waves executionControl = viper.GetBool("kubefirst-checks.argocd-create-registry") if !executionControl { telemetry.SendEvent(segClient, telemetry.CreateRegistryStarted, "") @@ -1186,7 +1186,7 @@ func runK3d(cmd *cobra.Command, args []string) error { progressPrinter.IncrementTracker("configuring-vault", 1) - //* configure vault with terraform + // * configure vault with terraform //* vault port-forward vaultStopChannel := make(chan struct{}, 1) defer func() { @@ -1227,7 +1227,7 @@ func runK3d(cmd *cobra.Command, args []string) error { ) } - //* configure vault with terraform + // * configure vault with terraform executionControl = viper.GetBool("kubefirst-checks.terraform-apply-vault") if !executionControl { telemetry.SendEvent(segClient, telemetry.VaultTerraformApplyStarted, "") @@ -1244,7 +1244,6 @@ func runK3d(cmd *cobra.Command, args []string) error { } else { usernamePasswordString = fmt.Sprintf("%s:%s", cGitUser, cGitToken) base64DockerAuth = base64.StdEncoding.EncodeToString([]byte(usernamePasswordString)) - } log.Info().Msg("configuring vault with terraform") @@ -1286,7 +1285,7 @@ func runK3d(cmd *cobra.Command, args []string) error { progressPrinter.IncrementTracker("configuring-vault", 1) } - //* create users + // * create users progressPrinter.AddTracker("creating-users", "Creating users", 1) progressPrinter.SetupProgress(progressPrinter.TotalOfTrackers(), false) diff --git a/cmd/k3d/destroy.go b/cmd/k3d/destroy.go index 3a3782b1..55c2ab61 100644 --- a/cmd/k3d/destroy.go +++ b/cmd/k3d/destroy.go @@ -226,7 +226,7 @@ func destroyK3d(cmd *cobra.Command, args []string) error { } } - //* remove local content and kubefirst config file for re-execution + // * remove local content and kubefirst config file for re-execution if !viper.GetBool(fmt.Sprintf("kubefirst-checks.terraform-apply-%s", gitProvider)) && !viper.GetBool("kubefirst-checks.create-k3d-cluster") { log.Info().Msg("removing previous platform content") diff --git a/go.mod b/go.mod index 27aba6c9..baecf0bf 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/konstructio/kubefirst -go 1.18 +go 1.23 require ( github.com/argoproj/argo-cd/v2 v2.6.7 @@ -86,9 +86,6 @@ require ( github.com/digitalocean/godo v1.98.0 // indirect github.com/dlclark/regexp2 v1.4.0 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect - github.com/docker/docker v23.0.5+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect - github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.10.1 // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect @@ -144,7 +141,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect github.com/otiai10/copy v1.7.0 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect diff --git a/go.sum b/go.sum index 2e67aec7..e83c3241 100644 --- a/go.sum +++ b/go.sum @@ -114,7 +114,9 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= +github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.23.1 h1:jR6wZggBxwWygeXcdNyguCOCIjPsZyNUNlAkTx2fu0U= +github.com/alicebob/miniredis/v2 v2.23.1/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -218,6 +220,7 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bombsimon/logrusr/v2 v2.0.1 h1:1VgxVNQMCvjirZIYaT9JYn6sAVGVEcNtRE0y4mvaOAM= github.com/bombsimon/logrusr/v2 v2.0.1/go.mod h1:ByVAX+vHdLGAfdroiMg6q0zgq2FODY2lc5YJvzmOJio= @@ -317,6 +320,7 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -337,13 +341,9 @@ github.com/docker/distribution v2.8.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE= github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -395,6 +395,7 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -552,6 +553,7 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -616,6 +618,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v1.3.0 h1:G0ACM8Z2WilWgPv3Vdzwm3V0BQu/kSmrkVtpe1fy9do= +github.com/hashicorp/go-hclog v1.3.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= @@ -728,6 +731,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 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= @@ -735,6 +739,7 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= @@ -838,7 +843,6 @@ github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwd github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34= @@ -883,6 +887,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= @@ -915,8 +920,6 @@ github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWEr github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8= -github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.0/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.1/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -1017,6 +1020,7 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.4.0 h1:qd7wPTDkN6KQx2VmMBLrpHkiyQwgFXRnkOLacUiaSNY= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -1111,6 +1115,7 @@ github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= @@ -1167,6 +1172,7 @@ github.com/yuin/goldmark v1.5.2/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5ta github.com/yuin/goldmark-emoji v1.0.1 h1:ctuWEyzGBwiucEqxzwe0SOYDXPAucOrE9NQC18Wa1os= github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGjRIBbIZQFqkQ= github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 h1:5mLPGnFdSsevFRFc9q3yYbBkB6tsm4aCwwQV/j1JQAQ= +github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= @@ -1815,7 +1821,6 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= -gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/common/common.go b/internal/common/common.go index f019cb5c..edcac37d 100644 --- a/internal/common/common.go +++ b/internal/common/common.go @@ -16,7 +16,6 @@ import ( "strings" "github.com/konstructio/kubefirst-api/pkg/configs" - "github.com/konstructio/kubefirst-api/pkg/docker" "github.com/konstructio/kubefirst-api/pkg/providerConfigs" "github.com/konstructio/kubefirst/internal/cluster" "github.com/konstructio/kubefirst/internal/launch" @@ -186,15 +185,3 @@ https://docs.kubefirst.io/` + cloudProvider + `/deprovision return nil } - -// checkDocker makes sure Docker is running before all commands -func CheckDocker(cmd *cobra.Command, args []string) { - // Verify Docker is running - dcli := docker.DockerClientWrapper{ - Client: docker.NewDockerClient(), - } - _, err := dcli.CheckDockerReady() - if err != nil { - progress.Error(fmt.Sprintf("Docker must be running to use this command. Error checking Docker status: %s", err)) - } -} diff --git a/internal/gitShim/containerRegistryAuth.go b/internal/gitShim/containerRegistryAuth.go index 0469428a..660429f0 100644 --- a/internal/gitShim/containerRegistryAuth.go +++ b/internal/gitShim/containerRegistryAuth.go @@ -35,7 +35,6 @@ type ContainerRegistryAuth struct { func CreateContainerRegistrySecret(obj *ContainerRegistryAuth) (string, error) { // Handle secret creation for container registry authentication switch obj.GitProvider { - // GitHub docker auth secret // kaniko requires a specific format for Docker auth created as a secret // For GitHub, this becomes the provided token (pat) diff --git a/internal/launch/cmd.go b/internal/launch/cmd.go index ece9fe31..658729ca 100644 --- a/internal/launch/cmd.go +++ b/internal/launch/cmd.go @@ -404,7 +404,7 @@ func Up(additionalHelmFlags []string, inCluster bool, useTelemetry bool) { progress.Error(fmt.Sprintf("error generating certificate for console: %s", err)) } - //* read certificate files + // * read certificate files certPem, err := os.ReadFile(fmt.Sprintf("%s/%s-cert.pem", mkcertPemDir, "kubefirst-console")) if err != nil { progress.Error(fmt.Sprintf("error generating certificate for console: %s", err)) diff --git a/internal/progress/message.go b/internal/progress/message.go index 901af7f9..0dc942b6 100644 --- a/internal/progress/message.go +++ b/internal/progress/message.go @@ -107,9 +107,8 @@ func DisplaySuccessMessage(cluster types.Cluster) successMsg { break case "k3s": - cloudCliKubeconfig = fmt.Sprint(("use the kubeconfig file outputed from terraform to acces to the cluster")) + cloudCliKubeconfig = fmt.Sprint(("use the kubeconfig file outputted from terraform to acces to the cluster")) break - } var fullDomainName string diff --git a/internal/provisionLogs/message.go b/internal/provisionLogs/message.go deleted file mode 100644 index bfaf9d06..00000000 --- a/internal/provisionLogs/message.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Copyright (C) 2021-2023, Kubefirst - -This program is licensed under MIT. -See the LICENSE file for more details. - -Emojis definition https://github.com/yuin/goldmark-emoji/blob/master/definition/github.go -Color definition https://www.ditig.com/256-colors-cheat-sheet -*/ -package provisionLogs - -import ( - "log" - - "github.com/charmbracelet/glamour" - "github.com/konstructio/kubefirst/internal/progress" -) - -func renderMessage(message string) string { - r, _ := glamour.NewTermRenderer( - glamour.WithStyles(progress.StyleConfig), - glamour.WithEmoji(), - ) - - out, err := r.Render(message) - if err != nil { - log.Println(err.Error()) - return err.Error() - } - return out -} diff --git a/internal/utilities/utilities.go b/internal/utilities/utilities.go index 41c626fb..4f13790c 100644 --- a/internal/utilities/utilities.go +++ b/internal/utilities/utilities.go @@ -7,11 +7,9 @@ See the LICENSE file for more details. package utilities import ( - "bufio" "encoding/json" "fmt" "io/ioutil" - "net/http" "os" "strconv" "time" @@ -259,39 +257,6 @@ func ExportCluster(cluster apiTypes.Cluster, kcfg *k8s.KubernetesClient) error { return nil } -func ConsumeStream(url string) { - client := &http.Client{} - - req, err := http.NewRequest("GET", url, nil) - if err != nil { - fmt.Println("Error creating request:", err) - return - } - - resp, err := client.Do(req) - if err != nil { - fmt.Println("Error making request:", err) - return - } - - if resp.StatusCode != http.StatusOK { - fmt.Println("Error response:", resp.Status) - return - } - - // Read and print the streamed data until done signal is received - scanner := bufio.NewScanner(resp.Body) - for scanner.Scan() { - data := scanner.Text() - log.Info().Msgf(data) - } - - if err := scanner.Err(); err != nil { - log.Error().Msgf("Error reading response: %s", err.Error()) - return - } -} - func ParseJSONToMap(jsonStr string) (map[string][]byte, error) { var result map[string]interface{} err := json.Unmarshal([]byte(jsonStr), &result) diff --git a/main.go b/main.go index c5e4ea0f..cd9ecece 100644 --- a/main.go +++ b/main.go @@ -79,7 +79,7 @@ func main() { k1Dir := fmt.Sprintf("%s/.k1", homePath) - //* create k1Dir if it doesn't exist + // * create k1Dir if it doesn't exist if _, err := os.Stat(k1Dir); os.IsNotExist(err) { err := os.MkdirAll(k1Dir, os.ModePerm) if err != nil { @@ -87,14 +87,14 @@ func main() { } } - //* create log directory + // * create log directory logsFolder := fmt.Sprintf("%s/logs", k1Dir) _ = os.Mkdir(logsFolder, 0o700) if err != nil { log.Fatal().Msgf("error creating logs directory: %s", err) } - //* create session log file + // * create session log file logfile := fmt.Sprintf("%s/%s", logsFolder, logfileName) logFileObj, err := utils.OpenLogFile(logfile) if err != nil { From b95f63adfa946f5b4f2b2a888f648bf961764722 Mon Sep 17 00:00:00 2001 From: Patrick D'appollonio <930925+patrickdappollonio@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:02:25 -0400 Subject: [PATCH 2/3] Change version on CI too --- .github/workflows/releaser.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/releaser.yaml b/.github/workflows/releaser.yaml index 75c34665..3872667b 100644 --- a/.github/workflows/releaser.yaml +++ b/.github/workflows/releaser.yaml @@ -28,10 +28,10 @@ jobs: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: '>=1.18.0' - + go-version-file: go.mod + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v3 @@ -40,4 +40,4 @@ jobs: version: latest args: release --clean env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} From 62428a1c9b75c4fbc4052dde6cbbfe4dcaa1c914 Mon Sep 17 00:00:00 2001 From: Patrick D'appollonio <930925+patrickdappollonio@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:11:02 -0400 Subject: [PATCH 3/3] Add missing formatted file. --- cmd/k3d/create.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/k3d/create.go b/cmd/k3d/create.go index 0749ff7c..32db2f99 100644 --- a/cmd/k3d/create.go +++ b/cmd/k3d/create.go @@ -312,7 +312,7 @@ func runK3d(cmd *cobra.Command, args []string) error { // } //} // - //model, err := presentRecap(gitProviderFlag, gitDestDescriptor, cGitOwner) + // model, err := presentRecap(gitProviderFlag, gitDestDescriptor, cGitOwner) //if err != nil { // return err //} @@ -1187,7 +1187,7 @@ func runK3d(cmd *cobra.Command, args []string) error { progressPrinter.IncrementTracker("configuring-vault", 1) // * configure vault with terraform - //* vault port-forward + // * vault port-forward vaultStopChannel := make(chan struct{}, 1) defer func() { close(vaultStopChannel)