AppManager: cache helm charts and container images to local registry
Caching container images is disabled until we figure out how to run
container registry behind TLS.
Change-Id: I0253f2a862e5adddff18a82b102f67258151c070
diff --git a/core/installer/welcome/dodo_app.go b/core/installer/welcome/dodo_app.go
index 5eb2f58..251a379 100644
--- a/core/installer/welcome/dodo_app.go
+++ b/core/installer/welcome/dodo_app.go
@@ -18,6 +18,7 @@
client soft.Client
namespace string
env installer.EnvConfig
+ jc installer.JobCreator
workers map[string]struct{}
}
@@ -26,6 +27,7 @@
sshKey string,
client soft.Client,
namespace string,
+ jc installer.JobCreator,
env installer.EnvConfig,
) *DodoAppServer {
return &DodoAppServer{
@@ -34,6 +36,7 @@
client,
namespace,
env,
+ jc,
map[string]struct{}{},
}
}
@@ -64,7 +67,7 @@
}
go func() {
time.Sleep(20 * time.Second)
- if err := UpdateDodoApp(s.client, s.namespace, s.sshKey, &s.env); err != nil {
+ if err := UpdateDodoApp(s.client, s.namespace, s.sshKey, s.jc, &s.env); err != nil {
fmt.Println(err)
}
}()
@@ -90,16 +93,17 @@
fmt.Printf("registered worker: %s\n", req.Address)
}
-func UpdateDodoApp(client soft.Client, namespace string, sshKey string, env *installer.EnvConfig) error {
+func UpdateDodoApp(client soft.Client, namespace string, sshKey string, jc installer.JobCreator, env *installer.EnvConfig) error {
repo, err := client.GetRepo("app")
if err != nil {
return err
}
- nsCreator := installer.NewNoOpNamespaceCreator()
+ nsc := installer.NewNoOpNamespaceCreator()
if err != nil {
return err
}
- m, err := installer.NewAppManager(repo, nsCreator, "/.dodo")
+ hf := installer.NewGitHelmFetcher()
+ m, err := installer.NewAppManager(repo, nsc, jc, hf, "/.dodo")
if err != nil {
return err
}
@@ -112,10 +116,11 @@
if err != nil {
return err
}
+ lg := installer.GitRepositoryLocalChartGenerator{"app", namespace}
if _, err := m.Install(app, "app", "/.dodo/app", namespace, map[string]any{
"repoAddr": repo.FullAddress(),
"sshPrivateKey": sshKey,
- }, installer.WithConfig(env), installer.WithBranch("dodo")); err != nil {
+ }, installer.WithConfig(env), installer.WithBranch("dodo"), installer.WithLocalChartGenerator(lg)); err != nil {
return err
}
return nil