mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Simplify min/max evaluation, make limitType a type
This commit is contained in:
@@ -1139,17 +1139,20 @@ type List struct {
|
||||
Items []runtime.Object `json:"items"`
|
||||
}
|
||||
|
||||
// A type of object that is limited
|
||||
type LimitType string
|
||||
|
||||
const (
|
||||
// Limit that applies to all pods in a namespace
|
||||
LimitTypePod string = "Pod"
|
||||
LimitTypePod LimitType = "Pod"
|
||||
// Limit that applies to all containers in a namespace
|
||||
LimitTypeContainer string = "Container"
|
||||
LimitTypeContainer LimitType = "Container"
|
||||
)
|
||||
|
||||
// LimitRangeItem defines a min/max usage limit for any resource that matches on kind
|
||||
type LimitRangeItem struct {
|
||||
// Type of resource that this limit applies to
|
||||
Type string `json:"type,omitempty"`
|
||||
Type LimitType `json:"type,omitempty"`
|
||||
// Max usage constraints on this kind by resource name
|
||||
Max ResourceList `json:"max,omitempty"`
|
||||
// Min usage constraints on this kind by resource name
|
||||
|
||||
@@ -614,7 +614,7 @@ func init() {
|
||||
},
|
||||
func(in *newer.LimitRangeItem, out *LimitRangeItem, s conversion.Scope) error {
|
||||
*out = LimitRangeItem{}
|
||||
out.Type = in.Type
|
||||
out.Type = LimitType(in.Type)
|
||||
if err := s.Convert(&in.Max, &out.Max, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -625,7 +625,7 @@ func init() {
|
||||
},
|
||||
func(in *LimitRangeItem, out *newer.LimitRangeItem, s conversion.Scope) error {
|
||||
*out = newer.LimitRangeItem{}
|
||||
out.Type = in.Type
|
||||
out.Type = newer.LimitType(in.Type)
|
||||
if err := s.Convert(&in.Max, &out.Max, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -905,17 +905,20 @@ type List struct {
|
||||
Items []runtime.RawExtension `json:"items" description:"list of objects"`
|
||||
}
|
||||
|
||||
// A type of object that is limited
|
||||
type LimitType string
|
||||
|
||||
const (
|
||||
// Limit that applies to all pods in a namespace
|
||||
LimitTypePod string = "Pod"
|
||||
LimitTypePod LimitType = "Pod"
|
||||
// Limit that applies to all containers in a namespace
|
||||
LimitTypeContainer string = "Container"
|
||||
LimitTypeContainer LimitType = "Container"
|
||||
)
|
||||
|
||||
// LimitRangeItem defines a min/max usage limit for any resource that matches on kind
|
||||
type LimitRangeItem struct {
|
||||
// Type of resource that this limit applies to
|
||||
Type string `json:"type,omitempty"`
|
||||
Type LimitType `json:"type,omitempty"`
|
||||
// Max usage constraints on this kind by resource name
|
||||
Max ResourceList `json:"max,omitempty"`
|
||||
// Min usage constraints on this kind by resource name
|
||||
|
||||
@@ -531,7 +531,7 @@ func init() {
|
||||
},
|
||||
func(in *newer.LimitRangeItem, out *LimitRangeItem, s conversion.Scope) error {
|
||||
*out = LimitRangeItem{}
|
||||
out.Type = in.Type
|
||||
out.Type = LimitType(in.Type)
|
||||
if err := s.Convert(&in.Max, &out.Max, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -542,7 +542,7 @@ func init() {
|
||||
},
|
||||
func(in *LimitRangeItem, out *newer.LimitRangeItem, s conversion.Scope) error {
|
||||
*out = newer.LimitRangeItem{}
|
||||
out.Type = in.Type
|
||||
out.Type = newer.LimitType(in.Type)
|
||||
if err := s.Convert(&in.Max, &out.Max, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -907,17 +907,20 @@ type List struct {
|
||||
Items []runtime.RawExtension `json:"items" description:"list of objects"`
|
||||
}
|
||||
|
||||
// A type of object that is limited
|
||||
type LimitType string
|
||||
|
||||
const (
|
||||
// Limit that applies to all pods in a namespace
|
||||
LimitTypePod string = "Pod"
|
||||
LimitTypePod LimitType = "Pod"
|
||||
// Limit that applies to all containers in a namespace
|
||||
LimitTypeContainer string = "Container"
|
||||
LimitTypeContainer LimitType = "Container"
|
||||
)
|
||||
|
||||
// LimitRangeItem defines a min/max usage limit for any resource that matches on kind
|
||||
type LimitRangeItem struct {
|
||||
// Type of resource that this limit applies to
|
||||
Type string `json:"type,omitempty"`
|
||||
Type LimitType `json:"type,omitempty"`
|
||||
// Max usage constraints on this kind by resource name
|
||||
Max ResourceList `json:"max,omitempty"`
|
||||
// Min usage constraints on this kind by resource name
|
||||
|
||||
@@ -1067,17 +1067,20 @@ type List struct {
|
||||
Items []runtime.RawExtension `json:"items" description:"list of objects"`
|
||||
}
|
||||
|
||||
// A type of object that is limited
|
||||
type LimitType string
|
||||
|
||||
const (
|
||||
// Limit that applies to all pods in a namespace
|
||||
LimitTypePod string = "Pod"
|
||||
LimitTypePod LimitType = "Pod"
|
||||
// Limit that applies to all containers in a namespace
|
||||
LimitTypeContainer string = "Container"
|
||||
LimitTypeContainer LimitType = "Container"
|
||||
)
|
||||
|
||||
// LimitRangeItem defines a min/max usage limit for any resource that matches on kind
|
||||
type LimitRangeItem struct {
|
||||
// Type of resource that this limit applies to
|
||||
Type string `json:"type,omitempty"`
|
||||
Type LimitType `json:"type,omitempty"`
|
||||
// Max usage constraints on this kind by resource name
|
||||
Max ResourceList `json:"max,omitempty"`
|
||||
// Min usage constraints on this kind by resource name
|
||||
|
||||
Reference in New Issue
Block a user