Merge branch 'master' into metering

Signed-off-by: Rao Yunkun <yunkunrao@yunify.com>
This commit is contained in:
Rao Yunkun
2021-03-05 14:42:14 +08:00
111 changed files with 8810 additions and 984 deletions

View File

@@ -17,8 +17,9 @@ limitations under the License.
package v1alpha2
import (
"kubesphere.io/kubesphere/pkg/models/metering"
"net/http"
"kubesphere.io/kubesphere/pkg/models/metering"
"sigs.k8s.io/controller-runtime/pkg/cache"
"github.com/emicklei/go-restful"
@@ -30,6 +31,7 @@ import (
auditingv1alpha1 "kubesphere.io/kubesphere/pkg/api/auditing/v1alpha1"
eventsv1alpha1 "kubesphere.io/kubesphere/pkg/api/events/v1alpha1"
loggingv1alpha2 "kubesphere.io/kubesphere/pkg/api/logging/v1alpha2"
quotav1alpha2 "kubesphere.io/kubesphere/pkg/apis/quota/v1alpha2"
tenantv1alpha2 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha2"
"kubesphere.io/kubesphere/pkg/apiserver/authorization/authorizer"
"kubesphere.io/kubesphere/pkg/apiserver/runtime"
@@ -340,6 +342,37 @@ func AddToContainer(c *restful.Container, factory informers.InformerFactory, k8s
Doc("Get resoure price.").
Writes(metering.PriceInfo{}).
Returns(http.StatusOK, api.StatusOK, metering.PriceInfo{}))
ws.Route(ws.POST("/workspaces/{workspace}/resourcequotas").
To(handler.CreateWorkspaceResourceQuota).
Reads(quotav1alpha2.ResourceQuota{}).
Returns(http.StatusOK, api.StatusOK, quotav1alpha2.ResourceQuota{}).
Doc("Create resource quota.").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkspaceTag}))
ws.Route(ws.DELETE("/workspaces/{workspace}/resourcequotas/{resourcequota}").
To(handler.DeleteWorkspaceResourceQuota).
Param(ws.PathParameter("workspace", "workspace name")).
Param(ws.PathParameter("resourcequota", "resource quota name")).
Returns(http.StatusOK, api.StatusOK, errors.None).
Doc("Delete resource quota.").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkspaceTag}))
ws.Route(ws.PUT("/workspaces/{workspace}/resourcequotas/{resourcequota}").
To(handler.UpdateWorkspaceResourceQuota).
Param(ws.PathParameter("workspace", "workspace name")).
Param(ws.PathParameter("resourcequota", "resource quota name")).
Reads(quotav1alpha2.ResourceQuota{}).
Returns(http.StatusOK, api.StatusOK, quotav1alpha2.ResourceQuota{}).
Doc("Update resource quota.").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkspaceTag}))
ws.Route(ws.GET("/workspaces/{workspace}/resourcequotas/{resourcequota}").
To(handler.DescribeWorkspaceResourceQuota).
Param(ws.PathParameter("workspace", "workspace name")).
Param(ws.PathParameter("resourcequota", "resource quota name")).
Returns(http.StatusOK, api.StatusOK, quotav1alpha2.ResourceQuota{}).
Doc("Describe resource quota.").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.WorkspaceTag}))
c.Add(ws)
return nil