-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will use a new bootstrapping method more in line with CD-exclusive usecases. It works basically as follows: * set up a git submodule of our bootstrap repo w/ some base charts and terraform * template some of the variable settings from there into the installation repo * run terraform off those templates This will set up a management cluster and fully install console onto it. We can further extend this to do the full OSS app installation process on top of CD. The main benefits here are separating cluster provisioning concerns out of our purview (users will manually manage their own terraform after running up), and reduce our scope to just maintaining the helm chart updates for the console and our runtime via CD. It also makes reconfiguration more natural since the users can delink the submodule and take full ownership whenever needed.
- Loading branch information
1 parent
3233f98
commit 92132e4
Showing
18 changed files
with
350 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package plural | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/urfave/cli" | ||
|
||
"github.com/pluralsh/plural-cli/pkg/up" | ||
) | ||
|
||
const ( | ||
affirmUp = "Are you ready to set up your initial management cluster? You can check the generated terraform/helm to confirm everything looks good first" | ||
) | ||
|
||
func (p *Plural) handleUp(c *cli.Context) error { | ||
if err := p.handleInit(c); err != nil { | ||
return err | ||
} | ||
|
||
p.InitPluralClient() | ||
|
||
ctx, err := up.Build() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err := ctx.Generate(); err != nil { | ||
return err | ||
} | ||
|
||
if !affirm(affirmUp, "PLURAL_UP_AFFIRM_DEPLOY") { | ||
return fmt.Errorf("cancelled deploy") | ||
} | ||
|
||
return ctx.Deploy() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package up | ||
|
||
import ( | ||
"path/filepath" | ||
|
||
"github.com/pluralsh/plural-cli/pkg/config" | ||
"github.com/pluralsh/plural-cli/pkg/manifest" | ||
"github.com/pluralsh/plural-cli/pkg/provider" | ||
) | ||
|
||
type Context struct { | ||
Provider provider.Provider | ||
Manifest *manifest.ProjectManifest | ||
Config *config.Config | ||
} | ||
|
||
func Build() (*Context, error) { | ||
projPath, _ := filepath.Abs("workspace.yaml") | ||
project, err := manifest.ReadProject(projPath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
prov, err := provider.FromManifest(project) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
conf := config.Read() | ||
return &Context{ | ||
Provider: prov, | ||
Config: &conf, | ||
Manifest: project, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package up | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
func (ctx *Context) Deploy() error { | ||
if err := ctx.Provider.CreateBucket(); err != nil { | ||
return err | ||
} | ||
|
||
if err := terraform("./clusters", "init", "-upgrade"); err != nil { | ||
return err | ||
} | ||
|
||
return terraform("./clusters", "apply") | ||
} | ||
|
||
func terraform(dir, cmd string, args ...string) error { | ||
cmdArgs := append([]string{cmd}, args...) | ||
osCmd := exec.Command("terraform", cmdArgs...) | ||
osCmd.Dir = dir | ||
osCmd.Stdout = os.Stdout | ||
osCmd.Stderr = os.Stderr | ||
return osCmd.Run() | ||
} |
Oops, something went wrong.