Parcourir la source

Merge pull request #1347 from porter-dev/belanger/fix-cc-usage

Check for usage for cluster candidate resolution, populate candidate for create response
abelanger5 il y a 4 ans
Parent
commit
80ce00398f

+ 2 - 1
api/server/handlers/cluster/create_candidate.go

@@ -67,7 +67,8 @@ func (c *CreateClusterCandidateHandler) ServeHTTP(w http.ResponseWriter, r *http
 		// if the ClusterCandidate does not have any actions to perform, create the Cluster
 		// if the ClusterCandidate does not have any actions to perform, create the Cluster
 		// automatically
 		// automatically
 		if len(cc.Resolvers) == 0 {
 		if len(cc.Resolvers) == 0 {
-			cluster, cc, err := createClusterFromCandidate(c.Repo(), proj, user, cc, &types.ClusterResolverAll{})
+			var cluster *models.Cluster
+			cluster, cc, err = createClusterFromCandidate(c.Repo(), proj, user, cc, &types.ClusterResolverAll{})
 
 
 			if err != nil {
 			if err != nil {
 				c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
 				c.HandleAPIError(w, r, apierrors.NewErrInternal(err))

+ 2 - 0
api/server/router/cluster.go

@@ -95,6 +95,8 @@ func getClusterRoutes(
 				types.UserScope,
 				types.UserScope,
 				types.ProjectScope,
 				types.ProjectScope,
 			},
 			},
+			CheckUsage:  true,
+			UsageMetric: types.Clusters,
 		},
 		},
 	)
 	)