Skip to content

Commit

Permalink
signed commits
Browse files Browse the repository at this point in the history
return nil fix

rebased

changed sequence

rebased vultr

rebased vultr-1

resolve suggestions

remove local dependency
  • Loading branch information
jokestax committed Aug 20, 2024
1 parent 4254c0c commit 3e1139d
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 69 deletions.
8 changes: 4 additions & 4 deletions cmd/akamai/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ func Create() *cobra.Command {
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(&gitopsRepoName, "gitopsRepoName", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphorRepoName", "metaphor", "the custom metpahor name")
createCmd.Flags().StringVar(&adminTeamName, "adminTeamName", "admins", "admin team name for this repo ")
createCmd.Flags().StringVar(&developerTeamName, "developerTeamName", "developers", " developer team name for this repo")
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().StringVar(&gitopsRepoName, "gitops-repo-name", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphor-repo-name", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "admin-team-name", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developer-team-name", "developers", "developer team name for this repo")

return createCmd
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/aws/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ func Create() *cobra.Command {
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(&gitopsRepoName, "gitopsRepoName", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphorRepoName", "metaphor", "the custom metpahor name")
createCmd.Flags().StringVar(&adminTeamName, "adminTeamName", "admins", "admin team name for this repo ")
createCmd.Flags().StringVar(&developerTeamName, "developerTeamName", "developers", " developer team name for this repo")
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")
createCmd.Flags().BoolVar(&installKubefirstProFlag, "install-kubefirst-pro", true, "whether or not to install kubefirst pro")
createCmd.Flags().StringVar(&gitopsRepoName, "gitops-repo-name", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphor-repo-name", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "admin-team-name", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developer-team-name", "developers", "developer team name for this repo")

return createCmd
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/civo/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ func Create() *cobra.Command {
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(&gitopsRepoName, "gitopsRepoName", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphorRepoName", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "adminTeamName", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developerTeamName", "developers", "developer team name for this repo")
createCmd.Flags().StringVar(&gitopsRepoName, "gitops-repo-name", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphor-repo-name", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "admin-team-name", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developer-team-name", "developers", "developer team name for this repo")
createCmd.Flags().StringVar(&gitProviderFlag, "git-provider", "github", fmt.Sprintf("the git provider - one of: %s", supportedGitProviders))
createCmd.Flags().StringVar(&gitProtocolFlag, "git-protocol", "ssh", fmt.Sprintf("the git protocol - one of: %s", supportedGitProtocolOverride))
createCmd.Flags().StringVar(&githubOrgFlag, "github-org", "", "the GitHub organization for the new gitops and metaphor repositories - required if using github")
Expand Down
8 changes: 4 additions & 4 deletions cmd/digitalocean/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ func Create() *cobra.Command {
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(&gitopsRepoName, "gitopsRepoName", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphorRepoName", "metaphor", "the custom metpahor name")
createCmd.Flags().StringVar(&adminTeamName, "adminTeamName", "admins", "admin team name for this repo ")
createCmd.Flags().StringVar(&developerTeamName, "developerTeamName", "developers", " developer team name for this repo")
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(&installKubefirstProFlag, "install-kubefirst-pro", true, "whether or not to install kubefirst pro")
createCmd.Flags().StringVar(&gitopsRepoName, "gitops-repo-name", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphor-repo-name", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "admin-team-name", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developer-team-name", "developers", "developer team name for this repo")

return createCmd
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/google/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ func Create() *cobra.Command {
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(&gitopsRepoName, "gitopsRepoName", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphorRepoName", "metaphor", "the custom metpahor name")
createCmd.Flags().StringVar(&adminTeamName, "adminTeamName", "admins", "admin team name for this repo ")
createCmd.Flags().StringVar(&developerTeamName, "developerTeamName", "developers", " developer team name for this repo")
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)")
createCmd.Flags().BoolVar(&installKubefirstProFlag, "install-kubefirst-pro", true, "whether or not to install kubefirst pro")
createCmd.Flags().StringVar(&gitopsRepoName, "gitops-repo-name", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphor-repo-name", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "admin-team-name", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developer-team-name", "developers", "developer team name for this repo")

return createCmd
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/k3d/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ func Create() *cobra.Command {
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")
createCmd.Flags().StringVar(&gitopsRepoName, "gitopsRepoName", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphorRepoName", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "adminTeamName", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developerTeamName", "developers", "developer team name for this repo")
createCmd.Flags().StringVar(&gitopsRepoName, "gitops-repo-name", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphor-repo-name", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "admin-team-name", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developer-team-name", "developers", "developer team name for this repo")

return createCmd
}
Expand Down
40 changes: 19 additions & 21 deletions cmd/k3d/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
)

var (
Expand Down Expand Up @@ -109,22 +110,22 @@ func runK3d(cmd *cobra.Command, args []string) error {
return err
}

gitopsRepoName, err := cmd.Flags().GetString("gitopsRepoName")
gitopsRepoName, err := cmd.Flags().GetString("gitops-repo-name")
if err != nil {
return err
}

metaphorRepoName, err := cmd.Flags().GetString("metaphorRepoName")
metaphorRepoName, err := cmd.Flags().GetString("metaphor-repo-name")
if err != nil {
return err
}

adminTeamName, err := cmd.Flags().GetString("adminTeamName")
adminTeamName, err := cmd.Flags().GetString("admin-team-name")
if err != nil {
return err
}

developerTeamName, err := cmd.Flags().GetString("developerTeamName")
developerTeamName, err := cmd.Flags().GetString("developer-team-name")
if err != nil {
return err
}
Expand Down Expand Up @@ -395,7 +396,7 @@ func runK3d(cmd *cobra.Command, args []string) error {
log.Info().Msgf("kubefirst version configs.K1Version: %s ", configs.K1Version)
log.Info().Msgf("cloning gitops-template repo url: %s ", gitopsTemplateURLFlag)
log.Info().Msgf("cloning gitops-template repo branch: %s ", gitopsTemplateBranchFlag)
log.Info().Msgf("branch %s\b", gitopsTemplateBranchFlag)
log.Info().Msgf("branch %s ", gitopsTemplateBranchFlag)
atlantisWebhookSecret := viper.GetString("secrets.atlantis-webhook")
if atlantisWebhookSecret == "" {
atlantisWebhookSecret = utils.Random(20)
Expand Down Expand Up @@ -625,9 +626,8 @@ func runK3d(cmd *cobra.Command, args []string) error {
progressPrinter.IncrementTracker("cloning-and-formatting-git-repositories", 1)
}

prep_err := k3d.TerraformPrep(config)

if prep_err != nil {
log.Info().Msg("Terraform Prep")
if prep_err := k3d.TerraformPrep(config); prep_err != nil {
return prep_err
}

Expand Down Expand Up @@ -1071,30 +1071,28 @@ func runK3d(cmd *cobra.Command, args []string) error {

err = k3d.RestartDeployment(context.Background(), kcfg.Clientset, "argocd", "argocd-applicationset-controller")
if err != nil {
return fmt.Errorf("Error in Restarting argocd controller %w", err)
return fmt.Errorf("error in restarting argocd controller %w", err)
}
retryAttempts := 2
for attempt := 1; attempt <= retryAttempts; attempt++ {
log.Info().Msgf("Attempt #%d to create Argo CD application...\n", attempt)

app, err := argocdClient.ArgoprojV1alpha1().Applications("argocd").Create(context.Background(), registryApplicationObject, metav1.CreateOptions{})
err = wait.PollImmediate(5*time.Second, 20*time.Second, func() (bool, error) {
_, err := argocdClient.ArgoprojV1alpha1().Applications("argocd").Create(context.Background(), registryApplicationObject, metav1.CreateOptions{})
if err != nil {
if attempt == retryAttempts {
return err
}
log.Info().Msgf("Error creating Argo CD application on attempt number #%d: %v\n", attempt, err)
time.Sleep(5 * time.Second)
continue
return false, nil
}
return true, nil
})

log.Info().Msgf("Argo CD application created successfully on attempt #%d: %s\n", attempt, app.Name)
break
if err != nil {
return fmt.Errorf("error creating argocd application : %w", err)
}

log.Info().Msg("Argo CD application created successfully\n")

viper.Set("kubefirst-checks.argocd-create-registry", true)
viper.WriteConfig()
telemetry.SendEvent(segClient, telemetry.CreateRegistryCompleted, "")
progressPrinter.IncrementTracker("installing-argo-cd", 1)

} else {
log.Info().Msg("argocd registry create already done, continuing")
progressPrinter.IncrementTracker("installing-argo-cd", 1)
Expand Down
8 changes: 6 additions & 2 deletions cmd/k3d/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ func destroyK3d(cmd *cobra.Command, args []string) error {

// Check for existing port forwards before continuing

gitopsRepoName, metaphorRepoName, _ := common.GetGitmeta(clusterName)
gitopsRepoName, metaphorRepoName, err := common.GetGitmeta(clusterName)

err := k8s.CheckForExistingPortForwards(9000)
if err != nil {
return fmt.Errorf("error in getting repo info: %w", err)
}

err = k8s.CheckForExistingPortForwards(9000)
if err != nil {
log.Error().Msgf("%s - this port is required to tear down your kubefirst environment - please close any existing port forwards before continuing", err.Error())
return fmt.Errorf("%s (maybe the handoff screen is still open in another terminal) - this port is required to tear down your kubefirst environment - please close any existing port forwards before continuing", err.Error())
Expand Down
7 changes: 6 additions & 1 deletion cmd/k3d/mkcert.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ func mkCert(cmd *cobra.Command, args []string) error {
return err
}

gitopsRepoName, metaphorRepoName, _ := common.GetGitmeta(viper.GetString("flags.cluster-name"))
gitopsRepoName, metaphorRepoName, err := common.GetGitmeta(viper.GetString("flags.cluster-name"))

if err != nil {
return fmt.Errorf("error in getting repo info: %w", err)
}

flags := utils.GetClusterStatusFlags()
if !flags.SetupComplete {
return fmt.Errorf("there doesn't appear to be an active k3d cluster")
Expand Down
7 changes: 6 additions & 1 deletion cmd/k3d/root-credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ func getK3dRootCredentials(cmd *cobra.Command, args []string) error {
gitProvider := viper.GetString("flags.git-provider")
gitProtocol := viper.GetString("flags.git-protocol")
gitOwner := viper.GetString(fmt.Sprintf("flags.%s-owner", gitProvider))
gitopsRepoName, metaphorRepoName, _ := common.GetGitmeta(clusterName)
gitopsRepoName, metaphorRepoName, err := common.GetGitmeta(clusterName)

if err != nil {
return fmt.Errorf("error in getting repo info: %w", err)
}

// Parse flags
a, err := cmd.Flags().GetBool("argocd")
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion cmd/k3d/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ func unsealVault(cmd *cobra.Command, args []string) error {
if !flags.SetupComplete {
return fmt.Errorf("there doesn't appear to be an active k3d cluster")
}
gitopsRepoName, metaphorRepoName, _ := common.GetGitmeta(viper.GetString("flags.cluster-name"))
gitopsRepoName, metaphorRepoName, err := common.GetGitmeta(viper.GetString("flags.cluster-name"))

if err != nil {
return fmt.Errorf("error in getting repo info: %w", err)
}

config := k3d.GetConfig(
viper.GetString("flags.cluster-name"),
flags.GitProvider,
Expand Down
8 changes: 4 additions & 4 deletions cmd/k3s/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ func Create() *cobra.Command {
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(&gitopsRepoName, "gitopsRepoName", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphorRepoName", "metaphor", "the custom metpahor name")
createCmd.Flags().StringVar(&adminTeamName, "adminTeamName", "admins", "admin team name for this repo ")
createCmd.Flags().StringVar(&developerTeamName, "developerTeamName", "developers", " developer team name for this repo")
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)")
createCmd.Flags().BoolVar(&installKubefirstProFlag, "install-kubefirst-pro", true, "whether or not to install kubefirst pro")
createCmd.Flags().StringVar(&gitopsRepoName, "gitops-repo-name", "gitops", "the custom gitops name")
createCmd.Flags().StringVar(&metaphorRepoName, "metaphor-repo-name", "metaphor", "the custom metaphor name")
createCmd.Flags().StringVar(&adminTeamName, "admin-team-name", "admins", "admin team name for this repo")
createCmd.Flags().StringVar(&developerTeamName, "developer-team-name", "developers", "developer team name for this repo")

return createCmd
}
Expand Down
Loading

0 comments on commit 3e1139d

Please sign in to comment.