WIP: start adding values support

This commit is contained in:
Nikolai Rodionov
2023-09-22 13:02:56 +02:00
parent b2a43af042
commit beef71b128
7 changed files with 121 additions and 30 deletions

View File

@ -14,6 +14,7 @@ type Config struct {
Repositories repository.Repositories
Releases release.Releases
Clusters cluster.Clusters
ConfigPath string `yaml:"-"`
}
// NewConfigFromFile populates the config struct from a configuration yaml file
@ -27,5 +28,6 @@ func NewConfigFromFile(path string) (*Config, error) {
if err := yaml.Unmarshal(configFile, &config); err != nil {
return nil, err
}
config.ConfigPath = path
return &config, nil
}

View File

@ -3,6 +3,7 @@ package release
import (
"fmt"
"reflect"
"strings"
"git.badhouseplants.net/allanger/shoebill/internal/config/repository"
"git.badhouseplants.net/allanger/shoebill/internal/lockfile"
@ -21,6 +22,8 @@ type Release struct {
Version string
// Namespace to install release
Namespace string
// Value files
Values []string
// Private fields that should be pupulated during the run-time
RepositoryObj *repository.Repository `yaml:"-"`
}
@ -59,6 +62,12 @@ func (r *Release) VersionHandler(dir string, hh helmhelper.Helmhelper) error {
return nil
}
func (r *Release) ValuesHandler(dir string) {
for i := range r.Values {
r.Values[i] = fmt.Sprintf("%s/%s", dir, strings.ReplaceAll(r.Values[i], "./", ""))
}
}
func FindReleaseByNames(releases []string, releasesObj Releases) Releases {
result := Releases{}
for _, rObj := range releasesObj {