(repo, chart, version string)
| 64 | } |
| 65 | |
| 66 | func (r Repo) LoadHelmChartInitialValues(repo, chart, version string) (map[string]interface{}, error) { |
| 67 | var err error |
| 68 | strictVersion := version |
| 69 | if !isValidVersion(version) { |
| 70 | strictVersion, err = getRepoStrictVersion(repo, chart, version) |
| 71 | if err != nil { |
| 72 | return nil, err |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | cached, ok := r.cache.GetTemplateInitialValues(repo, chart, strictVersion, string(cyclopsv1alpha1.TemplateSourceTypeHelm)) |
| 77 | if ok { |
| 78 | return cached, nil |
| 79 | } |
| 80 | |
| 81 | tgzData, err := r.loadFromHelmChartRepo(repo, chart, version) |
| 82 | if err != nil { |
| 83 | return nil, err |
| 84 | } |
| 85 | |
| 86 | extractedFiles, err := unpackTgzInMemory(tgzData) |
| 87 | if err != nil { |
| 88 | return nil, err |
| 89 | } |
| 90 | |
| 91 | initial, err := r.mapHelmChartInitialValues(extractedFiles) |
| 92 | if err != nil { |
| 93 | return nil, err |
| 94 | } |
| 95 | |
| 96 | r.cache.SetTemplateInitialValues(repo, chart, strictVersion, string(cyclopsv1alpha1.TemplateSourceTypeHelm), initial) |
| 97 | |
| 98 | return initial, nil |
| 99 | } |
| 100 | |
| 101 | func IsHelmRepo(repo string) (bool, error) { |
| 102 | indexURL, err := url.JoinPath(repo, "index.yaml") |
no test coverage detected