Skip to content

Commit 4d5da19

Browse files
authored
Merge pull request #896 from rackerlabs/understack-bin
feat(cli): nest commands under 'deploy' and rename 'init' to 'quickstart'
2 parents df367da + 6c14651 commit 4d5da19

File tree

29 files changed

+256
-300
lines changed

29 files changed

+256
-300
lines changed

go/understack/.goreleaser.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

go/understack/cmd/root.go

Lines changed: 0 additions & 101 deletions
This file was deleted.

go/understack/main.go

Lines changed: 0 additions & 22 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

go/understack/README.md renamed to go/understackctl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export UC_AIO=yes
2121
* Run
2222

2323
```
24-
go run *.go init
24+
go run *.go quickstart
2525
go run *.go help
2626
```
2727

go/understack/cmd/argocd/secrets.go renamed to go/understackctl/cmd/argocd/argocd.go

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"os"
77
"path/filepath"
88

9-
"github.com/rackerlabs/understack/go/understack/cmd"
10-
"github.com/rackerlabs/understack/go/understack/helpers"
9+
"github.com/rackerlabs/understack/go/understackctl/helpers"
1110

1211
"github.com/charmbracelet/log"
1312
"github.com/gookit/goutil/envutil"
@@ -28,24 +27,22 @@ const (
2827
argoNamespace = "argocd"
2928
)
3029

31-
var ArgoCMD = &cobra.Command{
32-
Use: "argocd-secrets",
33-
Short: "Generate ArgoCD secrets",
34-
Long: "Generate repository and cluster secrets for ArgoCD deployment",
35-
Run: func(cmd *cobra.Command, args []string) {
36-
if err := GenerateSecrets(); err != nil {
37-
log.Fatal("Failed to generate secrets", "error", err)
38-
os.Exit(1)
39-
}
40-
},
41-
}
42-
43-
func init() {
44-
cmd.RootCmd.AddCommand(ArgoCMD)
30+
func NewCmdArgocdSecret() *cobra.Command {
31+
return &cobra.Command{
32+
Use: "argocd-secrets",
33+
Short: "Generate ArgoCD secrets",
34+
Long: "Generate repository and cluster secrets for ArgoCD deployment",
35+
Run: func(cmd *cobra.Command, args []string) {
36+
if err := generateSecrets(); err != nil {
37+
log.Fatal("Failed to generate secrets", "error", err)
38+
os.Exit(1)
39+
}
40+
},
41+
}
4542
}
4643

47-
// GenerateSecrets orchestrates the generation of all ArgoCD secrets
48-
func GenerateSecrets() error {
44+
// generateSecrets orchestrates the generation of all ArgoCD secrets
45+
func generateSecrets() error {
4946
basePath := helpers.GetManifestPathToService("argocd")
5047

5148
if err := generateDeployRepoSecret(basePath); err != nil {
File renamed without changes.
File renamed without changes.

go/understack/cmd/certManager/secrets.go renamed to go/understackctl/cmd/certManager/certManger.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/rackerlabs/understack/go/understack/cmd"
9-
"github.com/rackerlabs/understack/go/understack/helpers"
8+
"github.com/rackerlabs/understack/go/understackctl/helpers"
109

1110
"github.com/charmbracelet/log"
1211
"github.com/gookit/goutil/envutil"
@@ -18,15 +17,13 @@ import (
1817
//go:embed templates/clusterIssuer.tmpl
1918
var clusterIssuerTemplate string
2019

21-
func init() {
22-
cmd.RootCmd.AddCommand(CertManager)
23-
}
24-
25-
var CertManager = &cobra.Command{
26-
Use: "certmanager-secrets",
27-
Short: "Generate certmanager-secrets secrets",
28-
Long: "",
29-
Run: certManagerGen,
20+
func NewCmdCertManagerSecret() *cobra.Command {
21+
return &cobra.Command{
22+
Use: "certmanager-secrets",
23+
Short: "Generate certmanager-secrets secrets",
24+
Long: "",
25+
Run: certManagerGen,
26+
}
3027
}
3128

3229
func certManagerGen(cmd *cobra.Command, args []string) {

0 commit comments

Comments
 (0)