Explorar o código

Merge branch '0.8.0-api-cleanup' of https://github.com/porter-dev/porter into 0.8.0-api-cleanup

mergin
Alexander Belanger %!s(int64=4) %!d(string=hai) anos
pai
achega
df767c7964

+ 44 - 0
api/server/authz/namespace.go

@@ -0,0 +1,44 @@
+package authz
+
+import (
+	"context"
+	"net/http"
+
+	"github.com/porter-dev/porter/api/server/authz/policy"
+	"github.com/porter-dev/porter/api/server/shared"
+	"github.com/porter-dev/porter/api/types"
+)
+
+type NamespaceScopedFactory struct {
+	config *shared.Config
+}
+
+func NewNamespaceScopedFactory(
+	config *shared.Config,
+) *NamespaceScopedFactory {
+	return &NamespaceScopedFactory{config}
+}
+
+func (p *NamespaceScopedFactory) Middleware(next http.Handler) http.Handler {
+	return &NamespaceScopedMiddleware{next, p.config}
+}
+
+type NamespaceScopedMiddleware struct {
+	next   http.Handler
+	config *shared.Config
+}
+
+func (n *NamespaceScopedMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+	// get the namespace from the URL param context
+	reqScopes, _ := r.Context().Value(RequestScopeCtxKey).(map[types.PermissionScope]*policy.RequestAction)
+
+	namespace := reqScopes[types.NamespaceScope].Resource.Name
+
+	ctx := NewNamespaceContext(r.Context(), namespace)
+	r = r.WithContext(ctx)
+	n.next.ServeHTTP(w, r)
+}
+
+func NewNamespaceContext(ctx context.Context, namespace string) context.Context {
+	return context.WithValue(ctx, types.NamespaceScope, namespace)
+}

+ 57 - 0
api/server/handlers/namespace/list_releases.go

@@ -0,0 +1,57 @@
+package namespace
+
+import (
+	"net/http"
+
+	"github.com/porter-dev/porter/api/server/authz"
+	"github.com/porter-dev/porter/api/server/handlers"
+	"github.com/porter-dev/porter/api/server/shared"
+	"github.com/porter-dev/porter/api/server/shared/apierrors"
+	"github.com/porter-dev/porter/api/types"
+	"github.com/porter-dev/porter/internal/models"
+)
+
+type ListReleasesHandler struct {
+	handlers.PorterHandlerReadWriter
+	authz.KubernetesAgentGetter
+}
+
+func NewListReleasesHandler(
+	config *shared.Config,
+	decoderValidator shared.RequestDecoderValidator,
+	writer shared.ResultWriter,
+) *ListReleasesHandler {
+	return &ListReleasesHandler{
+		PorterHandlerReadWriter: handlers.NewDefaultPorterHandler(config, decoderValidator, writer),
+		KubernetesAgentGetter:   authz.NewOutOfClusterAgentGetter(config),
+	}
+}
+
+func (c *ListReleasesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+	request := &types.ListReleasesRequest{}
+
+	if ok := c.DecodeAndValidate(w, r, request); !ok {
+		return
+	}
+
+	namespace := r.Context().Value(types.NamespaceScope).(string)
+	cluster, _ := r.Context().Value(types.ClusterScope).(*models.Cluster)
+
+	helmAgent, err := c.GetHelmAgent(r, cluster)
+
+	if err != nil {
+		c.HandleAPIError(w, apierrors.NewErrInternal(err))
+		return
+	}
+
+	releases, err := helmAgent.ListReleases(namespace, request.ReleaseListFilter)
+
+	if err != nil {
+		c.HandleAPIError(w, apierrors.NewErrInternal(err))
+		return
+	}
+
+	var res types.ListReleasesResponse = releases
+
+	c.WriteResult(w, res)
+}

+ 1 - 1
api/server/router/git_installation.go

