2017-05-23 18:56:10 +00:00
|
|
|
package handler
|
2016-12-18 05:21:29 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"strings"
|
2017-05-23 18:56:10 +00:00
|
|
|
|
2020-06-25 03:25:51 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/auth"
|
2021-04-06 10:08:43 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/backup"
|
2020-07-06 23:18:39 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/customtemplates"
|
2022-08-11 04:33:29 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/docker"
|
2020-05-14 02:14:28 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/edgegroups"
|
2020-06-25 03:25:51 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/edgejobs"
|
2020-05-14 02:14:28 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/edgestacks"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/edgetemplates"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/endpointedge"
|
2019-03-21 01:20:14 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/endpointgroups"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/endpointproxy"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/endpoints"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/file"
|
feat(helm/templates): helm app templates EE-943 (#5449)
* 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): list and configure helm chart (#5431)
* backport and tidyup code
* --amend
* using rocket icon for charts
* helm chart bugfix - clear category button
* added matomo analytics for helm chart install
* fix web editor exit warning without changes
* editor modified exit bugfix
* fixed notifications typo
* updated helm template text
* helper text to convey slow helm templates load
Co-authored-by: zees-dev <dev.786zshan@gmail.com>
* removing redundant time-consuming api call by using prop attribute
* 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
* added helm to sidebar after rebase, sync CE with EE
* bugfix: kubectl shell not opening - bearer token bug
* tidy go modules & remove yarn-error.log
* removed redundant handler (not used) - to match EE
* resolved merge conflicts, updated code
* feat(helm/views): helm release and application views EE-1236 (#5529)
* 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
* removed redundant handler (not used) - to match EE
* feat(helm) display helm charts - backend EE-1236
* copy over components for new applications view EE-1236
* Add new applications datatable component
* Add more migrated files
* removed test not applicable to CE
* baclkported EE app data table code to CE
* removed redundant helm repo url
* resolved conflicts, updated code
* using endpoint middleware
* PR review fixes
* using constants, openapi updated
Co-authored-by: Richard Wei <54336863+WaysonWei@users.noreply.github.com>
Co-authored-by: zees-dev <dev.786zshan@gmail.com>
* fixed test conflicts, go linted
* feat(helm/templates-add): helm templates add repo for user support EE-1278 (#5514)
* 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>
* kubernetes.templates -> kubernetes.templates.helm name conflict fix
* Validate the URL added as a public helm repo (#5579)
* fix(helm): helm app deletion fix EE-1581 (#5582)
* updated helm lib to show correct error on uninstall failure
* passing down helm app namespace on deletion
* fix(k8s): EE-1591 non-admin users cannot deploy charts containing secrets (#5590)
Co-authored-by: Simon Meng <simon.meng@portainer.io>
* fix(helm): helm epic bugfixes EE-1582 EE-1593 (#5585)
* - trim trailing slash and lowercase before persisting helm repo
- browser helm templates url /kubernetes/templates/templates -> /kubernetes/templates/helm
- fix publish url
- fix helm repo add refresh
- semi-fix k8s app expansion
* Tidy up swagger documentation related to helm. Make json consistent
* fixed helm release page for non-default namespaces
* k8s app view table expansion bugfix
* EE-1593: publish url load balancer fallback
Co-authored-by: Matt Hook <hookenz@gmail.com>
* k8s app list fix for charts with deployments containing multiple pods - which use the same label (#5599)
* fix(kubernetes): app list view fix for secrets with long keys or values EE-1600 (#5600)
* k8s app secrets key value text overflow ellipses
* wrapping key value pairs instead of ellipses
* fix(helm): helm apps bundling issue across different namespaces EE-1619 (#5602)
* helm apps bundling issue across different namespaces
* - code comments and indentation to ease reading
- moved namespace calc out of loop
* feat(helm/test) disable slow helm search test by default EE-1599 (#5598)
* skip helm_repo_search as it's an integration test
* switch to portainer built in integration test checker
* make module order match EE
* don't print test struct out when skipping integration test
Co-authored-by: Richard Wei <54336863+WaysonWei@users.noreply.github.com>
Co-authored-by: Matt Hook <hookenz@gmail.com>
Co-authored-by: cong meng <mcpacino@gmail.com>
Co-authored-by: Simon Meng <simon.meng@portainer.io>
2021-09-10 02:06:57 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/helm"
|
2022-01-23 19:48:04 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/hostmanagement/fdo"
|
2021-11-29 13:06:50 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/hostmanagement/openamt"
|
2021-08-05 03:02:06 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/kubernetes"
|
2021-10-06 22:59:53 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/ldap"
|
2019-03-21 01:20:14 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/motd"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/registries"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/resourcecontrols"
|
2020-06-25 03:25:51 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/roles"
|
2019-03-21 01:20:14 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/settings"
|
2021-08-10 04:59:47 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/ssl"
|
2019-03-21 01:20:14 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/stacks"
|
2021-11-03 10:41:59 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/storybook"
|
2022-12-11 06:58:22 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/system"
|
2019-03-21 01:20:14 +00:00
|
|
|
"github.com/portainer/portainer/api/http/handler/tags"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/teammemberships"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/teams"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/templates"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/upload"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/users"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/webhooks"
|
|
|
|
"github.com/portainer/portainer/api/http/handler/websocket"
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Handler is a collection of all the service handlers.
|
|
|
|
type Handler struct {
|
2022-12-01 06:40:52 +00:00
|
|
|
AuthHandler *auth.Handler
|
|
|
|
BackupHandler *backup.Handler
|
|
|
|
CustomTemplatesHandler *customtemplates.Handler
|
|
|
|
DockerHandler *docker.Handler
|
|
|
|
EdgeGroupsHandler *edgegroups.Handler
|
|
|
|
EdgeJobsHandler *edgejobs.Handler
|
|
|
|
EdgeStacksHandler *edgestacks.Handler
|
|
|
|
EdgeTemplatesHandler *edgetemplates.Handler
|
|
|
|
EndpointEdgeHandler *endpointedge.Handler
|
|
|
|
EndpointGroupHandler *endpointgroups.Handler
|
|
|
|
EndpointHandler *endpoints.Handler
|
|
|
|
EndpointHelmHandler *helm.Handler
|
|
|
|
EndpointProxyHandler *endpointproxy.Handler
|
|
|
|
HelmTemplatesHandler *helm.Handler
|
|
|
|
KubernetesHandler *kubernetes.Handler
|
|
|
|
FileHandler *file.Handler
|
|
|
|
LDAPHandler *ldap.Handler
|
|
|
|
MOTDHandler *motd.Handler
|
|
|
|
RegistryHandler *registries.Handler
|
|
|
|
ResourceControlHandler *resourcecontrols.Handler
|
|
|
|
RoleHandler *roles.Handler
|
|
|
|
SettingsHandler *settings.Handler
|
|
|
|
SSLHandler *ssl.Handler
|
|
|
|
OpenAMTHandler *openamt.Handler
|
|
|
|
FDOHandler *fdo.Handler
|
|
|
|
StackHandler *stacks.Handler
|
|
|
|
StorybookHandler *storybook.Handler
|
2022-12-11 06:58:22 +00:00
|
|
|
SystemHandler *system.Handler
|
2022-12-01 06:40:52 +00:00
|
|
|
TagHandler *tags.Handler
|
|
|
|
TeamMembershipHandler *teammemberships.Handler
|
|
|
|
TeamHandler *teams.Handler
|
|
|
|
TemplatesHandler *templates.Handler
|
|
|
|
UploadHandler *upload.Handler
|
|
|
|
UserHandler *users.Handler
|
|
|
|
WebSocketHandler *websocket.Handler
|
|
|
|
WebhookHandler *webhooks.Handler
|
2018-06-11 13:13:19 +00:00
|
|
|
}
|
2016-12-18 05:21:29 +00:00
|
|
|
|
2021-02-23 03:21:39 +00:00
|
|
|
// @title PortainerCE API
|
2023-03-08 00:24:59 +00:00
|
|
|
// @version 2.19.0
|
2021-02-23 03:21:39 +00:00
|
|
|
// @description.markdown api-description.md
|
|
|
|
// @termsOfService
|
|
|
|
|
|
|
|
// @contact.email info@portainer.io
|
|
|
|
|
2021-09-13 03:42:53 +00:00
|
|
|
// @license.name zlib
|
|
|
|
// @license.url https://github.com/portainer/portainer/blob/develop/LICENSE
|
2021-02-23 03:21:39 +00:00
|
|
|
|
|
|
|
// @host
|
|
|
|
// @BasePath /api
|
|
|
|
// @schemes http https
|
|
|
|
|
2021-11-30 02:31:16 +00:00
|
|
|
// @securitydefinitions.apikey ApiKeyAuth
|
|
|
|
// @in header
|
|
|
|
// @name Authorization
|
|
|
|
|
2021-02-23 03:21:39 +00:00
|
|
|
// @securitydefinitions.apikey jwt
|
|
|
|
// @in header
|
|
|
|
// @name Authorization
|
|
|
|
|
|
|
|
// @tag.name auth
|
|
|
|
// @tag.description Authenticate against Portainer HTTP API
|
|
|
|
// @tag.name custom_templates
|
|
|
|
// @tag.description Manage Custom Templates
|
|
|
|
// @tag.name edge_groups
|
|
|
|
// @tag.description Manage Edge Groups
|
|
|
|
// @tag.name edge_jobs
|
|
|
|
// @tag.description Manage Edge Jobs
|
|
|
|
// @tag.name edge_stacks
|
|
|
|
// @tag.description Manage Edge Stacks
|
|
|
|
// @tag.name edge_templates
|
|
|
|
// @tag.description Manage Edge Templates
|
|
|
|
// @tag.name edge
|
2021-09-20 00:14:22 +00:00
|
|
|
// @tag.description Manage Edge related environment(endpoint) settings
|
2021-02-23 03:21:39 +00:00
|
|
|
// @tag.name endpoints
|
2021-09-20 00:14:22 +00:00
|
|
|
// @tag.description Manage Docker environments(endpoints)
|
2021-02-23 03:21:39 +00:00
|
|
|
// @tag.name endpoint_groups
|
2021-09-20 00:14:22 +00:00
|
|
|
// @tag.description Manage environment(endpoint) groups
|
2021-08-05 03:02:06 +00:00
|
|
|
// @tag.name kubernetes
|
|
|
|
// @tag.description Manage Kubernetes cluster
|
2021-02-23 03:21:39 +00:00
|
|
|
// @tag.name motd
|
|
|
|
// @tag.description Fetch the message of the day
|
|
|
|
// @tag.name registries
|
|
|
|
// @tag.description Manage Docker registries
|
|
|
|
// @tag.name resource_controls
|
|
|
|
// @tag.description Manage access control on Docker resources
|
|
|
|
// @tag.name roles
|
|
|
|
// @tag.description Manage roles
|
|
|
|
// @tag.name settings
|
|
|
|
// @tag.description Manage Portainer settings
|
|
|
|
// @tag.name users
|
|
|
|
// @tag.description Manage users
|
|
|
|
// @tag.name tags
|
|
|
|
// @tag.description Manage tags
|
|
|
|
// @tag.name teams
|
|
|
|
// @tag.description Manage teams
|
|
|
|
// @tag.name team_memberships
|
|
|
|
// @tag.description Manage team memberships
|
|
|
|
// @tag.name templates
|
|
|
|
// @tag.description Manage App Templates
|
|
|
|
// @tag.name stacks
|
|
|
|
// @tag.description Manage stacks
|
2021-08-10 04:59:47 +00:00
|
|
|
// @tag.name ssl
|
|
|
|
// @tag.description Manage ssl settings
|
2021-02-23 03:21:39 +00:00
|
|
|
// @tag.name upload
|
|
|
|
// @tag.description Upload files
|
|
|
|
// @tag.name webhooks
|
|
|
|
// @tag.description Manage webhooks
|
|
|
|
// @tag.name websocket
|
|
|
|
// @tag.description Create exec sessions using websockets
|
2022-12-11 06:58:22 +00:00
|
|
|
// @tag.name status
|
|
|
|
// @tag.description Information about the Portainer instance
|
|
|
|
// @tag.name system
|
|
|
|
// @tag.description Manage Portainer system
|
2021-02-23 03:21:39 +00:00
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// ServeHTTP delegates a request to the appropriate subhandler.
|
|
|
|
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
2017-08-13 14:45:55 +00:00
|
|
|
switch {
|
2023-01-06 19:25:41 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/endpoints") && strings.Contains(r.URL.Path, "/edge/"):
|
|
|
|
h.EndpointEdgeHandler.ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/auth"):
|
2016-12-18 05:21:29 +00:00
|
|
|
http.StripPrefix("/api", h.AuthHandler).ServeHTTP(w, r)
|
2021-04-06 10:08:43 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/backup"):
|
|
|
|
http.StripPrefix("/api", h.BackupHandler).ServeHTTP(w, r)
|
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/restore"):
|
|
|
|
http.StripPrefix("/api", h.BackupHandler).ServeHTTP(w, r)
|
2020-07-06 23:18:39 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/custom_templates"):
|
|
|
|
http.StripPrefix("/api", h.CustomTemplatesHandler).ServeHTTP(w, r)
|
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/edge_stacks"):
|
|
|
|
http.StripPrefix("/api", h.EdgeStacksHandler).ServeHTTP(w, r)
|
2020-05-14 02:14:28 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/edge_groups"):
|
|
|
|
http.StripPrefix("/api", h.EdgeGroupsHandler).ServeHTTP(w, r)
|
2020-06-25 03:25:51 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/edge_jobs"):
|
|
|
|
http.StripPrefix("/api", h.EdgeJobsHandler).ServeHTTP(w, r)
|
2020-05-14 02:14:28 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/edge_templates"):
|
|
|
|
http.StripPrefix("/api", h.EdgeTemplatesHandler).ServeHTTP(w, r)
|
2018-04-26 16:08:46 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/endpoint_groups"):
|
|
|
|
http.StripPrefix("/api", h.EndpointGroupHandler).ServeHTTP(w, r)
|
2021-08-05 03:02:06 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/kubernetes"):
|
|
|
|
http.StripPrefix("/api", h.KubernetesHandler).ServeHTTP(w, r)
|
2022-08-24 22:27:02 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/docker"):
|
|
|
|
http.StripPrefix("/api/docker", h.DockerHandler).ServeHTTP(w, r)
|
feat(helm/templates): helm app templates EE-943 (#5449)
* 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): list and configure helm chart (#5431)
* backport and tidyup code
* --amend
* using rocket icon for charts
* helm chart bugfix - clear category button
* added matomo analytics for helm chart install
* fix web editor exit warning without changes
* editor modified exit bugfix
* fixed notifications typo
* updated helm template text
* helper text to convey slow helm templates load
Co-authored-by: zees-dev <dev.786zshan@gmail.com>
* removing redundant time-consuming api call by using prop attribute
* 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
* added helm to sidebar after rebase, sync CE with EE
* bugfix: kubectl shell not opening - bearer token bug
* tidy go modules & remove yarn-error.log
* removed redundant handler (not used) - to match EE
* resolved merge conflicts, updated code
* feat(helm/views): helm release and application views EE-1236 (#5529)
* 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
* removed redundant handler (not used) - to match EE
* feat(helm) display helm charts - backend EE-1236
* copy over components for new applications view EE-1236
* Add new applications datatable component
* Add more migrated files
* removed test not applicable to CE
* baclkported EE app data table code to CE
* removed redundant helm repo url
* resolved conflicts, updated code
* using endpoint middleware
* PR review fixes
* using constants, openapi updated
Co-authored-by: Richard Wei <54336863+WaysonWei@users.noreply.github.com>
Co-authored-by: zees-dev <dev.786zshan@gmail.com>
* fixed test conflicts, go linted
* feat(helm/templates-add): helm templates add repo for user support EE-1278 (#5514)
* 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>
* kubernetes.templates -> kubernetes.templates.helm name conflict fix
* Validate the URL added as a public helm repo (#5579)
* fix(helm): helm app deletion fix EE-1581 (#5582)
* updated helm lib to show correct error on uninstall failure
* passing down helm app namespace on deletion
* fix(k8s): EE-1591 non-admin users cannot deploy charts containing secrets (#5590)
Co-authored-by: Simon Meng <simon.meng@portainer.io>
* fix(helm): helm epic bugfixes EE-1582 EE-1593 (#5585)
* - trim trailing slash and lowercase before persisting helm repo
- browser helm templates url /kubernetes/templates/templates -> /kubernetes/templates/helm
- fix publish url
- fix helm repo add refresh
- semi-fix k8s app expansion
* Tidy up swagger documentation related to helm. Make json consistent
* fixed helm release page for non-default namespaces
* k8s app view table expansion bugfix
* EE-1593: publish url load balancer fallback
Co-authored-by: Matt Hook <hookenz@gmail.com>
* k8s app list fix for charts with deployments containing multiple pods - which use the same label (#5599)
* fix(kubernetes): app list view fix for secrets with long keys or values EE-1600 (#5600)
* k8s app secrets key value text overflow ellipses
* wrapping key value pairs instead of ellipses
* fix(helm): helm apps bundling issue across different namespaces EE-1619 (#5602)
* helm apps bundling issue across different namespaces
* - code comments and indentation to ease reading
- moved namespace calc out of loop
* feat(helm/test) disable slow helm search test by default EE-1599 (#5598)
* skip helm_repo_search as it's an integration test
* switch to portainer built in integration test checker
* make module order match EE
* don't print test struct out when skipping integration test
Co-authored-by: Richard Wei <54336863+WaysonWei@users.noreply.github.com>
Co-authored-by: Matt Hook <hookenz@gmail.com>
Co-authored-by: cong meng <mcpacino@gmail.com>
Co-authored-by: Simon Meng <simon.meng@portainer.io>
2021-09-10 02:06:57 +00:00
|
|
|
|
|
|
|
// Helm subpath under kubernetes -> /api/endpoints/{id}/kubernetes/helm
|
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/endpoints/") && strings.Contains(r.URL.Path, "/kubernetes/helm"):
|
|
|
|
http.StripPrefix("/api/endpoints", h.EndpointHelmHandler).ServeHTTP(w, r)
|
|
|
|
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/endpoints"):
|
2018-02-23 02:10:26 +00:00
|
|
|
switch {
|
2018-03-12 23:06:38 +00:00
|
|
|
case strings.Contains(r.URL.Path, "/docker/"):
|
2018-06-11 13:13:19 +00:00
|
|
|
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
2020-07-05 23:21:03 +00:00
|
|
|
case strings.Contains(r.URL.Path, "/kubernetes/"):
|
|
|
|
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
2020-06-09 02:43:32 +00:00
|
|
|
case strings.Contains(r.URL.Path, "/azure/"):
|
|
|
|
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
2021-08-20 03:04:28 +00:00
|
|
|
case strings.Contains(r.URL.Path, "/agent/"):
|
|
|
|
http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r)
|
2018-02-23 02:10:26 +00:00
|
|
|
default:
|
2017-07-20 14:22:27 +00:00
|
|
|
http.StripPrefix("/api", h.EndpointHandler).ServeHTTP(w, r)
|
|
|
|
}
|
2021-10-06 22:59:53 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/ldap"):
|
|
|
|
http.StripPrefix("/api", h.LDAPHandler).ServeHTTP(w, r)
|
2019-05-24 06:04:58 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/motd"):
|
|
|
|
http.StripPrefix("/api", h.MOTDHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/registries"):
|
2017-06-20 11:00:32 +00:00
|
|
|
http.StripPrefix("/api", h.RegistryHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/resource_controls"):
|
2018-06-11 13:13:19 +00:00
|
|
|
http.StripPrefix("/api", h.ResourceControlHandler).ServeHTTP(w, r)
|
2019-05-24 06:04:58 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/roles"):
|
|
|
|
http.StripPrefix("/api", h.RoleHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/settings"):
|
2016-12-18 05:21:29 +00:00
|
|
|
http.StripPrefix("/api", h.SettingsHandler).ServeHTTP(w, r)
|
2018-06-11 13:13:19 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/stacks"):
|
|
|
|
http.StripPrefix("/api", h.StackHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/status"):
|
2022-12-11 06:58:22 +00:00
|
|
|
http.StripPrefix("/api", h.SystemHandler).ServeHTTP(w, r)
|
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/system"):
|
|
|
|
http.StripPrefix("/api", h.SystemHandler).ServeHTTP(w, r)
|
2018-06-15 07:18:25 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/tags"):
|
|
|
|
http.StripPrefix("/api", h.TagHandler).ServeHTTP(w, r)
|
feat(helm/templates): helm app templates EE-943 (#5449)
* 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): list and configure helm chart (#5431)
* backport and tidyup code
* --amend
* using rocket icon for charts
* helm chart bugfix - clear category button
* added matomo analytics for helm chart install
* fix web editor exit warning without changes
* editor modified exit bugfix
* fixed notifications typo
* updated helm template text
* helper text to convey slow helm templates load
Co-authored-by: zees-dev <dev.786zshan@gmail.com>
* removing redundant time-consuming api call by using prop attribute
* 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
* added helm to sidebar after rebase, sync CE with EE
* bugfix: kubectl shell not opening - bearer token bug
* tidy go modules & remove yarn-error.log
* removed redundant handler (not used) - to match EE
* resolved merge conflicts, updated code
* feat(helm/views): helm release and application views EE-1236 (#5529)
* 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
* removed redundant handler (not used) - to match EE
* feat(helm) display helm charts - backend EE-1236
* copy over components for new applications view EE-1236
* Add new applications datatable component
* Add more migrated files
* removed test not applicable to CE
* baclkported EE app data table code to CE
* removed redundant helm repo url
* resolved conflicts, updated code
* using endpoint middleware
* PR review fixes
* using constants, openapi updated
Co-authored-by: Richard Wei <54336863+WaysonWei@users.noreply.github.com>
Co-authored-by: zees-dev <dev.786zshan@gmail.com>
* fixed test conflicts, go linted
* feat(helm/templates-add): helm templates add repo for user support EE-1278 (#5514)
* 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>
* kubernetes.templates -> kubernetes.templates.helm name conflict fix
* Validate the URL added as a public helm repo (#5579)
* fix(helm): helm app deletion fix EE-1581 (#5582)
* updated helm lib to show correct error on uninstall failure
* passing down helm app namespace on deletion
* fix(k8s): EE-1591 non-admin users cannot deploy charts containing secrets (#5590)
Co-authored-by: Simon Meng <simon.meng@portainer.io>
* fix(helm): helm epic bugfixes EE-1582 EE-1593 (#5585)
* - trim trailing slash and lowercase before persisting helm repo
- browser helm templates url /kubernetes/templates/templates -> /kubernetes/templates/helm
- fix publish url
- fix helm repo add refresh
- semi-fix k8s app expansion
* Tidy up swagger documentation related to helm. Make json consistent
* fixed helm release page for non-default namespaces
* k8s app view table expansion bugfix
* EE-1593: publish url load balancer fallback
Co-authored-by: Matt Hook <hookenz@gmail.com>
* k8s app list fix for charts with deployments containing multiple pods - which use the same label (#5599)
* fix(kubernetes): app list view fix for secrets with long keys or values EE-1600 (#5600)
* k8s app secrets key value text overflow ellipses
* wrapping key value pairs instead of ellipses
* fix(helm): helm apps bundling issue across different namespaces EE-1619 (#5602)
* helm apps bundling issue across different namespaces
* - code comments and indentation to ease reading
- moved namespace calc out of loop
* feat(helm/test) disable slow helm search test by default EE-1599 (#5598)
* skip helm_repo_search as it's an integration test
* switch to portainer built in integration test checker
* make module order match EE
* don't print test struct out when skipping integration test
Co-authored-by: Richard Wei <54336863+WaysonWei@users.noreply.github.com>
Co-authored-by: Matt Hook <hookenz@gmail.com>
Co-authored-by: cong meng <mcpacino@gmail.com>
Co-authored-by: Simon Meng <simon.meng@portainer.io>
2021-09-10 02:06:57 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/templates/helm"):
|
|
|
|
http.StripPrefix("/api", h.HelmTemplatesHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/templates"):
|
2016-12-18 05:21:29 +00:00
|
|
|
http.StripPrefix("/api", h.TemplatesHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/upload"):
|
2016-12-25 20:34:02 +00:00
|
|
|
http.StripPrefix("/api", h.UploadHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/users"):
|
|
|
|
http.StripPrefix("/api", h.UserHandler).ServeHTTP(w, r)
|
2021-08-10 04:59:47 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/ssl"):
|
|
|
|
http.StripPrefix("/api", h.SSLHandler).ServeHTTP(w, r)
|
2021-11-29 13:06:50 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/open_amt"):
|
2022-01-23 19:48:04 +00:00
|
|
|
http.StripPrefix("/api", h.OpenAMTHandler).ServeHTTP(w, r)
|
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/fdo"):
|
|
|
|
http.StripPrefix("/api", h.FDOHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/teams"):
|
|
|
|
http.StripPrefix("/api", h.TeamHandler).ServeHTTP(w, r)
|
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/team_memberships"):
|
|
|
|
http.StripPrefix("/api", h.TeamMembershipHandler).ServeHTTP(w, r)
|
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/websocket"):
|
2016-12-18 05:21:29 +00:00
|
|
|
http.StripPrefix("/api", h.WebSocketHandler).ServeHTTP(w, r)
|
2018-09-03 10:08:03 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/api/webhooks"):
|
|
|
|
http.StripPrefix("/api", h.WebhookHandler).ServeHTTP(w, r)
|
2021-11-03 10:41:59 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/storybook"):
|
|
|
|
http.StripPrefix("/storybook", h.StorybookHandler).ServeHTTP(w, r)
|
2017-08-13 14:45:55 +00:00
|
|
|
case strings.HasPrefix(r.URL.Path, "/"):
|
2016-12-18 05:21:29 +00:00
|
|
|
h.FileHandler.ServeHTTP(w, r)
|
|
|
|
}
|
|
|
|
}
|