blob: 5f98d2eb1c0a92e43263d5d926ad73ab40f78c09 [file] [log] [blame]
giof8843412024-05-22 16:38:05 +04001package installer
2
3import (
4 "strings"
5
6 helmv2 "github.com/fluxcd/helm-controller/api/v2"
7)
8
9type LocalChartGenerator interface {
10 Generate(path string) helmv2.HelmChartTemplateSpec
11}
12
13type GitRepositoryLocalChartGenerator struct {
14 Name string
15 Namespace string
16}
17
18func (g GitRepositoryLocalChartGenerator) Generate(path string) helmv2.HelmChartTemplateSpec {
19 p, _ := strings.CutPrefix(path, "/")
20 return helmv2.HelmChartTemplateSpec{
21 Chart: p,
22 SourceRef: helmv2.CrossNamespaceObjectReference{
23 Kind: "GitRepository",
24 Name: g.Name,
25 Namespace: g.Namespace,
26 },
27 }
28}
29
30type InfraLocalChartGenerator struct {
31 GitRepositoryLocalChartGenerator
32}
33
34func NewInfraLocalChartGenerator() InfraLocalChartGenerator {
35 return InfraLocalChartGenerator{GitRepositoryLocalChartGenerator{"dodo-flux", "dodo-flux"}}
36}