@@ -52,7 +52,7 @@ func getGitInstallationRoutes(
 
 	routes := make([]*Route, 0)
 
-	// GET /api/projects/{project_id}/gitrepos/{git_installation_id} -> registry.NewGitInstallationGetHandler
+	// GET /api/projects/{project_id}/gitrepos/{git_installation_id} -> gitinstallation.NewGitInstallationGetHandler
 	getEndpoint := factory.NewAPIEndpoint(
 		&types.APIRequestMetadata{
 			Verb:   types.APIVerbGet,

+ 32 - 0
api/server/router/namespace.go

@@ -2,6 +2,8 @@ package router
 
 import (
 	"github.com/go-chi/chi"
+
+	"github.com/porter-dev/porter/api/server/handlers/namespace"
 	"github.com/porter-dev/porter/api/server/shared"
 	"github.com/porter-dev/porter/api/server/shared/config"
 	"github.com/porter-dev/porter/api/types"
@@ -51,5 +53,35 @@ func getNamespaceRoutes(
 
 	routes := make([]*Route, 0)
 
+	// GET /api/projects/{project_id}/clusters/{cluster_id}/namespaces/{namespace}/releases -> namespace.NewListReleasesHandler
+	getEndpoint := factory.NewAPIEndpoint(
+		&types.APIRequestMetadata{
+			Verb:   types.APIVerbGet,
+			Method: types.HTTPVerbGet,
+			Path: &types.Path{
+				Parent:       basePath,
+				RelativePath: relPath + "/releases",
+			},
+			Scopes: []types.PermissionScope{
+				types.UserScope,
+				types.ProjectScope,
+				types.ClusterScope,
+				types.NamespaceScope,
+			},
+		},
+	)
+
+	getHandler := namespace.NewListReleasesHandler(
+		config,
+		factory.GetDecoderValidator(),
+		factory.GetResultWriter(),
+	)
+
+	routes = append(routes, &Route{
+		Endpoint: getEndpoint,
+		Handler:  getHandler,
+		Router:   r,
+	})
+
 	return routes, newPath
 }

+ 6 - 0
api/server/router/router.go

@@ -98,6 +98,10 @@ func registerRoutes(config *config.Config, routes []*Route) {
 	// after authorization. Each subsequent http.Handler can lookup the cluster in context.
 	clusterFactory := authz.NewClusterScopedFactory(config)
 
+	// Create a new "namespace-scoped" factory which will create a new namespace-scoped request
+	// after authorization. Each subsequent http.Handler can lookup the namespace in context.
+	namespaceFactory := authz.NewNamespaceScopedFactory(config)
+
 	// Create a new "helmrepo-scoped" factory which will create a new helmrepo-scoped request
 	// after authorization. Each subsequent http.Handler can lookup the helm repo in context.
 	helmRepoFactory := authz.NewHelmRepoScopedFactory(config)
@@ -144,6 +148,8 @@ func registerRoutes(config *config.Config, routes []*Route) {
 				atomicGroup.Use(projFactory.Middleware)
 			case types.ClusterScope:
 				atomicGroup.Use(clusterFactory.Middleware)
+			case types.NamespaceScope:
+				atomicGroup.Use(namespaceFactory.Middleware)
 			case types.HelmRepoScope:
 				atomicGroup.Use(helmRepoFactory.Middleware)
 			case types.RegistryScope:

+ 1 - 1
api/server/router/user.go

@@ -188,7 +188,7 @@ func getUserRoutes(
 		Router:   r,
 	})
 
-	// GET /email/verify/initiate -> user.VerifyEmailInitiateHandler
+	// POST /email/verify/initiate -> user.VerifyEmailInitiateHandler
 	emailVerifyInitiateEndpoint := factory.NewAPIEndpoint(
 		&types.APIRequestMetadata{
 			Verb:   types.APIVerbUpdate,

+ 13 - 6
internal/helm/filter.go → api/types/namespace.go

@@ -1,12 +1,13 @@
-package helm
+package types
 
 import (
 	"helm.sh/helm/v3/pkg/action"
+	"helm.sh/helm/v3/pkg/release"
 )
 
-// ListFilter is a struct that represents the various filter options used for
+// ReleaseListFilter is a struct that represents the various filter options used for
 // retrieving the releases
-type ListFilter struct {
+type ReleaseListFilter struct {
 	Namespace    string   `json:"namespace"`
 	Limit        int      `json:"limit"`
 	Skip         int      `json:"skip"`
@@ -21,7 +22,7 @@ type ListFilter struct {
 //
 // It returns an action.ListStates to be used in an action.List as filters for
 // releases in a certain state.
-func (h *ListFilter) listStatesFromNames() action.ListStates {
+func (h *ReleaseListFilter) listStatesFromNames() action.ListStates {
 	var res action.ListStates = 0
 
 	for _, name := range h.StatusFilter {
@@ -31,8 +32,8 @@ func (h *ListFilter) listStatesFromNames() action.ListStates {
 	return res
 }
 
-// apply sets the ListFilter options for an action.List
-func (h *ListFilter) apply(list *action.List) {
+// Apply sets the ReleaseListFilter options for an action.List
+func (h *ReleaseListFilter) Apply(list *action.List) {
 	if h.Namespace == "" {
 		list.AllNamespaces = true
 	}
@@ -46,3 +47,9 @@ func (h *ListFilter) apply(list *action.List) {
 		list.ByDate = true
 	}
 }
+
+type ListReleasesRequest struct {
+	*ReleaseListFilter
+}
+
+type ListReleasesResponse []*release.Release

+ 5 - 4
dashboard/src/main/home/cluster-dashboard/chart/ChartList.tsx

@@ -46,9 +46,6 @@ const ChartList: React.FunctionComponent<Props> = ({
       const res = await api.getCharts(
         "<token>",
         {
-          namespace: namespace,
-          cluster_id: currentCluster.id,
-          storage: StorageType.Secret,
           limit: 50,
           skip: 0,
           byDate: false,
@@ -63,7 +60,11 @@ const ChartList: React.FunctionComponent<Props> = ({
             "failed",
           ],
         },
-        { id: currentProject.id }
+        {
+          id: currentProject.id,
+          cluster_id: currentCluster.id,
+          namespace: namespace,
+        }
       );
       const charts = res.data || [];
 

+ 6 - 5
dashboard/src/shared/api.tsx

@@ -417,17 +417,18 @@ const getChart = baseApi<
 
 const getCharts = baseApi<
   {
-    namespace: string;
-    cluster_id: number;
-    storage: StorageType;
     limit: number;
     skip: number;
     byDate: boolean;
     statusFilter: string[];
   },
-  { id: number }
+  {
+    id: number;
+    cluster_id: number;
+    namespace: string;
+  }
 >("GET", (pathParams) => {
-  return `/api/projects/${pathParams.id}/releases`;
+  return `/api/projects/${pathParams.id}/clusters/${pathParams.cluster_id}/namespaces/${pathParams.namespace}/releases`;
 });
 
 const getChartComponents = baseApi<

+ 153 - 153
docs/developing/backend-refactor-status.md

@@ -1,153 +1,153 @@
-| Path                     | Assigned To  | Changed schema? | CLI Updated | Frontend Updated |
-| ------------------------ | ------------ | --------------- | ----------- | ---------------- |
-| <li>- [ ] `GET /api/auth/check` </li> | | | |
-| <li>- [ ] `GET /api/capabilities` </li> | | | |
-| <li>- [ ] `GET /api/cli/login` </li> | | | |
-| <li>- [ ] `GET /api/cli/login/exchange` </li> | | | |
-| <li>- [ ] `GET /api/email/verify/finalize` </li> | | | |
-| <li>- [ ] `POST /api/email/verify/initiate` </li> | | | |
-| <li>- [ ] `GET /api/integrations/cluster` </li> | | | |
-| <li>- [ ] `GET /api/integrations/github-app/access` </li> | | | |
-| <li>- [ ] `GET /api/integrations/github-app/authorize` </li> | | | |
-| <li>- [ ] `GET /api/integrations/github-app/install` </li> | | | |
-| <li>- [ ] `GET /api/integrations/github-app/oauth` </li> | | | |
-| <li>- [ ] `POST /api/integrations/github-app/webhook` </li> | | | |
-| <li>- [ ] `GET /api/integrations/helm` </li> | | | |
-| <li>- [ ] `GET /api/integrations/registry` </li> | | | |
-| <li>- [ ] `GET /api/integrations/repo` </li> | | | |
-| <li>- [ ] `GET /api/livez` </li> | | | |
-| <li>- [ ] `POST /api/login` </li> | | | |
-| <li>- [ ] `POST /api/logout` </li> | | | |
-| <li>- [ ] `GET /api/oauth/digitalocean/callback` </li> | | | |
-| <li>- [ ] `GET /api/oauth/github-app/callback` </li> | | | |
-| <li>- [ ] `GET /api/oauth/github/callback` </li> | | | |
-| <li>- [ ] `GET /api/oauth/google/callback` </li> | | | |
-| <li>- [ ] `GET /api/oauth/login/github` </li> | | | |
-| <li>- [ ] `GET /api/oauth/login/google` </li> | | | |
-| <li>- [ ] `GET /api/oauth/projects/{project_id}/digitalocean` </li> | | | |
-| <li>- [ ] `GET /api/oauth/projects/{project_id}/github` </li> | | | |
-| <li>- [ ] `GET /api/oauth/projects/{project_id}/slack` </li> | | | |
-| <li>- [ ] `GET /api/oauth/slack/callback` </li> | | | |
-| <li>- [ ] `POST /api/password/reset/finalize` </li> | | | |
-| <li>- [ ] `POST /api/password/reset/initiate` </li> | | | |
-| <li>- [ ] `POST /api/password/reset/verify` </li> | | | |
-| <li>- [ ] `POST /api/projects` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/ci/actions/create` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/ci/actions/generate` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/clusters` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/clusters` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/clusters/candidates` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/clusters/candidates` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/clusters/candidates/{candidate_id}/resolve` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/clusters/{cluster_id}` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/clusters/{cluster_id}` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/clusters/{cluster_id}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/clusters/{cluster_id}/node/{node_name}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/clusters/{cluster_id}/nodes` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/collaborators` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/delete/{name}` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/deploy/addon/{name}/{version}` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/deploy/{name}/{version}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/branches` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/buildpack/detect` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/contents` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/procfile` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/tarball_url` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/helmrepos` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/helmrepos` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/helmrepos/{helm_id}/charts` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/infra` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/docr/destroy` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/doks/destroy` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/ecr/destroy` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/eks/destroy` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/gke/destroy` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/test/destroy` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/integrations/aws` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/integrations/aws/{aws_integration_id}/overwrite` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/integrations/basic` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/integrations/gcp` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/integrations/oauth` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/invites` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/invites` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/invites/{invite_id}` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/invites/{invite_id}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/invites/{token}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/configmap` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/k8s/configmap/create` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/k8s/configmap/delete` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/configmap/list` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/k8s/configmap/rename` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/k8s/configmap/update` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/helm_releases` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/k8s/jobs/{namespace}/{name}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/jobs/{namespace}/{name}/pods` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/k8s/jobs/{namespace}/{name}/stop` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/kubeconfig` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/metrics` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/namespaces` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/k8s/namespaces/create` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/k8s/namespaces/delete` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/pods` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/k8s/pods/{namespace}/{name}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/pods/{namespace}/{name}/events/list` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/prometheus/detect` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/prometheus/ingresses` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/k8s/subdomain` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/ingress/{name}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/pod/{name}/logs` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/{kind}/status` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/{name}/jobs/status` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/{chart}/{release_name}/jobs` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/policy` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/provision/docr` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/provision/doks` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/provision/ecr` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/provision/eks` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/provision/gcr` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/provision/gke` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/provision/test` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/provision/{kind}/{infra_id}/logs` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/registries` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/registries` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/registries/dockerhub/token` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/registries/docr/token` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/registries/ecr/{region}/token` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/registries/gcr/token` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/registries/{registry_id}` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/registries/{registry_id}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/registries/{registry_id}/repositories` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/registries/{registry_id}/repositories/*` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/registries/{registry_id}/repository` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/releases/image/update/batch` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/history` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/notifications` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/notifications` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/rollback` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/upgrade` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/webhook_token` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/webhook_token` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/{revision}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/{revision}/components` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/{revision}/controllers` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/{revision}/pods/all` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/roles` </li> | | | |
-| <li>- [ ] `POST /api/projects/{project_id}/roles/{user_id}` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/roles/{user_id}` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/slack_integrations` </li> | | | |
-| <li>- [ ] `GET /api/projects/{project_id}/slack_integrations/exists` </li> | | | |
-| <li>- [ ] `DELETE /api/projects/{project_id}/slack_integrations/{slack_integration_id}` </li> | | | |
-| <li>- [ ] `GET /api/readyz` </li> | | | |
-| <li>- [ ] `GET /api/templates` </li> | | | |
-| <li>- [ ] `GET /api/templates/upgrade_notes/{name}/{version}` </li> | | | |
-| <li>- [ ] `GET /api/templates/{name}/{version}` </li> | | | |
-| <li>- [ ] `POST /api/users` </li> | | | |
-| <li>- [ ] `GET /api/users/{user_id}` </li> | | | |
-| <li>- [ ] `DELETE /api/users/{user_id}` </li> | | | |
-| <li>- [ ] `GET /api/users/{user_id}/projects` </li> | | | |
-| <li>- [ ] `POST /api/webhooks/deploy/{token}` </li> | | | |
+| Path                                                                                                                    | Assigned To | Changed schema? | CLI Updated | Frontend Updated |
+|-------------------------------------------------------------------------------------------------------------------------|-------------|-----------------|-------------|------------------|
+| <li>- [x] `GET /api/auth/check`                                                                                             |             | yes             |             | yes              |
+| <li>- [x] `GET /api/capabilities`                                                                                           |             |                 |             | yes              |
+| <li>- [x] `GET /api/cli/login`                                                                                              |             |                 | yes         |                  |
+| <li>- [x] `GET /api/cli/login/exchange`                                                                                     |             |                 | yes         |                  |
+| <li>- [x] `GET /api/email/verify/finalize`                                                                                  |             |                 |             |                  |
+| <li>- [x] `POST /api/email/verify/initiate`                                                                                 |             |                 |             | yes              |
+| <li>- [ ] `GET /api/integrations/cluster`                                                                                   |             |                 |             |                  |
+| <li>- [ ] `GET /api/integrations/github-app/access`                                                                         |             |                 |             |                  |
+| <li>- [ ] `GET /api/integrations/github-app/authorize`                                                                      |             |                 |             |                  |
+| <li>- [ ] `GET /api/integrations/github-app/install`                                                                        |             |                 |             |                  |
+| <li>- [ ] `GET /api/integrations/github-app/oauth`                                                                          |             |                 |             |                  |
+| <li>- [ ] `POST /api/integrations/github-app/webhook`                                                                       |             |                 |             |                  |
+| <li>- [ ] `GET /api/integrations/helm`                                                                                      |             |                 |             |                  |
+| <li>- [ ] `GET /api/integrations/registry`                                                                                  |             |                 |             |                  |
+| <li>- [ ] `GET /api/integrations/repo`                                                                                      |             |                 |             |                  |
+| <li>- [ ] `GET /api/livez`                                                                                                  |             |                 |             |                  |
+| <li>- [x] `POST /api/login`                                                                                                 |             |                 |             | yes              |
+| <li>- [x] `POST /api/logout`                                                                                                |             |                 |             | yes              |
+| <li>- [ ] `GET /api/oauth/digitalocean/callback`                                                                            |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/github-app/callback`                                                                              |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/github/callback`                                                                                  |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/google/callback`                                                                                  |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/login/github`                                                                                     |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/login/google`                                                                                     |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/projects/{project_id}/digitalocean`                                                               |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/projects/{project_id}/github`                                                                     |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/projects/{project_id}/slack`                                                                      |             |                 |             |                  |
+| <li>- [ ] `GET /api/oauth/slack/callback`                                                                                   |             |                 |             |                  |
+| <li>- [x] `POST /api/password/reset/finalize`                                                                               |             |                 |             | yes              |
+| <li>- [x] `POST /api/password/reset/initiate`                                                                               |             |                 |             | yes              |
+| <li>- [x] `POST /api/password/reset/verify`                                                                                 |             |                 |             | yes              |
+| <li>- [x] `POST /api/projects`                                                                                              |             |                 |             | yes              |
+| <li>- [ ] `DELETE /api/projects/{project_id}`                                                                               |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}`                                                                                  |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/ci/actions/create`                                                               |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/ci/actions/generate`                                                             |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/clusters`                                                                         |             |                 |             | yes              |
+| <li>- [ ] `POST /api/projects/{project_id}/clusters`                                                                        |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/clusters/candidates`                                                             |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/clusters/candidates`                                                              |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/clusters/candidates/{candidate_id}/resolve`                                      |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/clusters/{cluster_id}`                                                            |             |                 |             | yes              |
+| <li>- [ ] `POST /api/projects/{project_id}/clusters/{cluster_id}`                                                           |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/clusters/{cluster_id}`                                                         |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/clusters/{cluster_id}/node/{node_name}`                                           |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/clusters/{cluster_id}/nodes`                                                      |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/collaborators`                                                                    |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/delete/{name}`                                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/deploy/addon/{name}/{version}`                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/deploy/{name}/{version}`                                                         |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/gitrepos`                                                                         |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos`                                                 |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/branches`                  |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/buildpack/detect` |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/contents`         |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/procfile`         |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/gitrepos/{installation_id}/repos/{kind}/{owner}/{name}/{branch}/tarball_url`      |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/helmrepos`                                                                        |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/helmrepos`                                                                       |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/helmrepos/{helm_id}/charts`                                                       |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/infra`                                                                            |             |                 |             | yes              |
+| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/docr/destroy`                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/doks/destroy`                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/ecr/destroy`                                                    |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/eks/destroy`                                                    |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/gke/destroy`                                                    |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/infra/{infra_id}/test/destroy`                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/integrations/aws`                                                                |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/integrations/aws/{aws_integration_id}/overwrite`                                 |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/integrations/basic`                                                              |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/integrations/gcp`                                                                |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/integrations/oauth`                                                               |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/invites`                                                                          |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/invites`                                                                         |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/invites/{invite_id}`                                                             |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/invites/{invite_id}`                                                           |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/invites/{token}`                                                                  |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/configmap`                                                                    |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/k8s/configmap/create`                                                            |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/k8s/configmap/delete`                                                          |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/configmap/list`                                                               |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/k8s/configmap/rename`                                                            |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/k8s/configmap/update`                                                            |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/helm_releases`                                                                |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/k8s/jobs/{namespace}/{name}`                                                   |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/jobs/{namespace}/{name}/pods`                                                 |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/k8s/jobs/{namespace}/{name}/stop`                                                |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/k8s/kubeconfig`                                                                   |             | yes             | yes         |                  |
+| <li>- [x] `GET /api/projects/{project_id}/k8s/metrics`                                                                      |             | yes             |             | yes              |
+| <li>- [x] `GET /api/projects/{project_id}/k8s/namespaces`                                                                   |             | yes             |             | yes              |
+| <li>- [x] `POST /api/projects/{project_id}/k8s/namespaces/create`                                                           |             | yes             |             | yes              |
+| <li>- [x] `DELETE /api/projects/{project_id}/k8s/namespaces/delete`                                                         |             | yes             |             | yes              |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/pods`                                                                         |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/k8s/pods/{namespace}/{name}`                                                   |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/pods/{namespace}/{name}/events/list`                                          |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/k8s/prometheus/detect`                                                            |             | yes             |             | yes              |
+| <li>- [x] `GET /api/projects/{project_id}/k8s/prometheus/ingresses`                                                         |             | yes             |             | yes              |
+| <li>- [ ] `POST /api/projects/{project_id}/k8s/subdomain`                                                                   |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/ingress/{name}`                                                   |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/pod/{name}/logs`                                                  |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/{kind}/status`                                                                |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/{name}/jobs/status`                                               |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/k8s/{namespace}/{chart}/{release_name}/jobs`                                      |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/policy`                                                                           |             |                 |             | yes              |
+| <li>- [ ] `POST /api/projects/{project_id}/provision/docr`                                                                  |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/provision/doks`                                                                  |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/provision/ecr`                                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/provision/eks`                                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/provision/gcr`                                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/provision/gke`                                                                   |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/provision/test`                                                                  |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/provision/{kind}/{infra_id}/logs`                                                 |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/registries`                                                                      |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/registries`                                                                       |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/registries/dockerhub/token`                                                       |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/registries/docr/token`                                                            |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/registries/ecr/{region}/token`                                                    |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/registries/gcr/token`                                                             |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/registries/{registry_id}`                                                      |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/registries/{registry_id}`                                                        |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/registries/{registry_id}/repositories`                                            |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/registries/{registry_id}/repositories/*`                                          |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/registries/{registry_id}/repository`                                             |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/releases`                                                                         |             | yes             |             | yes              |
+| <li>- [ ] `POST /api/projects/{project_id}/releases/image/update/batch`                                                     |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/history`                                                          |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/notifications`                                                   |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/notifications`                                                    |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/rollback`                                                        |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/upgrade`                                                         |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/webhook_token`                                                    |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/releases/{name}/webhook_token`                                                   |             |                 |             |                  |
+| <li>- [x] `GET /api/projects/{project_id}/releases/{name}/{revision}`                                                       |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/{revision}/components`                                            |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/{revision}/controllers`                                           |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/releases/{name}/{revision}/pods/all`                                              |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/roles`                                                                            |             |                 |             |                  |
+| <li>- [ ] `POST /api/projects/{project_id}/roles/{user_id}`                                                                 |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/roles/{user_id}`                                                               |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/slack_integrations`                                                               |             |                 |             |                  |
+| <li>- [ ] `GET /api/projects/{project_id}/slack_integrations/exists`                                                        |             |                 |             |                  |
+| <li>- [ ] `DELETE /api/projects/{project_id}/slack_integrations/{slack_integration_id}`                                     |             |                 |             |                  |
+| <li>- [ ] `GET /api/readyz`                                                                                                 |             |                 |             |                  |
+| <li>- [ ] `GET /api/templates`                                                                                              |             |                 |             |                  |
+| <li>- [ ] `GET /api/templates/upgrade_notes/{name}/{version}`                                                               |             |                 |             |                  |
+| <li>- [ ] `GET /api/templates/{name}/{version}`                                                                             |             |                 |             |                  |
+| <li>- [x] `POST /api/users`                                                                                                 |             |                 |             | yes              |
+| <li>- [x] `GET /api/users/{user_id}`                                                                                        |             | yes             |             | yes              |
+| <li>- [x] `DELETE /api/users/{user_id}`                                                                                     |             | yes             |             |                  |
+| <li>- [x] `GET /api/users/{user_id}/projects`                                                                               |             | yes             |             | yes              |
+| <li>- [ ] `POST /api/webhooks/deploy/{token}`                                                                               |             |                 |             |                  |

+ 7 - 5
internal/helm/agent.go

@@ -4,14 +4,16 @@ import (
 	"fmt"
 
 	"github.com/pkg/errors"
-	"github.com/porter-dev/porter/internal/kubernetes"
-	"github.com/porter-dev/porter/internal/models"
-	"github.com/porter-dev/porter/internal/repository"
 	"golang.org/x/oauth2"
 	"helm.sh/helm/v3/pkg/action"
 	"helm.sh/helm/v3/pkg/chart"
 	"helm.sh/helm/v3/pkg/release"
 	"k8s.io/helm/pkg/chartutil"
+
+	"github.com/porter-dev/porter/api/types"
+	"github.com/porter-dev/porter/internal/kubernetes"
+	"github.com/porter-dev/porter/internal/models"
+	"github.com/porter-dev/porter/internal/repository"
 )
 
 // Agent is a Helm agent for performing helm operations
@@ -23,11 +25,11 @@ type Agent struct {
 // ListReleases lists releases based on a ListFilter
 func (a *Agent) ListReleases(
 	namespace string,
-	filter *ListFilter,
+	filter *types.ReleaseListFilter,
 ) ([]*release.Release, error) {
 	cmd := action.NewList(a.ActionConfig)
 
-	filter.apply(cmd)
+	filter.Apply(cmd)
 
 	return cmd.Run()
 }