WIP: start adding values support
This commit is contained in:
@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"git.badhouseplants.net/allanger/shoebill/internal/config"
|
||||
"git.badhouseplants.net/allanger/shoebill/internal/config/release"
|
||||
@ -22,15 +23,12 @@ func ReadTheConfig(path string) (*config.Config, error) {
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
/*
|
||||
* First it must prepare the workdir
|
||||
* It must create a directorry and clone all the repos that are listed in the config
|
||||
*/
|
||||
func Reconcile(workdirPath, sshKeyPath string, conf *config.Config, dry bool) error {
|
||||
dir, err := workdir.CreateWorkdir(workdirPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Prepare repositories
|
||||
for _, repository := range conf.Repositories {
|
||||
if err := repository.ValidateURL(); err != nil {
|
||||
return err
|
||||
@ -39,17 +37,10 @@ func Reconcile(workdirPath, sshKeyPath string, conf *config.Config, dry bool) er
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
gh := githelper.NewGit(sshKeyPath)
|
||||
|
||||
for _, cluster := range conf.Clusters {
|
||||
/*
|
||||
* 1. Clone the cluster repo
|
||||
* 2. Check if repo is already configured
|
||||
* Yes -> Bootsrap the repo if it's not configured
|
||||
* - Create the lockfile
|
||||
* - ...
|
||||
* No -> Get the current state
|
||||
* 3. Turn the config file into the lockfile format and compare the actual to the desired
|
||||
*/
|
||||
fullPath := fmt.Sprintf("%s/%s", dir, cluster.Name)
|
||||
provider, err := providers.NewProvider(cluster.Provider, fullPath, gh)
|
||||
if err != nil {
|
||||
@ -59,10 +50,12 @@ func Reconcile(workdirPath, sshKeyPath string, conf *config.Config, dry bool) er
|
||||
if err := cluster.CloneRepo(gh, fullPath, dry); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = cluster.BootstrapRepo(gh, fullPath, dry)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
lockfileData, err := lockfile.NewFromFile(fullPath)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -78,11 +71,13 @@ func Reconcile(workdirPath, sshKeyPath string, conf *config.Config, dry bool) er
|
||||
}
|
||||
|
||||
hh := helmhelper.NewHelm()
|
||||
|
||||
for _, release := range conf.Releases {
|
||||
err := release.VersionHandler(workdirPath, hh)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
release.ValuesHandler(filepath.Dir(conf.ConfigPath))
|
||||
}
|
||||
|
||||
rsObj := release.FindReleaseByNames(cluster.Releases, conf.Releases)
|
||||
|
Reference in New Issue
Block a user