From 9278859f67977f457f9611df4bbd2ff243e8c96e Mon Sep 17 00:00:00 2001 From: zionwu Date: Thu, 22 Feb 2018 11:59:52 +0800 Subject: [PATCH] not use pointer for mapper --- apis/management.cattle.io/v3/alerting_types.go | 14 +++++++------- apis/management.cattle.io/v3/schema/schema.go | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apis/management.cattle.io/v3/alerting_types.go b/apis/management.cattle.io/v3/alerting_types.go index d7810658..f96aa39e 100644 --- a/apis/management.cattle.io/v3/alerting_types.go +++ b/apis/management.cattle.io/v3/alerting_types.go @@ -69,19 +69,19 @@ type TargetNode struct { NodeName string `json:"nodeName,omitempty" norman:"type=reference[node]"` Selector map[string]string `json:"selector,omitempty"` Condition string `json:"condition,omitempty" norman:"required,options=notready|mem|cpu,default=notready"` - MemThreshold int `json:"memThreshold,omitempty" norman:"min=1,max=100"` - CPUThreshold int `json:"cpuThreshold,omitempty" norman:"min=1"` + MemThreshold int `json:"memThreshold,omitempty" norman:"min=1,max=100,default=70"` + CPUThreshold int `json:"cpuThreshold,omitempty" norman:"min=1,default=70"` } type TargetPod struct { PodName string `json:"podName,omitempty" norman:"required,type=reference[/v3/projects/schemas/pod]"` Condition string `json:"condition,omitempty" norman:"required,options=notrunning|notscheduled|restarts,default=notrunning"` - RestartTimes int `json:"restartTimes,omitempty" norman:"min=1"` - RestartIntervalSeconds int `json:"restartIntervalSeconds,omitempty" norman:"min=1"` + RestartTimes int `json:"restartTimes,omitempty" norman:"min=1,default=3"` + RestartIntervalSeconds int `json:"restartIntervalSeconds,omitempty" norman:"min=1,default=300"` } type TargetEvent struct { - Type string `json:"type,omitempty" norman:"required,options=Normal|Warning,default=warning"` + Type string `json:"type,omitempty" norman:"required,options=Normal|Warning,default=Warning"` ResourceKind string `json:"resourceKind,omitempty" norman:"required,options=Pod|Node|Deployment|Statefulset|Daemonset"` } @@ -89,7 +89,7 @@ type TargetWorkload struct { WorkloadID string `json:"workloadId,omitempty"` Type string `json:"type,omitempty" norman:"required,options=deployment|statefulset|daemonset,default=deployment"` Selector map[string]string `json:"selector,omitempty"` - AvailablePercentage int `json:"availablePercentage,omitempty" norman:"required,min=1,max=100"` + AvailablePercentage int `json:"availablePercentage,omitempty" norman:"required,min=1,max=100,default=70"` } type TargetSystemService struct { @@ -97,7 +97,7 @@ type TargetSystemService struct { } type AlertStatus struct { - State string `json:"state,omitempty" norman:"required,options=active|inactive|alerting|muted,default=active"` + AlertState string `json:"alertState,omitempty" norman:"options=active|inactive|alerting|muted,default=active"` } type Notifier struct { diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index b13348f2..5f5a39b3 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -321,12 +321,12 @@ func globalTypes(schema *types.Schemas) *types.Schemas { func alertTypes(schema *types.Schemas) *types.Schemas { return schema. - AddMapperForType(&Version, &v3.Notifier{}, + AddMapperForType(&Version, v3.Notifier{}, m.DisplayName{}). - AddMapperForType(&Version, &v3.ClusterAlert{}, + AddMapperForType(&Version, v3.ClusterAlert{}, &m.Embed{Field: "status"}, m.DisplayName{}). - AddMapperForType(&Version, &v3.ProjectAlert{}, + AddMapperForType(&Version, v3.ProjectAlert{}, &m.Embed{Field: "status"}, m.DisplayName{}). MustImport(&Version, v3.Notification{}).