c2f079b4e3
* feat(helm): add helm chart backport to ce EE-1409 (#5425) * EE-1311 Helm Chart Backport from EE * backport to ce Co-authored-by: Matt Hook <hookenz@gmail.com> * feat(helm) helm chart backport from ee EE-1311 (#5436) * Add missing defaultHelmRepoUrl and mock testing * Backport EE-1477 * Backport updates to helm tests from EE * add https by default changes and ssl to tls renaming from EE * Port install integration test. Disabled by default to pass CI checks * merged changes from EE for the integration test * kube proxy whitelist updated to support internal helm install command Co-authored-by: zees-dev <dev.786zshan@gmail.com> * Pull in all changes from tech review in EE-943 * feat(helm): add helm chart backport to ce EE-1409 (#5425) * EE-1311 Helm Chart Backport from EE * backport to ce Co-authored-by: Matt Hook <hookenz@gmail.com> * Pull in all changes from tech review in EE-943 * added helm to sidebar after rebase, sync CE with EE * backport EE-1278, squashed, diffed, updated * helm install openapi spec update * resolved conflicts, updated code * - matching ee codebase at 0afe57034449ee0e9f333d92c252a13995a93019 - helm install using endpoint middleware - remove trailing slash from added/persisted helm repo urls * feat(helm) use libhelm url validator and improved path assembly EE-1554 (#5561) * feat(helm/userrepos) fix getting global repo for ordinary users EE-1562 (#5567) * feat(helm/userrepos) fix getting global repo for ordinary users EE-1562 * post review changes and further backported changes from EE * resolved conflicts, updated code * fixed helm_install handler unit test * user cannot add existing repo if suffix is '/' (#5571) * feat(helm/docs) fix broken swagger docs EE-1278 (#5572) * Fix swagger docs * minor correction * fix(helm): migrating code from user handler to helm handler (#5573) * - migrated user_helm_repos to helm endpoint handler - migrated api operations from user factory/service to helm factory/service - passing endpointId into helm service/factory as endpoint provider is deprecated * upgrade libhelm to hide secrets Co-authored-by: Matt Hook <hookenz@gmail.com> * removed duplicate file - due to merge conflict * dependency injection in helm factory Co-authored-by: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Co-authored-by: Matt Hook <hookenz@gmail.com>
64 lines
1.7 KiB
Go
64 lines
1.7 KiB
Go
package helm
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/portainer/libhelm/options"
|
|
httperror "github.com/portainer/libhttp/error"
|
|
"github.com/portainer/libhttp/request"
|
|
"github.com/portainer/libhttp/response"
|
|
)
|
|
|
|
// @id HelmList
|
|
// @summary List Helm Chart(s)
|
|
// @description
|
|
// @description **Access policy**: authorized
|
|
// @tags helm_chart
|
|
// @security jwt
|
|
// @accept json
|
|
// @produce json
|
|
// @param namespace query string true "specify an optional namespace"
|
|
// @param filter query string true "specify an optional filter"
|
|
// @param selector query string true "specify an optional selector"
|
|
// @success 200 {array} release.ReleaseElement "Success"
|
|
// @failure 400 "Invalid endpoint identifier"
|
|
// @failure 401 "Unauthorized"
|
|
// @failure 404 "Endpoint or ServiceAccount not found"
|
|
// @failure 500 "Server error"
|
|
// @router /endpoints/:id/kubernetes/helm [get]
|
|
func (handler *Handler) helmList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
|
|
clusterAccess, httperr := handler.getHelmClusterAccess(r)
|
|
if httperr != nil {
|
|
return httperr
|
|
}
|
|
|
|
listOpts := options.ListOptions{
|
|
KubernetesClusterAccess: clusterAccess,
|
|
}
|
|
|
|
params := r.URL.Query()
|
|
|
|
// optional namespace. The library defaults to "default"
|
|
namespace, _ := request.RetrieveQueryParameter(r, "namespace", true)
|
|
if namespace != "" {
|
|
listOpts.Namespace = namespace
|
|
}
|
|
|
|
// optional filter
|
|
if filter := params.Get("filter"); filter != "" {
|
|
listOpts.Filter = filter
|
|
}
|
|
|
|
// optional selector
|
|
if selector := params.Get("selector"); selector != "" {
|
|
listOpts.Selector = selector
|
|
}
|
|
|
|
releases, err := handler.helmPackageManager.List(listOpts)
|
|
if err != nil {
|
|
return &httperror.HandlerError{http.StatusInternalServerError, "Helm returned an error", err}
|
|
}
|
|
|
|
return response.JSON(w, releases)
|
|
}
|