Skip to content

Commit

Permalink
go fmt (#125)
Browse files Browse the repository at this point in the history
Signed-off-by: 6za <53096417+6za@users.noreply.github.com>
Signed-off-by: Thiago Pagotto <pagottoo@gmail.com>
  • Loading branch information
6za authored and pagottoo committed Jul 19, 2022
1 parent ad2f749 commit 17deeb9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 48 deletions.
47 changes: 19 additions & 28 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ to quickly create a Cobra application.`,
log.Printf("Commad Execution STDERR: %s", kPortForwardArgocdErrb.String())
log.Panicf("error: failed to port-forward to argocd in main thread %s", err)
}
}
}

// log.Println("sleeping for 45 seconds, hurry up jared")
// time.Sleep(45 * time.Second)
Expand Down Expand Up @@ -241,7 +241,7 @@ to quickly create a Cobra application.`,
progressPrinter.IncrementTracker("step-vault", 1)
}
progressPrinter.AddTracker("step-post-gitlab", "Finalize Gitlab updates", 5)
if !viper.GetBool("gitlab.oidc-created") {
if !viper.GetBool("gitlab.oidc-created") {
vault.AddGitlabOidcApplications(dryRun)
informUser("Added Gitlab OIDC")
progressPrinter.IncrementTracker("step-post-gitlab", 1)
Expand Down Expand Up @@ -322,7 +322,7 @@ to quickly create a Cobra application.`,
argocdPodClient := clientset.CoreV1().Pods("argocd")
argocdPodName := k8s.GetPodNameByLabel(argocdPodClient, "app.kubernetes.io/name=argocd-server")
kPortForwardArgocd.Process.Signal(syscall.SIGTERM)
informUser("deleting argocd-server pod")
informUser("deleting argocd-server pod")
k8s.DeletePodByName(argocdPodClient, argocdPodName)
}
informUser("waiting for argocd to be ready")
Expand Down Expand Up @@ -358,50 +358,41 @@ to quickly create a Cobra application.`,
sendCompleteInstallTelemetry(dryRun)
time.Sleep(time.Millisecond * 100)



// prepare data for the handoff report
clusterData := reports.CreateHandOff{
AwsAccountId: viper.GetString("aws.accountid"),
AwsHostedZoneName: viper.GetString("aws.hostedzonename"),
AwsRegion: viper.GetString("aws.region"),
ClusterName: viper.GetString("cluster-name"),

GitlabURL: fmt.Sprintf("https://gitlab.%s", viper.GetString("aws.hostedzonename")),
GitlabUser: "root" ,
GitlabPassword: viper.GetString("gitlab.token") ,
GitlabURL: fmt.Sprintf("https://gitlab.%s", viper.GetString("aws.hostedzonename")),
GitlabUser: "root",
GitlabPassword: viper.GetString("gitlab.token"),

RepoGitops: fmt.Sprintf("https://gitlab.%s/kubefirst/gitops", viper.GetString("aws.hostedzonename")),
RepoMetaphor: fmt.Sprintf("https://gitlab.%s/kubefirst/metaphor", viper.GetString("aws.hostedzonename")),
RepoGitops: fmt.Sprintf("https://gitlab.%s/kubefirst/gitops", viper.GetString("aws.hostedzonename")),
RepoMetaphor: fmt.Sprintf("https://gitlab.%s/kubefirst/metaphor", viper.GetString("aws.hostedzonename")),

VaultUrl: fmt.Sprintf("https://vault.%s", viper.GetString("aws.hostedzonename")),
VaultToken: viper.GetString("vault.token"),

VaultUrl: fmt.Sprintf("https://vault.%s", viper.GetString("aws.hostedzonename")),
VaultToken: viper.GetString("vault.token"),
ArgoCDUrl: fmt.Sprintf("https://argocd.%s", viper.GetString("aws.hostedzonename")),
ArgoCDUsername: viper.GetString("argocd.admin.username"),
ArgoCDPassword: viper.GetString("argocd.admin.password"),

ArgoWorkflowsUrl: fmt.Sprintf("https://argo.%s", viper.GetString("aws.hostedzonename")),
AtlantisUrl: fmt.Sprintf("https://atlantis.%s", viper.GetString("aws.hostedzonename")),
ChartMuseumUrl: fmt.Sprintf("https://chartmuseum.%s", viper.GetString("aws.hostedzonename")),

ArgoCDUrl: fmt.Sprintf("https://argocd.%s", viper.GetString("aws.hostedzonename")),
ArgoCDUsername: viper.GetString("argocd.admin.username"),
ArgoCDPassword: viper.GetString("argocd.admin.password"),

ArgoWorkflowsUrl: fmt.Sprintf("https://argo.%s", viper.GetString("aws.hostedzonename")),
AtlantisUrl: fmt.Sprintf("https://atlantis.%s", viper.GetString("aws.hostedzonename")),
ChartMuseumUrl: fmt.Sprintf("https://chartmuseum.%s", viper.GetString("aws.hostedzonename")),

MetaphorDevUrl: fmt.Sprintf("https://metaphor-development.%s", viper.GetString("aws.hostedzonename")),
MetaphorStageUrl: fmt.Sprintf("https://metaphor-staging.%s", viper.GetString("aws.hostedzonename")),
MetaphorProductionUrl: fmt.Sprintf("https://metaphor-production.%s", viper.GetString("aws.hostedzonename")),

MetaphorDevUrl: fmt.Sprintf("https://metaphor-development.%s", viper.GetString("aws.hostedzonename")),
MetaphorStageUrl: fmt.Sprintf("https://metaphor-staging.%s", viper.GetString("aws.hostedzonename")),
MetaphorProductionUrl: fmt.Sprintf("https://metaphor-production.%s", viper.GetString("aws.hostedzonename")),
}

// build the string that will be sent to the report
handOffData := reports.BuildCreateHandOffReport(clusterData)
// call handoff report and apply style
reports.CommandSummary(handOffData)





},
}

