values overwrite

This commit is contained in:
admju
2024-09-11 13:40:40 +00:00
parent 9561dc5493
commit c1134f7403
7 changed files with 100 additions and 79 deletions

View File

@@ -3,7 +3,6 @@ package install
import (
"fmt"
"sync"
"os"
log "oc-deploy/log_wrapper"
"oc-deploy/utils"
@@ -11,50 +10,17 @@ import (
"oc-deploy/chart"
"oc-deploy/helm"
"oc-deploy/kubectl"
"oc-deploy/versionOc"
)
type InstallClass struct {
Version string
Workspace string
tools []tool.ToolData
toolsBin map[string]string
charts []chart.ChartRepoData
commandHelm helm.HelmCommand
commandKubectl kubectl.KubectlCommand
}
func (this *InstallClass) NewInstall() (string, error) {
// Extraction du fichier de version
dst := fmt.Sprintf("%s/oc.yml", this.Workspace)
log.Log().Debug().Msg(fmt.Sprintf("Check du fichier de version : %s", dst))
if _, err := os.Stat(dst); err == nil {
log.Log().Debug().Msg("Existe déjà")
version, err := versionOc.GetFromFile(dst)
if err != nil {
return "", err
}
this.Version = version
} else {
log.Log().Debug().Msg("Téléchargement du fichier de version")
// version, fileversion, err := versionOc.Get(this.Version)
version, fileversion, err := versionOc.GetFromOnline(this.Version)
if err != nil {
return "", err
}
this.Version = version
err = utils.CopyContentFile(fileversion, dst)
if err != nil {
return "", err
}
// Extraction du fichier de la version
dst, err := this.extractVersion()
if err != nil {
return "", err
}
// Lecture du fichier de conf
var err error
this.tools, err = tool.FromConfigFile(dst)
if err != nil {
return dst, err
@@ -64,9 +30,6 @@ func (this *InstallClass) NewInstall() (string, error) {
return dst, err
}
bin_path, _ := this.getToolBin("helm")
fmt.Println("Install 67 bin_path", bin_path)
return dst, nil
}
@@ -124,7 +87,6 @@ func (this *InstallClass) installChart(chart chart.ChartData) {
Values: chart.Values,
FileValues: chart.FileValues}
res, err := this.commandHelm.ChartInstall(data)
if err != nil {
log.Log().Error().Msg(fmt.Sprintf(" >> %s %s (%s)", data.Name, "KO", err))