Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kubefirst for openSUSE:Factory checked in at 2024-02-25 14:06:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kubefirst (Old) and /work/SRC/openSUSE:Factory/.kubefirst.new.1770 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kubefirst" Sun Feb 25 14:06:24 2024 rev:6 rq:1150107 version:2.3.8 Changes: -------- --- /work/SRC/openSUSE:Factory/kubefirst/kubefirst.changes 2023-12-15 21:47:57.951655923 +0100 +++ /work/SRC/openSUSE:Factory/.kubefirst.new.1770/kubefirst.changes 2024-02-25 14:06:42.202168898 +0100 @@ -1,0 +2,28 @@ +Sat Feb 24 09:11:34 UTC 2024 - opensuse_buildserv...@ojkastl.de + +- Update to version 2.3.8: + * chore: bump launch version v2.3.8 (#2100) + * chore: bump launch version rc76 (#2099) + * feat: post install catalog apps (#2090) + * feat: SKIP_ARGOCD_LAUNCH env var set to true will suppress + argocd launch when development (#2080) + * fix: support ngrok authtoken (#2074) + * feat: logs (#2069) + * chore: update licence years to include 2024 (#2063) + * ci: remove a non-working UX project automation workflow (#2059) + * ci: using the right token for + srggrs/assign-one-project-github-action (#2056) + * ci: fix the project URL for + srggrs/assign-one-project-github-action (#2054) + * ci: update assign-one-project-github-action version + fix token + name (#2051) + * ci: add a workflow to automatically add UX issues into the + project (#2048) + * refactor: updated the console 0 destroy message for clarity + (#1986) + * chore: make installation type for marketplace generic for bug + report (#1980) + * feat: subdomain flag for cloudflare (#1976) + * fix: add quouta command to the bubbletea blacklist (#1967) + +------------------------------------------------------------------- Old: ---- kubefirst-2.3.7.obscpio New: ---- kubefirst-2.3.8.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kubefirst.spec ++++++ --- /var/tmp/diff_new_pack.W2lxDO/_old 2024-02-25 14:06:43.198204952 +0100 +++ /var/tmp/diff_new_pack.W2lxDO/_new 2024-02-25 14:06:43.202205096 +0100 @@ -1,7 +1,7 @@ # # spec file for package kubefirst # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: kubefirst -Version: 2.3.7 +Version: 2.3.8 Release: 0 Summary: CLI for the KubeFirst GitOps Infrastructure & Application Delivery Platform License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.W2lxDO/_old 2024-02-25 14:06:43.230206110 +0100 +++ /var/tmp/diff_new_pack.W2lxDO/_new 2024-02-25 14:06:43.234206255 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/kubefirst/kubefirst</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v2.3.7</param> + <param name="revision">v2.3.8</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.W2lxDO/_old 2024-02-25 14:06:43.254206979 +0100 +++ /var/tmp/diff_new_pack.W2lxDO/_new 2024-02-25 14:06:43.258207123 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/kubefirst/kubefirst</param> - <param name="changesrevision">c816caa695e1569f83071544d9e98133f42649b5</param></service></servicedata> + <param name="changesrevision">9563f0522736cacc84464f2c55c420578ff7adb0</param></service></servicedata> (No newline at EOF) ++++++ kubefirst-2.3.7.obscpio -> kubefirst-2.3.8.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/.github/ISSUE_TEMPLATE/bugs.yml new/kubefirst-2.3.8/.github/ISSUE_TEMPLATE/bugs.yml --- old/kubefirst-2.3.7/.github/ISSUE_TEMPLATE/bugs.yml 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/.github/ISSUE_TEMPLATE/bugs.yml 2024-02-21 18:18:38.000000000 +0100 @@ -46,9 +46,9 @@ multiple: true options: - None specific - - UI (Console app) - CLI - - Civo Marketplace + - Marketplace + - UI (Console app) validations: required: true - type: dropdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/LICENSE new/kubefirst-2.3.8/LICENSE --- old/kubefirst-2.3.7/LICENSE 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/LICENSE 2024-02-21 18:18:38.000000000 +0100 @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021-2023 Kubefirst +Copyright (c) 2021-2024 Kubefirst Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/aws/command.go new/kubefirst-2.3.8/cmd/aws/command.go --- old/kubefirst-2.3.7/cmd/aws/command.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/aws/command.go 2024-02-21 18:18:38.000000000 +0100 @@ -30,10 +30,12 @@ gitopsTemplateURLFlag string gitopsTemplateBranchFlag string domainNameFlag string + subdomainNameFlag string useTelemetryFlag bool ecrFlag bool nodeTypeFlag string nodeCountFlag string + installCatalogApps string // RootCredentials copyArgoCDPasswordToClipboardFlag bool @@ -88,6 +90,7 @@ createCmd.Flags().StringVar(&nodeCountFlag, "node-count", awsDefaults.NodeCount, "the node count for the cluster") createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", awsDefaults.InstanceSize, "the instance size of the cluster to create") createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "aws", 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 Route53/Cloudflare hosted zone 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)) @@ -96,6 +99,7 @@ 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") createCmd.Flags().BoolVar(&ecrFlag, "ecr", false, "whether or not to use ecr vs the git provider") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/aws/create.go new/kubefirst-2.3.8/cmd/aws/create.go --- old/kubefirst-2.3.7/cmd/aws/create.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/aws/create.go 2024-02-21 18:18:38.000000000 +0100 @@ -11,6 +11,7 @@ "os" "github.com/aws/aws-sdk-go/aws" + "github.com/kubefirst/kubefirst/internal/catalog" "github.com/kubefirst/kubefirst/internal/cluster" "github.com/kubefirst/kubefirst/internal/gitShim" "github.com/kubefirst/kubefirst/internal/launch" @@ -34,6 +35,11 @@ progress.DisplayLogHints(40) + isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) + if !isValid { + return err + } + err = ValidateProvidedFlags(cliFlags.GitProvider) if err != nil { progress.Error(err.Error()) @@ -112,7 +118,7 @@ progress.Error("unable to start kubefirst api") } - provision.CreateMgmtCluster(gitAuth, cliFlags) + provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps) return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/civo/command.go new/kubefirst-2.3.8/cmd/civo/command.go --- old/kubefirst-2.3.7/cmd/civo/command.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/civo/command.go 2024-02-21 18:18:38.000000000 +0100 @@ -23,6 +23,7 @@ clusterNameFlag string clusterTypeFlag string dnsProviderFlag string + subdomainNameFlag string domainNameFlag string githubOrgFlag string gitlabGroupFlag string @@ -33,6 +34,7 @@ useTelemetryFlag bool nodeTypeFlag string nodeCountFlag string + installCatalogApps string // RootCredentials copyArgoCDPasswordToClipboardFlag bool @@ -99,6 +101,7 @@ createCmd.Flags().StringVar(&nodeCountFlag, "node-count", civoDefaults.NodeCount, "the node count for the cluster") createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", civoDefaults.InstanceSize, "the instance size of the cluster to create") createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "civo", 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 Civo 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)) @@ -107,6 +110,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/civo/create.go new/kubefirst-2.3.8/cmd/civo/create.go --- old/kubefirst-2.3.7/cmd/civo/create.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/civo/create.go 2024-02-21 18:18:38.000000000 +0100 @@ -10,6 +10,7 @@ "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/launch" @@ -32,6 +33,11 @@ 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()) @@ -39,12 +45,6 @@ } // If cluster setup is complete, return - clusterSetupComplete := viper.GetBool("kubefirst-checks.cluster-install-complete") - if clusterSetupComplete { - err = fmt.Errorf("this cluster install process has already completed successfully") - progress.Error(err.Error()) - return nil - } utilities.CreateK1ClusterDirectory(clusterNameFlag) @@ -88,7 +88,7 @@ progress.Error("unable to start kubefirst api") } - provision.CreateMgmtCluster(gitAuth, cliFlags) + provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps) return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/digitalocean/command.go new/kubefirst-2.3.8/cmd/digitalocean/command.go --- old/kubefirst-2.3.7/cmd/digitalocean/command.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/digitalocean/command.go 2024-02-21 18:18:38.000000000 +0100 @@ -25,6 +25,7 @@ clusterTypeFlag string dnsProviderFlag string domainNameFlag string + subdomainNameFlag string githubOrgFlag string gitlabGroupFlag string gitProviderFlag string @@ -34,6 +35,7 @@ useTelemetryFlag bool nodeTypeFlag string nodeCountFlag string + installCatalogApps string // RootCredentials copyArgoCDPasswordToClipboardFlag bool @@ -92,6 +94,7 @@ createCmd.Flags().StringVar(&nodeCountFlag, "node-count", doDefaults.NodeCount, "the node count for the cluster") createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", doDefaults.InstanceSize, "the instance size of the cluster to create") createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "digitalocean", 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 DigitalOcean 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)) @@ -100,6 +103,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/digitalocean/create.go new/kubefirst-2.3.8/cmd/digitalocean/create.go --- old/kubefirst-2.3.7/cmd/digitalocean/create.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/digitalocean/create.go 2024-02-21 18:18:38.000000000 +0100 @@ -12,6 +12,7 @@ "github.com/rs/zerolog/log" + "github.com/kubefirst/kubefirst/internal/catalog" "github.com/kubefirst/kubefirst/internal/cluster" "github.com/kubefirst/kubefirst/internal/gitShim" "github.com/kubefirst/kubefirst/internal/launch" @@ -33,6 +34,11 @@ progress.DisplayLogHints(20) + isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) + if !isValid { + return err + } + err = ValidateProvidedFlags(cliFlags.GitProvider) if err != nil { progress.Error(err.Error()) @@ -89,7 +95,7 @@ progress.Error("unable to start kubefirst api") } - provision.CreateMgmtCluster(gitAuth, cliFlags) + provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps) return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/google/command.go new/kubefirst-2.3.8/cmd/google/command.go --- old/kubefirst-2.3.7/cmd/google/command.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/google/command.go 2024-02-21 18:18:38.000000000 +0100 @@ -24,6 +24,7 @@ clusterTypeFlag string dnsProviderFlag string domainNameFlag string + subdomainNameFlag string googleProjectFlag string githubOrgFlag string gitlabGroupFlag string @@ -35,6 +36,7 @@ forceDestroyFlag bool nodeTypeFlag string nodeCountFlag string + installCatalogApps string // RootCredentials copyArgoCDPasswordToClipboardFlag bool @@ -94,6 +96,7 @@ createCmd.Flags().StringVar(&nodeCountFlag, "node-count", googleDefaults.NodeCount, "the node count for the cluster") createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", googleDefaults.InstanceSize, "the instance size of the cluster to create") createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "google", 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 GCP DNS Name to use for DNS records (i.e. your-domain.com|subdomain.your-domain.com) (required)") createCmd.MarkFlagRequired("domain-name") createCmd.Flags().StringVar(&googleProjectFlag, "google-project", "", "google project id (required)") @@ -104,6 +107,7 @@ 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") createCmd.Flags().BoolVar(&forceDestroyFlag, "force-destroy", false, "allows force destruction on objects (helpful for test environments, defaults to false)") return createCmd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/google/create.go new/kubefirst-2.3.8/cmd/google/create.go --- old/kubefirst-2.3.7/cmd/google/create.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/google/create.go 2024-02-21 18:18:38.000000000 +0100 @@ -12,6 +12,7 @@ "github.com/rs/zerolog/log" + "github.com/kubefirst/kubefirst/internal/catalog" "github.com/kubefirst/kubefirst/internal/cluster" "github.com/kubefirst/kubefirst/internal/gitShim" "github.com/kubefirst/kubefirst/internal/launch" @@ -34,6 +35,11 @@ progress.DisplayLogHints(20) + isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) + if !isValid { + return err + } + err = ValidateProvidedFlags(cliFlags.GitProvider) if err != nil { progress.Error(err.Error()) @@ -87,7 +93,7 @@ progress.Error("unable to start kubefirst api") } - provision.CreateMgmtCluster(gitAuth, cliFlags) + provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps) return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/k3d/command.go new/kubefirst-2.3.8/cmd/k3d/command.go --- old/kubefirst-2.3.7/cmd/k3d/command.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/k3d/command.go 2024-02-21 18:18:38.000000000 +0100 @@ -29,6 +29,7 @@ gitopsTemplateURLFlag string gitopsTemplateBranchFlag string useTelemetryFlag bool + installCatalogApps string // RootCredentials copyArgoCDPasswordToClipboardFlag bool @@ -95,6 +96,7 @@ 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 of catalog apps to install after provision") createCmd.Flags().BoolVar(&useTelemetryFlag, "use-telemetry", true, "whether to emit telemetry") return createCmd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/k3d/create.go new/kubefirst-2.3.8/cmd/k3d/create.go --- old/kubefirst-2.3.7/cmd/k3d/create.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/k3d/create.go 2024-02-21 18:18:38.000000000 +0100 @@ -26,6 +26,7 @@ "github.com/kubefirst/kubefirst-api/pkg/handlers" "github.com/kubefirst/kubefirst-api/pkg/reports" "github.com/kubefirst/kubefirst-api/pkg/wrappers" + "github.com/kubefirst/kubefirst/internal/catalog" "github.com/kubefirst/kubefirst/internal/gitShim" "github.com/kubefirst/kubefirst/internal/segment" "github.com/kubefirst/kubefirst/internal/utilities" @@ -105,6 +106,11 @@ return err } + installCatalogAppsFlag, err := cmd.Flags().GetString("install-catalog-apps") + if err != nil { + return err + } + useTelemetryFlag, err := cmd.Flags().GetBool("use-telemetry") if err != nil { return err @@ -119,6 +125,11 @@ utilities.CreateK1ClusterDirectory(clusterNameFlag) helpers.DisplayLogHints() + isValid, catalogApps, err := catalog.ValidateCatalogApps(installCatalogAppsFlag) + if !isValid { + return err + } + switch gitProviderFlag { case "github": key, err := internalssh.GetHostKey("github.com") @@ -369,6 +380,13 @@ viper.WriteConfig() } + atlantisNgrokAuthtoken := viper.GetString("secrets.atlantis-ngrok-authtoken") + if atlantisNgrokAuthtoken == "" { + atlantisNgrokAuthtoken = os.Getenv("NGROK_AUTHTOKEN") + viper.Set("secrets.atlantis-ngrok-authtoken", atlantisNgrokAuthtoken) + viper.WriteConfig() + } + log.Info().Msg("checking authentication to required providers") // check disk @@ -544,6 +562,10 @@ progressPrinter.IncrementTracker("preflight-checks", 1) progressPrinter.AddTracker("cloning-and-formatting-git-repositories", "Cloning and formatting git repositories", 1) progressPrinter.SetupProgress(progressPrinter.TotalOfTrackers(), false) + removeAtlantis := false + if viper.GetString("secrets.atlantis-ngrok-authtoken") == "" { + removeAtlantis = true + } if !viper.GetBool("kubefirst-checks.gitops-ready-to-push") { log.Info().Msg("generating your new gitops repository") err := k3d.PrepareGitRepositories( @@ -560,6 +582,7 @@ config.MetaphorDir, &metaphorTemplateTokens, gitProtocolFlag, + removeAtlantis, ) if err != nil { return err @@ -992,9 +1015,11 @@ log.Error().Err(err).Msg("") } - err = pkg.OpenBrowser(pkg.ArgoCDLocalURLTLS) - if err != nil { - log.Error().Err(err).Msg("") + if os.Getenv("SKIP_ARGOCD_LAUNCH") != "true" { + err = pkg.OpenBrowser(pkg.ArgoCDLocalURLTLS) + if err != nil { + log.Error().Err(err).Msg("") + } } } @@ -1216,6 +1241,7 @@ tfEnvs["AWS_SECRET_ACCESS_KEY"] = pkg.MinioDefaultPassword tfEnvs["TF_VAR_aws_access_key_id"] = pkg.MinioDefaultUsername tfEnvs["TF_VAR_aws_secret_access_key"] = pkg.MinioDefaultPassword + tfEnvs["TF_VAR_ngrok_authtoken"] = viper.GetString("secrets.atlantis-ngrok-authtoken") // tfEnvs["TF_LOG"] = "DEBUG" tfEntrypoint := config.GitopsDir + "/terraform/vault" @@ -1334,7 +1360,7 @@ // Set flags used to track status of active options helpers.SetClusterStatusFlags(k3d.CloudProvider, config.GitProvider) - cluster := utilities.CreateClusterRecordFromRaw(useTelemetryFlag, cGitOwner, cGitUser, cGitToken, cGitlabOwnerGroupID, gitopsTemplateURLFlag, gitopsTemplateBranchFlag) + cluster := utilities.CreateClusterRecordFromRaw(useTelemetryFlag, cGitOwner, cGitUser, cGitToken, cGitlabOwnerGroupID, gitopsTemplateURLFlag, gitopsTemplateBranchFlag, catalogApps) err = utilities.ExportCluster(cluster, kcfg) if err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/logs.go new/kubefirst-2.3.8/cmd/logs.go --- old/kubefirst-2.3.7/cmd/logs.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/logs.go 2024-02-21 18:18:38.000000000 +0100 @@ -0,0 +1,47 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package cmd + +import ( + "fmt" + "os" + + "github.com/kubefirst/kubefirst/internal/provisionLogs" + "github.com/nxadm/tail" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +// infoCmd represents the info command +var logsCmd = &cobra.Command{ + Use: "logs", + Short: "kubefirst real time logs", + Long: `kubefirst real time logs`, + RunE: func(cmd *cobra.Command, args []string) error { + provisionLogs.InitializeProvisionLogsTerminal() + + go func() { + t, err := tail.TailFile(viper.GetString("k1-paths.log-file"), tail.Config{Follow: true, ReOpen: true}) + if err != nil { + fmt.Printf("Error tailing log file: %v\n", err) + os.Exit(1) + } + + for line := range t.Lines { + provisionLogs.AddLog(line.Text) + } + }() + + provisionLogs.ProvisionLogs.Run() + + return nil + }, +} + +func init() { + rootCmd.AddCommand(logsCmd) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/vultr/command.go new/kubefirst-2.3.8/cmd/vultr/command.go --- old/kubefirst-2.3.7/cmd/vultr/command.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/vultr/command.go 2024-02-21 18:18:38.000000000 +0100 @@ -24,6 +24,7 @@ clusterTypeFlag string dnsProviderFlag string domainNameFlag string + subdomainNameFlag string githubOrgFlag string gitlabGroupFlag string gitProviderFlag string @@ -33,6 +34,7 @@ useTelemetryFlag bool nodeTypeFlag string nodeCountFlag string + installCatalogApps string // RootCredentials copyArgoCDPasswordToClipboardFlag bool @@ -92,6 +94,7 @@ createCmd.Flags().StringVar(&nodeCountFlag, "node-count", vultrDefaults.NodeCount, "the node count for the cluster") createCmd.Flags().StringVar(&nodeTypeFlag, "node-type", vultrDefaults.InstanceSize, "the instance size of the cluster to create") createCmd.Flags().StringVar(&dnsProviderFlag, "dns-provider", "vultr", 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 Vultr 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)) @@ -100,6 +103,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/cmd/vultr/create.go new/kubefirst-2.3.8/cmd/vultr/create.go --- old/kubefirst-2.3.7/cmd/vultr/create.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/cmd/vultr/create.go 2024-02-21 18:18:38.000000000 +0100 @@ -10,6 +10,7 @@ "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/launch" @@ -33,6 +34,11 @@ 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()) @@ -89,7 +95,7 @@ progress.Error("unable to start kubefirst api") } - provision.CreateMgmtCluster(gitAuth, cliFlags) + provision.CreateMgmtCluster(gitAuth, cliFlags, catalogApps) return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/go.mod new/kubefirst-2.3.8/go.mod --- old/kubefirst-2.3.7/go.mod 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/go.mod 2024-02-21 18:18:38.000000000 +0100 @@ -14,11 +14,11 @@ github.com/dustin/go-humanize v1.0.1 github.com/go-git/go-git/v5 v5.6.1 github.com/hashicorp/vault/api v1.9.0 - github.com/kubefirst/kubefirst-api v0.1.8 + github.com/kubefirst/kubefirst-api v0.1.11 github.com/kubefirst/metrics-client v0.3.0 - github.com/kubefirst/runtime v0.3.35 + github.com/kubefirst/runtime v0.4.1 + github.com/nxadm/tail v1.4.8 github.com/rs/zerolog v1.29.1 - github.com/segmentio/analytics-go v3.1.0+incompatible github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.15.0 @@ -107,7 +107,6 @@ github.com/gofrs/flock v0.7.0 // indirect github.com/golang-jwt/jwt/v4 v4.4.3 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.1 // indirect github.com/google/gnostic v0.6.9 // indirect github.com/google/go-github/v45 v45.2.0 // indirect @@ -137,7 +136,6 @@ github.com/moby/spdystream v0.2.0 // indirect github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect - github.com/montanaflynn/stats v0.6.6 // indirect 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 @@ -156,6 +154,7 @@ github.com/rs/xid v1.4.0 // indirect github.com/russross/blackfriday v1.6.0 // indirect github.com/sahilm/fuzzy v0.1.0 // indirect + github.com/segmentio/analytics-go v3.1.0+incompatible // indirect github.com/segmentio/backo-go v1.0.1 // indirect github.com/skeema/knownhosts v1.1.0 // indirect github.com/vmihailenco/go-tinylfu v0.2.1 // indirect @@ -163,12 +162,8 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/vultr/govultr/v3 v3.0.2 // indirect github.com/xanzy/go-gitlab v0.81.0 // indirect - github.com/xdg-go/pbkdf2 v1.0.0 // indirect - github.com/xdg-go/scram v1.1.1 // indirect - github.com/xdg-go/stringprep v1.0.3 // indirect github.com/xlab/treeprint v1.1.0 // indirect github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect - github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect github.com/yuin/goldmark v1.5.2 // indirect github.com/yuin/goldmark-emoji v1.0.1 // indirect go.opencensus.io v0.24.0 // indirect @@ -183,6 +178,7 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/grpc v1.55.0 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect k8s.io/apiextensions-apiserver v0.26.0 // indirect k8s.io/apiserver v0.26.2 // indirect k8s.io/cli-runtime v0.24.2 // indirect @@ -226,6 +222,7 @@ 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-github/v52 v52.0.0 github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -256,7 +253,7 @@ github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect - github.com/muesli/termenv v0.15.2 // indirect + github.com/muesli/termenv v0.15.2 github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/rivo/uniseg v0.4.2 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect @@ -270,7 +267,7 @@ golang.org/x/net v0.14.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 + golang.org/x/term v0.11.0 // indirect golang.org/x/text v0.12.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/go.sum new/kubefirst-2.3.8/go.sum --- old/kubefirst-2.3.7/go.sum 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/go.sum 2024-02-21 18:18:38.000000000 +0100 @@ -504,8 +504,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -534,6 +532,8 @@ github.com/google/go-cmp v0.5.9/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= +github.com/google/go-github/v52 v52.0.0/go.mod h1:WJV6VEEUPuMo5pXqqa2ZCZEdbQqua4zAk2MZTIo+m+4= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -721,14 +721,12 @@ 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= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kubefirst/kubefirst-api v0.1.8 h1:+5AT9pDj4AuH2GCW43Z9U/frEEyemqeZOm3zKGHd6no= -github.com/kubefirst/kubefirst-api v0.1.8/go.mod h1:Euz7+acib+o9DTkJ3MXRVtPL1rI+vGFZditYG2aXQCY= -github.com/kubefirst/metrics-client v0.2.8 h1:JfaeiBifZD/DpyYW2QVHcrhH/KWA98OmM+7c7M12qMc= -github.com/kubefirst/metrics-client v0.2.8/go.mod h1:GR7wsMcyYhd+EU67PeuMCBYFE6OJ7P/j5OI5BLOoRMc= +github.com/kubefirst/kubefirst-api v0.1.11 h1:nRq0y40StwBCL/YwjzHXAURN+/SA63g6pzvQjAxgdOk= +github.com/kubefirst/kubefirst-api v0.1.11/go.mod h1:pAcgIJVYRvRldNMcdIbhcIuHeM+euNlfKVEd/JNS6c8= 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/kubefirst/runtime v0.3.35 h1:wn430Irf0E1vc3X0WX3lYBpyhQ5TN6xxMcargILA9uI= -github.com/kubefirst/runtime v0.3.35/go.mod h1:0CnYy+8JTG+/0f3QlkTQJqTT654Su6JXk30OufFVY98= +github.com/kubefirst/runtime v0.4.1 h1:0aqBZa3bPwHb5pFFA1eaZ5VObNjuVxDO4d8m9VFs4Jo= +github.com/kubefirst/runtime v0.4.1/go.mod h1:0CnYy+8JTG+/0f3QlkTQJqTT654Su6JXk30OufFVY98= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 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= @@ -828,8 +826,6 @@ 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/montanaflynn/stats v0.6.6 h1:Duep6KMIDpY4Yo11iFsvyqJDyfzLF9+sndUKT+v64GQ= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= 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= @@ -1109,7 +1105,6 @@ github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -1135,11 +1130,8 @@ github.com/xanzy/go-gitlab v0.81.0/go.mod h1:VMbY3JIWdZ/ckvHbQqkyd3iYk2aViKrNIQ23IbFMQDo= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= @@ -1151,8 +1143,6 @@ github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c h1:3lbZUMbMiGUW/LMkfsEABsc5zNT9+b1CvsJx47JzJ8g= github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c/go.mod h1:UrdRz5enIKZ63MEE3IF9l2/ebyx59GyGgPi+tICQdmM= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= -github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1232,7 +1222,6 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/catalog/catalog.go new/kubefirst-2.3.8/internal/catalog/catalog.go --- old/kubefirst-2.3.7/internal/catalog/catalog.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubefirst-2.3.8/internal/catalog/catalog.go 2024-02-21 18:18:38.000000000 +0100 @@ -0,0 +1,173 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package catalog + +import ( + "context" + "fmt" + "io" + "os" + "strings" + + git "github.com/google/go-github/v52/github" + + apiTypes "github.com/kubefirst/kubefirst-api/pkg/types" + + "github.com/rs/zerolog/log" + "gopkg.in/yaml.v2" +) + +const ( + KubefirstGitHubOrganization = "kubefirst" + KubefirstGitopsCatalogRepository = "gitops-catalog" + basePath = "/" +) + +type GitHubClient struct { + Client *git.Client +} + +// NewGitHub instantiates an unauthenticated GitHub client +func NewGitHub() *git.Client { + return git.NewClient(nil) +} + +func ReadActiveApplications() (apiTypes.GitopsCatalogApps, error) { + gh := GitHubClient{ + Client: NewGitHub(), + } + + activeContent, err := gh.ReadGitopsCatalogRepoContents() + if err != nil { + return apiTypes.GitopsCatalogApps{}, fmt.Errorf("error retrieving gitops catalog repository content: %s", err) + } + + index, err := gh.ReadGitopsCatalogIndex(activeContent) + if err != nil { + return apiTypes.GitopsCatalogApps{}, fmt.Errorf("error retrieving gitops catalog index content: %s", err) + } + + var out apiTypes.GitopsCatalogApps + + err = yaml.Unmarshal(index, &out) + if err != nil { + return apiTypes.GitopsCatalogApps{}, fmt.Errorf("error retrieving gitops catalog applications: %s", err) + } + + return out, nil +} + +func ValidateCatalogApps(catalogApps string) (bool, []apiTypes.GitopsCatalogApp, error) { + items := strings.Split(catalogApps, ",") + + gitopsCatalogapps := []apiTypes.GitopsCatalogApp{} + if catalogApps == "" { + return true, gitopsCatalogapps, nil + } + + apps, err := ReadActiveApplications() + if err != nil { + log.Error().Msgf(fmt.Sprintf("Error getting gitops catalag applications: %s", err)) + return false, gitopsCatalogapps, err + } + + for _, app := range items { + found := false + for _, catalogApp := range apps.Apps { + if app == catalogApp.Name { + found = true + + if catalogApp.SecretKeys != nil { + for _, secret := range catalogApp.SecretKeys { + secretValue := os.Getenv(secret.Env) + + if secretValue == "" { + return false, gitopsCatalogapps, fmt.Errorf("your %s environment variable is not set for %s catalog application. Please set and try again", secret.Env, app) + } + + secret.Value = secretValue + } + } + + if catalogApp.ConfigKeys != nil { + for _, config := range catalogApp.ConfigKeys { + configValue := os.Getenv(config.Env) + if configValue == "" { + return false, gitopsCatalogapps, fmt.Errorf("your %s environment variable is not set for %s catalog application. Please set and try again", config.Env, app) + } + config.Value = configValue + } + } + + gitopsCatalogapps = append(gitopsCatalogapps, catalogApp) + + break + } + } + if !found { + return false, gitopsCatalogapps, fmt.Errorf(fmt.Sprintf("catalag app is not supported: %s", app)) + } + } + + return true, gitopsCatalogapps, nil +} + +func (gh *GitHubClient) ReadGitopsCatalogRepoContents() ([]*git.RepositoryContent, error) { + _, directoryContent, _, err := gh.Client.Repositories.GetContents( + context.Background(), + KubefirstGitHubOrganization, + KubefirstGitopsCatalogRepository, + basePath, + nil, + ) + if err != nil { + return nil, err + } + + return directoryContent, nil +} + +// ReadGitopsCatalogIndex reads the gitops catalog repository index +func (gh *GitHubClient) ReadGitopsCatalogIndex(contents []*git.RepositoryContent) ([]byte, error) { + for _, content := range contents { + switch *content.Type { + case "file": + switch *content.Name { + case "index.yaml": + b, err := gh.readFileContents(content) + if err != nil { + return b, err + } + return b, nil + } + } + } + + return []byte{}, fmt.Errorf("index.yaml not found in gitops catalog repository") +} + +// readFileContents parses the contents of a file in a GitHub repository +func (gh *GitHubClient) readFileContents(content *git.RepositoryContent) ([]byte, error) { + rc, _, err := gh.Client.Repositories.DownloadContents( + context.Background(), + KubefirstGitHubOrganization, + KubefirstGitopsCatalogRepository, + *content.Path, + nil, + ) + if err != nil { + return []byte{}, err + } + defer rc.Close() + + b, err := io.ReadAll(rc) + if err != nil { + return []byte{}, err + } + + return b, nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/cluster/cluster.go new/kubefirst-2.3.8/internal/cluster/cluster.go --- old/kubefirst-2.3.7/internal/cluster/cluster.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/cluster/cluster.go 2024-02-21 18:18:38.000000000 +0100 @@ -65,7 +65,7 @@ return err } - if res.StatusCode != http.StatusOK { + if res.StatusCode != http.StatusAccepted { log.Info().Msgf("unable to create cluster %s %s", res.Status, body) return fmt.Errorf("unable to create cluster %s %s", res.Status, body) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/common/common.go new/kubefirst-2.3.8/internal/common/common.go --- old/kubefirst-2.3.7/internal/common/common.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/common/common.go 2024-02-21 18:18:38.000000000 +0100 @@ -161,6 +161,7 @@ viper.Set("launch", "") viper.Set("kubefirst", "") viper.Set("flags", "") + viper.Set("k1-paths", "") viper.WriteConfig() if _, err := os.Stat(config.K1Dir + "/kubeconfig"); !os.IsNotExist(err) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/launch/cmd.go new/kubefirst-2.3.8/internal/launch/cmd.go --- old/kubefirst-2.3.7/internal/launch/cmd.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/launch/cmd.go 2024-02-21 18:18:38.000000000 +0100 @@ -186,7 +186,7 @@ log.Info().Msg("Creating k3d cluster for Kubefirst console and API...") err = k3d.ClusterCreateConsoleAPI( consoleClusterName, - kubeconfigPath, + fmt.Sprintf("%s/.k1", homeDir), k3dClient, fmt.Sprintf("%s/kubeconfig", dir), ) @@ -336,6 +336,8 @@ fmt.Sprintf("global.kubefirstTeamInfo=%s", kubefirstTeamInfo), "--set", fmt.Sprintf("global.useTelemetry=%s", strconv.FormatBool(useTelemetry)), + "--set", + "kubefirst-api.includeVolume=true", } if len(additionalHelmFlags) > 0 { @@ -574,7 +576,7 @@ if !inCluster { successMsg := ` ### -#### :tada: Success` + "`Your k3d kubefirst platform has been destroyed.`" +#### :tada: Success` + "`Your kubefirst platform provisioner has been destroyed.`" progress.Success(successMsg) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/launch/constants.go new/kubefirst-2.3.8/internal/launch/constants.go --- old/kubefirst-2.3.7/internal/launch/constants.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/launch/constants.go 2024-02-21 18:18:38.000000000 +0100 @@ -11,7 +11,7 @@ helmChartName = "kubefirst" helmChartRepoName = "kubefirst" helmChartRepoURL = "https://charts.kubefirst.com" - helmChartVersion = "2.3.7" + helmChartVersion = "2.3.8" namespace = "kubefirst" secretName = "kubefirst-initial-secrets" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/progress/message.go new/kubefirst-2.3.8/internal/progress/message.go --- old/kubefirst-2.3.7/internal/progress/message.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/progress/message.go 2024-02-21 18:18:38.000000000 +0100 @@ -195,7 +195,7 @@ Progress.Send(renderedMessage) } -func StartProvisioning(clusterName string, estimatedTime int) { +func StartProvisioning(clusterName string) { provisioningMessage := startProvision{ clusterName: clusterName, } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/provision/provision.go new/kubefirst-2.3.8/internal/provision/provision.go --- old/kubefirst-2.3.7/internal/provision/provision.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/provision/provision.go 2024-02-21 18:18:38.000000000 +0100 @@ -7,6 +7,7 @@ package provision import ( + apiTypes "github.com/kubefirst/kubefirst-api/pkg/types" runtimeTypes "github.com/kubefirst/kubefirst-api/pkg/types" "github.com/kubefirst/kubefirst/internal/cluster" "github.com/kubefirst/kubefirst/internal/progress" @@ -15,10 +16,11 @@ "github.com/rs/zerolog/log" ) -func CreateMgmtCluster(gitAuth runtimeTypes.GitAuth, cliFlags types.CliFlags) { +func CreateMgmtCluster(gitAuth runtimeTypes.GitAuth, cliFlags types.CliFlags, catalogApps []apiTypes.GitopsCatalogApp) { clusterRecord := utilities.CreateClusterDefinitionRecordFromRaw( gitAuth, cliFlags, + catalogApps, ) clusterCreated, err := cluster.GetCluster(clusterRecord.ClusterName) @@ -38,5 +40,5 @@ cluster.CreateCluster(clusterRecord) } - progress.StartProvisioning(clusterRecord.ClusterName, 35) + progress.StartProvisioning(clusterRecord.ClusterName) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/provisionLogs/command.go new/kubefirst-2.3.8/internal/provisionLogs/command.go --- old/kubefirst-2.3.7/internal/provisionLogs/command.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubefirst-2.3.8/internal/provisionLogs/command.go 2024-02-21 18:18:38.000000000 +0100 @@ -0,0 +1,64 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package provisionLogs + +import ( + "encoding/json" + "fmt" + "strings" + "time" + + "github.com/muesli/termenv" +) + +type Log struct { + Level string `bson:"level" json:"level"` + Time string `bson:"time" json:"time"` + Message string `bson:"message" json:"message"` +} + +var ( + color = termenv.EnvColorProfile().Color + infoStyle = termenv.Style{}.Foreground(color("27")).Styled + errorStyle = termenv.Style{}.Foreground(color("196")).Styled + timeStyle = termenv.Style{}.Foreground(color("245")).Bold().Styled + textStyle = termenv.Style{}.Foreground(color("15")).Styled +) + +func AddLog(logMsg string) { + log := Log{} + formatterMsg := "" + + err := json.Unmarshal([]byte(logMsg), &log) + if err != nil { + formatterMsg = textStyle(logMsg) + } else { + parsedTime, err := time.Parse(time.RFC3339, log.Time) + if err != nil { + fmt.Println("Error parsing date:", err) + return + } + + // Format the parsed time into the desired format + formattedDateStr := parsedTime.Format("2006-01-02 15:04:05") + + timeLog := timeStyle(formattedDateStr) + level := infoStyle(strings.ToUpper(log.Level)) + + if log.Level == "error" { + level = errorStyle(strings.ToUpper(log.Level)) + } + + message := textStyle(log.Message) + + formatterMsg = fmt.Sprintf("%s %s: %s", timeLog, level, message) + } + + renderedMessage := formatterMsg + + ProvisionLogs.Send(logMessage{message: renderedMessage}) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/provisionLogs/constants.go new/kubefirst-2.3.8/internal/provisionLogs/constants.go --- old/kubefirst-2.3.7/internal/provisionLogs/constants.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubefirst-2.3.8/internal/provisionLogs/constants.go 2024-02-21 18:18:38.000000000 +0100 @@ -0,0 +1,29 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package provisionLogs + +import ( + "time" + + "github.com/charmbracelet/lipgloss" +) + +const ( + padding = 2 + maxWidth = 80 +) + +const debounceDuration = time.Second * 10 + +var ( + currentPkgNameStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("211")) + doneStyle = lipgloss.NewStyle().Margin(1, 2) + checkMark = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).SetString("â") + helpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#626262")).Render + StatusStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FFFFFF")).Bold(true).Render + spinnerStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("69")) +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/provisionLogs/message.go new/kubefirst-2.3.8/internal/provisionLogs/message.go --- old/kubefirst-2.3.7/internal/provisionLogs/message.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubefirst-2.3.8/internal/provisionLogs/message.go 2024-02-21 18:18:38.000000000 +0100 @@ -0,0 +1,31 @@ +/* +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/kubefirst/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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/provisionLogs/provisionLogs.go new/kubefirst-2.3.8/internal/provisionLogs/provisionLogs.go --- old/kubefirst-2.3.7/internal/provisionLogs/provisionLogs.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubefirst-2.3.8/internal/provisionLogs/provisionLogs.go 2024-02-21 18:18:38.000000000 +0100 @@ -0,0 +1,57 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package provisionLogs + +import ( + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/lipgloss" +) + +var quitStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render + +var ProvisionLogs *tea.Program + +func NewModel() provisionLogsModel { + return provisionLogsModel{} +} + +// Bubbletea functions +func InitializeProvisionLogsTerminal() { + ProvisionLogs = tea.NewProgram(NewModel()) +} + +func (m provisionLogsModel) Init() tea.Cmd { + return nil +} + +func (m provisionLogsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + switch msg := msg.(type) { + case tea.KeyMsg: + switch msg.String() { + case "ctrl+c": + return m, tea.Quit + default: + return m, nil + } + + case logMessage: + m.logs = append(m.logs, msg.message) + return m, nil + + default: + return m, nil + } +} + +func (m provisionLogsModel) View() string { + logs := "" + for i := 0; i < len(m.logs); i++ { + logs = logs + m.logs[i] + "\n" + } + + return logs + "\n" + quitStyle("ctrl+c to quit") + "\n" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/provisionLogs/types.go new/kubefirst-2.3.8/internal/provisionLogs/types.go --- old/kubefirst-2.3.7/internal/provisionLogs/types.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubefirst-2.3.8/internal/provisionLogs/types.go 2024-02-21 18:18:38.000000000 +0100 @@ -0,0 +1,17 @@ +/* +Copyright (C) 2021-2023, Kubefirst + +This program is licensed under MIT. +See the LICENSE file for more details. +*/ +package provisionLogs + +// Terminal model +type provisionLogsModel struct { + logs []string +} + +// Bubbletea messsages +type logMessage struct { + message string +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/types/flags.go new/kubefirst-2.3.8/internal/types/flags.go --- old/kubefirst-2.3.7/internal/types/flags.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/types/flags.go 2024-02-21 18:18:38.000000000 +0100 @@ -15,6 +15,7 @@ ClusterType string DnsProvider string DomainName string + SubDomainName string GitProvider string GitProtocol string GithubOrg string @@ -26,4 +27,5 @@ Ecr bool NodeType string NodeCount string + InstallCatalogApps string } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/types/proxy.go new/kubefirst-2.3.8/internal/types/proxy.go --- old/kubefirst-2.3.7/internal/types/proxy.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/types/proxy.go 2024-02-21 18:18:38.000000000 +0100 @@ -6,11 +6,13 @@ */ package types -import "github.com/kubefirst/kubefirst-api/pkg/types" +import ( + apiTypes "github.com/kubefirst/kubefirst-api/pkg/types" +) type ProxyCreateClusterRequest struct { - Body types.ClusterDefinition `bson:"body" json:"body"` - Url string `bson:"url" json:"url"` + Body apiTypes.ClusterDefinition `bson:"body" json:"body"` + Url string `bson:"url" json:"url"` } type ProxyResetClusterRequest struct { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/utilities/flags.go new/kubefirst-2.3.8/internal/utilities/flags.go --- old/kubefirst-2.3.7/internal/utilities/flags.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/utilities/flags.go 2024-02-21 18:18:38.000000000 +0100 @@ -42,6 +42,12 @@ return cliFlags, err } + subdomainFlag, err := cmd.Flags().GetString("subdomain") + if err != nil { + progress.Error(err.Error()) + return cliFlags, err + } + domainNameFlag, err := cmd.Flags().GetString("domain-name") if err != nil { progress.Error(err.Error()) @@ -98,6 +104,12 @@ return cliFlags, err } + installCatalogAppsFlag, err := cmd.Flags().GetString("install-catalog-apps") + if err != nil { + progress.Error(err.Error()) + return cliFlags, err + } + nodeCountFlag, err := cmd.Flags().GetString("node-count") if err != nil { progress.Error(err.Error()) @@ -128,6 +140,7 @@ cliFlags.CloudRegion = cloudRegionFlag cliFlags.ClusterName = clusterNameFlag cliFlags.DnsProvider = dnsProviderFlag + cliFlags.SubDomainName = subdomainFlag cliFlags.DomainName = domainNameFlag cliFlags.GitProtocol = gitProtocolFlag cliFlags.GitProvider = gitProviderFlag @@ -139,6 +152,7 @@ cliFlags.CloudProvider = cloudProvider cliFlags.NodeType = nodeTypeFlag cliFlags.NodeCount = nodeCountFlag + cliFlags.InstallCatalogApps = installCatalogAppsFlag viper.Set("flags.alerts-email", cliFlags.AlertsEmail) viper.Set("flags.cluster-name", cliFlags.ClusterName) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/internal/utilities/utilities.go new/kubefirst-2.3.8/internal/utilities/utilities.go --- old/kubefirst-2.3.7/internal/utilities/utilities.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/internal/utilities/utilities.go 2024-02-21 18:18:38.000000000 +0100 @@ -7,10 +7,12 @@ package utilities import ( + "bufio" "encoding/json" "errors" "fmt" "io/ioutil" + "net/http" "os" "strconv" "time" @@ -47,7 +49,16 @@ exportFilePath = "/tmp/api/cluster/export" ) -func CreateClusterRecordFromRaw(useTelemetry bool, gitOwner string, gitUser string, gitToken string, gitlabOwnerGroupID int, gitopsTemplateURL string, gitopsTemplateBranch string) apiTypes.Cluster { +func CreateClusterRecordFromRaw( + useTelemetry bool, + gitOwner string, + gitUser string, + gitToken string, + gitlabOwnerGroupID int, + gitopsTemplateURL string, + gitopsTemplateBranch string, + catalogApps []apiTypes.GitopsCatalogApp, +) apiTypes.Cluster { cloudProvider := viper.GetString("kubefirst.cloud-provider") domainName := viper.GetString("flags.domain-name") gitProvider := viper.GetString("flags.git-provider") @@ -58,29 +69,30 @@ } cl := apiTypes.Cluster{ - ID: primitive.NewObjectID(), - CreationTimestamp: fmt.Sprintf("%v", time.Now().UTC()), - UseTelemetry: useTelemetry, - Status: "provisioned", - AlertsEmail: viper.GetString("flags.alerts-email"), - ClusterName: viper.GetString("flags.cluster-name"), - CloudProvider: cloudProvider, - CloudRegion: viper.GetString("flags.cloud-region"), - DomainName: domainName, - ClusterID: viper.GetString("kubefirst.cluster-id"), - ClusterType: "mgmt", - GitopsTemplateURL: gitopsTemplateURL, - GitopsTemplateBranch: gitopsTemplateBranch, - GitProvider: gitProvider, - GitHost: fmt.Sprintf("%s.com", gitProvider), - GitProtocol: viper.GetString("flags.git-protocol"), - DnsProvider: viper.GetString("flags.dns-provider"), - GitlabOwnerGroupID: gitlabOwnerGroupID, - AtlantisWebhookSecret: viper.GetString("secrets.atlantis-webhook"), - AtlantisWebhookURL: fmt.Sprintf("https://atlantis.%s/events", domainName), - KubefirstTeam: kubefirstTeam, - ArgoCDAuthToken: viper.GetString("components.argocd.auth-token"), - ArgoCDPassword: viper.GetString("components.argocd.password"), + ID: primitive.NewObjectID(), + CreationTimestamp: fmt.Sprintf("%v", time.Now().UTC()), + UseTelemetry: useTelemetry, + Status: "provisioned", + AlertsEmail: viper.GetString("flags.alerts-email"), + ClusterName: viper.GetString("flags.cluster-name"), + CloudProvider: cloudProvider, + CloudRegion: viper.GetString("flags.cloud-region"), + DomainName: domainName, + ClusterID: viper.GetString("kubefirst.cluster-id"), + ClusterType: "mgmt", + GitopsTemplateURL: gitopsTemplateURL, + GitopsTemplateBranch: gitopsTemplateBranch, + GitProvider: gitProvider, + GitHost: fmt.Sprintf("%s.com", gitProvider), + GitProtocol: viper.GetString("flags.git-protocol"), + DnsProvider: viper.GetString("flags.dns-provider"), + GitlabOwnerGroupID: gitlabOwnerGroupID, + AtlantisWebhookSecret: viper.GetString("secrets.atlantis-webhook"), + AtlantisWebhookURL: fmt.Sprintf("https://atlantis.%s/events", domainName), + KubefirstTeam: kubefirstTeam, + ArgoCDAuthToken: viper.GetString("components.argocd.auth-token"), + ArgoCDPassword: viper.GetString("components.argocd.password"), + PostInstallCatalogApps: catalogApps, GitAuth: apiTypes.GitAuth{ Token: gitToken, User: gitUser, @@ -124,7 +136,7 @@ return cl } -func CreateClusterDefinitionRecordFromRaw(gitAuth apiTypes.GitAuth, cliFlags types.CliFlags) apiTypes.ClusterDefinition { +func CreateClusterDefinitionRecordFromRaw(gitAuth apiTypes.GitAuth, cliFlags types.CliFlags, catalogApps []apiTypes.GitopsCatalogApp) apiTypes.ClusterDefinition { cloudProvider := viper.GetString("kubefirst.cloud-provider") domainName := viper.GetString("flags.domain-name") gitProvider := viper.GetString("flags.git-provider") @@ -140,19 +152,22 @@ } cl := apiTypes.ClusterDefinition{ - AdminEmail: viper.GetString("flags.alerts-email"), - ClusterName: viper.GetString("flags.cluster-name"), - CloudProvider: cloudProvider, - CloudRegion: viper.GetString("flags.cloud-region"), - DomainName: domainName, - Type: "mgmt", - NodeType: cliFlags.NodeType, - NodeCount: stringToIntNodeCount, - GitopsTemplateURL: cliFlags.GitopsTemplateURL, - GitopsTemplateBranch: cliFlags.GitopsTemplateBranch, - GitProvider: gitProvider, - GitProtocol: viper.GetString("flags.git-protocol"), - DnsProvider: viper.GetString("flags.dns-provider"), + AdminEmail: viper.GetString("flags.alerts-email"), + ClusterName: viper.GetString("flags.cluster-name"), + CloudProvider: cloudProvider, + CloudRegion: viper.GetString("flags.cloud-region"), + DomainName: domainName, + SubdomainName: cliFlags.SubDomainName, + Type: "mgmt", + NodeType: cliFlags.NodeType, + NodeCount: stringToIntNodeCount, + GitopsTemplateURL: cliFlags.GitopsTemplateURL, + GitopsTemplateBranch: cliFlags.GitopsTemplateBranch, + GitProvider: gitProvider, + GitProtocol: viper.GetString("flags.git-protocol"), + DnsProvider: viper.GetString("flags.dns-provider"), + LogFileName: viper.GetString("k1-paths.log-file-name"), + PostInstallCatalogApps: catalogApps, GitAuth: apiTypes.GitAuth{ Token: gitAuth.Token, User: gitAuth.User, @@ -240,3 +255,36 @@ 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 + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubefirst-2.3.7/main.go new/kubefirst-2.3.8/main.go --- old/kubefirst-2.3.7/main.go 2023-12-14 06:14:10.000000000 +0100 +++ new/kubefirst-2.3.8/main.go 2024-02-21 18:18:38.000000000 +0100 @@ -12,9 +12,9 @@ "os" "time" - "github.com/rs/zerolog" "golang.org/x/exp/slices" + zeroLog "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/kubefirst/kubefirst/cmd" @@ -27,7 +27,7 @@ func main() { argsWithProg := os.Args - bubbleTeaBlacklist := []string{"completion", "help", "--help", "-h"} + bubbleTeaBlacklist := []string{"completion", "help", "--help", "-h", "quota", "logs"} canRunBubbleTea := true if argsWithProg != nil { @@ -40,8 +40,39 @@ } } + config := configs.ReadConfig() + if err := pkg.SetupViper(config, true); err != nil { + stdLog.Panic(err) + } + now := time.Now() epoch := now.Unix() + logfileName := fmt.Sprintf("log_%d.log", epoch) + + isProvision := slices.Contains(argsWithProg, "create") + isLogs := slices.Contains(argsWithProg, "logs") + + // don't create a new log file for logs, using the previous one + if isLogs { + logfileName = viper.GetString("k1-paths.log-file-name") + } + + // use cluster name as filename + if isProvision { + clusterName := fmt.Sprint(epoch) + for i := 1; i < len(os.Args); i++ { + arg := os.Args[i] + + // Check if the argument is "--cluster-name" + if arg == "--cluster-name" && i+1 < len(os.Args) { + // Get the value of the cluster name + clusterName = os.Args[i+1] + break + } + } + + logfileName = fmt.Sprintf("log_%s.log", clusterName) + } homePath, err := os.UserHomeDir() if err != nil { @@ -66,7 +97,7 @@ } //* create session log file - logfile := fmt.Sprintf("%s/log_%d.log", logsFolder, epoch) + logfile := fmt.Sprintf("%s/%s", logsFolder, logfileName) logFileObj, err := pkg.OpenLogFile(logfile) if err != nil { stdLog.Panicf("unable to store log location, error is: %s - please verify the current user has write access to this directory", err) @@ -84,18 +115,14 @@ // this Go standard log is active to keep compatibility with current code base stdLog.SetOutput(logFileObj) stdLog.SetPrefix("LOG: ") - stdLog.SetFlags(stdLog.Ldate | stdLog.Lmicroseconds | stdLog.Llongfile) + stdLog.SetFlags(stdLog.Ldate) - // setup Zerolog - log.Logger = pkg.ZerologSetup(logFileObj, zerolog.InfoLevel) - - config := configs.ReadConfig() - if err = pkg.SetupViper(config); err != nil { - stdLog.Panic(err) - } + log.Logger = zeroLog.New(logFileObj).With().Timestamp().Logger() viper.Set("k1-paths.logs-dir", logsFolder) - viper.Set("k1-paths.log-file", fmt.Sprintf("%s/log_%d.log", logsFolder, epoch)) + viper.Set("k1-paths.log-file", logfile) + viper.Set("k1-paths.log-file-name", logfileName) + err = viper.WriteConfig() if err != nil { stdLog.Panicf("unable to set log-file-location, error is: %s", err) ++++++ kubefirst.obsinfo ++++++ --- /var/tmp/diff_new_pack.W2lxDO/_old 2024-02-25 14:06:43.486215377 +0100 +++ /var/tmp/diff_new_pack.W2lxDO/_new 2024-02-25 14:06:43.490215522 +0100 @@ -1,5 +1,5 @@ name: kubefirst -version: 2.3.7 -mtime: 1702530850 -commit: c816caa695e1569f83071544d9e98133f42649b5 +version: 2.3.8 +mtime: 1708535918 +commit: 9563f0522736cacc84464f2c55c420578ff7adb0 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/kubefirst/vendor.tar.gz /work/SRC/openSUSE:Factory/.kubefirst.new.1770/vendor.tar.gz differ: char 5, line 1