Expand Down
38 changes: 18 additions & 20 deletions internal/reports/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,29 @@ type CreateHandOff struct {
AwsRegion string
ClusterName string

GitlabURL string
GitlabUser string
GitlabPassword string

RepoGitops string
RepoMetaphor string
GitlabURL string
GitlabUser string
GitlabPassword string

VaultUrl string
VaultToken string
RepoGitops string
RepoMetaphor string

ArgoCDUrl string
ArgoCDUsername string
ArgoCDPassword string
VaultUrl string
VaultToken string

ArgoWorkflowsUrl string
ArgoCDUrl string
ArgoCDUsername string
ArgoCDPassword string

AtlantisUrl string
ArgoWorkflowsUrl string

ChartMuseumUrl string

MetaphorDevUrl string
MetaphorStageUrl string
MetaphorProductionUrl string
AtlantisUrl string

ChartMuseumUrl string

MetaphorDevUrl string
MetaphorStageUrl string
MetaphorProductionUrl string
}

func BuildCreateHandOffReport(clusterData CreateHandOff) bytes.Buffer {
Expand All @@ -60,8 +58,8 @@ func BuildCreateHandOffReport(clusterData CreateHandOff) bytes.Buffer {
handOffData.WriteString(fmt.Sprintf("\n username: %s", clusterData.GitlabUser))
handOffData.WriteString(fmt.Sprintf("\n password: %s", clusterData.GitlabPassword))
handOffData.WriteString("\n Repos: ")
handOffData.WriteString(fmt.Sprintf("\n %s",clusterData.RepoGitops))
handOffData.WriteString(fmt.Sprintf("\n %s",clusterData.RepoMetaphor))
handOffData.WriteString(fmt.Sprintf("\n %s", clusterData.RepoGitops))
handOffData.WriteString(fmt.Sprintf("\n %s", clusterData.RepoMetaphor))
//handOffData.WriteString(strings.Repeat("-", 70))

handOffData.WriteString("\n--- Vault ")
Expand Down

0 comments on commit 17deeb9

Please sign in to comment.