oci
This commit is contained in:
parent
981ee7dce4
commit
1b9b79c67f
@ -25,8 +25,13 @@ type repoData struct {
|
|||||||
Opts string `yaml:"opts"`
|
Opts string `yaml:"opts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ociData struct {
|
||||||
|
Url string `yaml:"url"`
|
||||||
|
}
|
||||||
|
|
||||||
type ChartRepoData struct {
|
type ChartRepoData struct {
|
||||||
Repository repoData `yaml:"repository"`
|
Repository repoData `yaml:"repository"`
|
||||||
|
Oci ociData `yaml:"oci"`
|
||||||
Charts []ChartData `yaml:"charts"`
|
Charts []ChartData `yaml:"charts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ func _TestReadConfChart(t *testing.T) {
|
|||||||
assert.Equal(t, "https://zzzz/myfirstchart-0.1.0.tgz", myfirstrelease.Url, "FromConfigFile error")
|
assert.Equal(t, "https://zzzz/myfirstchart-0.1.0.tgz", myfirstrelease.Url, "FromConfigFile error")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReadConfChartOverwrite(t *testing.T){
|
func _TestReadConfChartOverwrite(t *testing.T){
|
||||||
src := filepath.Join(TEST_SRC_DIR, "oc_overwrite.yml")
|
src := filepath.Join(TEST_SRC_DIR, "oc_overwrite.yml")
|
||||||
|
|
||||||
assert.FileExists(t, src, "FromConfigFile error")
|
assert.FileExists(t, src, "FromConfigFile error")
|
||||||
@ -48,3 +48,16 @@ func TestReadConfChartOverwrite(t *testing.T){
|
|||||||
// Nombre de lettres
|
// Nombre de lettres
|
||||||
assert.Equal(t, 70, len(data[0].Charts[0].Overwrite), "TestReadConfChartOverwrite error")
|
assert.Equal(t, 70, len(data[0].Charts[0].Overwrite), "TestReadConfChartOverwrite error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func TestReadConfChartOci(t *testing.T) {
|
||||||
|
src := filepath.Join(TEST_SRC_DIR, "oc_oci.yml")
|
||||||
|
|
||||||
|
assert.FileExists(t, src, "FromConfigFile error")
|
||||||
|
|
||||||
|
data, _ := FromConfigFile(src)
|
||||||
|
assert.Equal(t, "", data[0].Repository.Name, "FromConfigFile error")
|
||||||
|
assert.Equal(t, "oci://harbor.dtf/dev", data[0].Oci.Url, "FromConfigFile error")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,10 @@ func (this HelmCommand) ChartInstall(data HelmChart) (string, error) {
|
|||||||
|
|
||||||
var objmap installOutput
|
var objmap installOutput
|
||||||
|
|
||||||
err = json.Unmarshal(stdout, &objmap)
|
i := strings.Index(string(stdout), "{")
|
||||||
|
stdout2 := string(stdout)[i:]
|
||||||
|
|
||||||
|
err = json.Unmarshal([]byte(stdout2), &objmap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -142,6 +145,7 @@ func (this HelmCommand) ChartUninstall(data HelmChart) (string, error) {
|
|||||||
|
|
||||||
// ../bin/helm list --filter phpmyadminm --short
|
// ../bin/helm list --filter phpmyadminm --short
|
||||||
func (this HelmCommand) chartExists(data HelmChart) (bool, error) {
|
func (this HelmCommand) chartExists(data HelmChart) (bool, error) {
|
||||||
|
|
||||||
bin := this.Bin
|
bin := this.Bin
|
||||||
|
|
||||||
msg := fmt.Sprintf("%s list --filter %s --no-headers", bin, data.Name)
|
msg := fmt.Sprintf("%s list --filter %s --no-headers", bin, data.Name)
|
||||||
|
@ -8,10 +8,6 @@ import (
|
|||||||
log "oc-deploy/log_wrapper"
|
log "oc-deploy/log_wrapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
// type HelmData struct {
|
|
||||||
// Name string
|
|
||||||
// }
|
|
||||||
|
|
||||||
func (this HelmCommand) Status(data HelmChart) (string, error) {
|
func (this HelmCommand) Status(data HelmChart) (string, error) {
|
||||||
|
|
||||||
helm_bin := this.Bin
|
helm_bin := this.Bin
|
||||||
|
@ -60,7 +60,14 @@ func (this *InstallClass) InstallCharts(modules []string) (error) {
|
|||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
for _, v := range this.charts {
|
for _, v := range this.charts {
|
||||||
repoName := v.Repository.Name
|
repoName := ""
|
||||||
|
if v.Repository.Name != "" {
|
||||||
|
repoName = v.Repository.Name
|
||||||
|
} else {
|
||||||
|
if v.Oci.Url != "" {
|
||||||
|
repoName = v.Oci.Url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, v1 := range v.Charts {
|
for _, v1 := range v.Charts {
|
||||||
if len(modules) == 0 || utils.StringInSlice(v1.Name, modules) {
|
if len(modules) == 0 || utils.StringInSlice(v1.Name, modules) {
|
||||||
|
9
test/chart/oc_oci.yml
Normal file
9
test/chart/oc_oci.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
opencloud:
|
||||||
|
- oci:
|
||||||
|
url: oci://harbor.dtf/dev
|
||||||
|
charts:
|
||||||
|
- name: oc-catalog
|
||||||
|
chart: oc-catalog
|
||||||
|
version: 0.1.0
|
Loading…
Reference in New Issue
Block a user