Resource Quota should not let fractional values for API resources

This commit is contained in:
derekwaynecarr
2015-10-13 17:27:56 -04:00
parent 376438b69c
commit 62b4467c69
3 changed files with 66 additions and 8 deletions

View File

@@ -80,20 +80,36 @@ var Semantic = conversion.EqualitiesOrDie(
)
var standardResources = sets.NewString(
string(ResourceMemory),
string(ResourceCPU),
string(ResourceMemory),
string(ResourcePods),
string(ResourceQuotas),
string(ResourceServices),
string(ResourceReplicationControllers),
string(ResourceSecrets),
string(ResourcePersistentVolumeClaims),
string(ResourceStorage))
string(ResourceStorage),
)
// IsStandardResourceName returns true if the resource is known to the system
func IsStandardResourceName(str string) bool {
return standardResources.Has(str)
}
var integerResources = sets.NewString(
string(ResourcePods),
string(ResourceQuotas),
string(ResourceServices),
string(ResourceReplicationControllers),
string(ResourceSecrets),
string(ResourcePersistentVolumeClaims),
)
// IsIntegerResourceName returns true if the resource is measured in integer values
func IsIntegerResourceName(str string) bool {
return integerResources.Has(str)
}
// NewDeleteOptions returns a DeleteOptions indicating the resource should
// be deleted within the specified grace period. Use zero to indicate
// immediate deletion. If you would prefer to use the default grace period,