1
0
mirror of https://github.com/rancher/types.git synced 2025-09-02 21:54:22 +00:00

Resoure quota refactor - no more template

This commit is contained in:
Alena Prokharchyk
2018-08-23 09:53:34 -07:00
parent 3c5fd8d134
commit eb18b360c0
5 changed files with 38 additions and 41 deletions

View File

@@ -47,10 +47,11 @@ type ProjectCondition struct {
}
type ProjectSpec struct {
DisplayName string `json:"displayName,omitempty" norman:"required"`
Description string `json:"description"`
ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"`
ResourceQuota *ProjectResourceQuota `json:"resourceQuota,omitempty"`
DisplayName string `json:"displayName,omitempty" norman:"required"`
Description string `json:"description"`
ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"`
ResourceQuota *ProjectResourceQuota `json:"resourceQuota,omitempty"`
NamespaceDefaultResourceQuota *NamespaceResourceQuota `json:"namespaceDefaultResourceQuota,omitempty"`
}
type GlobalRole struct {

View File

@@ -1,16 +1,15 @@
package v3
import (
"github.com/rancher/norman/types"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ProjectResourceQuota struct {
Limit ProjectResourceLimit `json:"limit,omitempty"`
UsedLimit ProjectResourceLimit `json:"usedLimit,omitempty"`
Limit ResourceQuotaLimit `json:"limit,omitempty"`
UsedLimit ResourceQuotaLimit `json:"usedLimit,omitempty"`
}
type ProjectResourceLimit struct {
type NamespaceResourceQuota struct {
Limit ResourceQuotaLimit `json:"limit,omitempty"`
}
type ResourceQuotaLimit struct {
Pods string `json:"pods,omitempty"`
Services string `json:"services,omitempty"`
ReplicationControllers string `json:"replicationControllers,omitempty"`
@@ -25,16 +24,3 @@ type ProjectResourceLimit struct {
LimitsCPU string `json:"limitsCpu,omitempty"`
LimitsMemory string `json:"limitsMemory,omitempty"`
}
type ResourceQuotaTemplate struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Description string `json:"description"`
IsDefault bool `json:"isDefault"`
ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"`
ProjectResourceQuota
}

View File

@@ -34,8 +34,7 @@ var (
Init(globalTypes).
Init(rkeTypes).
Init(alertTypes).
Init(composeType).
Init(resourceQuotaTemplateTypes)
Init(composeType)
TokenSchemas = factory.Schemas(&Version).
Init(tokens)
@@ -537,10 +536,3 @@ func alertTypes(schema *types.Schemas) *types.Schemas {
func composeType(schemas *types.Schemas) *types.Schemas {
return schemas.MustImport(&Version, v3.ComposeConfig{})
}
func resourceQuotaTemplateTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
MustImportAndCustomize(&Version, v3.ResourceQuotaTemplate{}, func(schema *types.Schema) {
schema.ResourceMethods = []string{http.MethodGet, http.MethodDelete}
})
}