Optimize single release getting (#373)

* Optimize single release getting

* Disable unused releases getting

* fix build

* Remove unused code completely
This commit is contained in:
Andrey Pokhilko
2023-06-23 10:18:44 +01:00
committed by GitHub
parent 14abc28c7d
commit 4e2d3186a1
2 changed files with 18 additions and 32 deletions

View File

@@ -23,7 +23,6 @@ import (
"gopkg.in/yaml.v3"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/repo"
helmtime "helm.sh/helm/v3/pkg/time"
"k8s.io/utils/strings/slices"
)
@@ -278,14 +277,6 @@ func (h *HelmHandler) RepoCharts(c *gin.Context) {
return
}
installed, err := app.Releases.List()
if err != nil {
_ = c.AbortWithError(http.StatusInternalServerError, err)
return
}
enrichRepoChartsWithInstalled(charts, installed)
sort.Slice(charts, func(i, j int) bool {
return charts[i].Name < charts[j].Name
})
@@ -293,19 +284,6 @@ func (h *HelmHandler) RepoCharts(c *gin.Context) {
c.IndentedJSON(http.StatusOK, charts)
}
func enrichRepoChartsWithInstalled(charts []*repo.ChartVersion, installed []*objects.Release) {
for _, rchart := range charts {
for _, rel := range installed {
if rchart.Metadata.Name == rel.Orig.Chart.Name() {
log.Debugf("Matched") // TODO: restore implementation
// TODO: there can be more than one
//rchart.InstalledNamespace = rel.Orig.Namespace
//rchart.InstalledName = rel.Orig.Name
}
}
}
}
func (h *HelmHandler) RepoUpdate(c *gin.Context) {
app := h.GetApp(c)
if app == nil {