Removed opaque integer resources.

This commit is contained in:
Connor Doyle
2017-11-04 00:52:15 -07:00
parent d6325933e1
commit 80ac705ef3
14 changed files with 131 additions and 571 deletions

View File

@@ -141,10 +141,9 @@ func IsStandardContainerResourceName(str string) bool {
}
// IsExtendedResourceName returns true if the resource name is not in the
// default namespace, or it has the opaque integer resource prefix.
// default namespace.
func IsExtendedResourceName(name core.ResourceName) bool {
// TODO: Remove OIR part following deprecation.
return !IsDefaultNamespaceResource(name) || IsOpaqueIntResourceName(name)
return !IsDefaultNamespaceResource(name)
}
// IsDefaultNamespaceResource returns true if the resource name is in the
@@ -155,22 +154,6 @@ func IsDefaultNamespaceResource(name core.ResourceName) bool {
strings.Contains(string(name), core.ResourceDefaultNamespacePrefix)
}
// IsOpaqueIntResourceName returns true if the resource name has the opaque
// integer resource prefix.
func IsOpaqueIntResourceName(name core.ResourceName) bool {
return strings.HasPrefix(string(name), core.ResourceOpaqueIntPrefix)
}
// OpaqueIntResourceName returns a ResourceName with the canonical opaque
// integer prefix prepended. If the argument already has the prefix, it is
// returned unmodified.
func OpaqueIntResourceName(name string) core.ResourceName {
if IsOpaqueIntResourceName(core.ResourceName(name)) {
return core.ResourceName(name)
}
return core.ResourceName(fmt.Sprintf("%s%s", core.ResourceOpaqueIntPrefix, name))
}
var overcommitBlacklist = sets.NewString(string(core.ResourceNvidiaGPU))
// IsOvercommitAllowed returns true if the resource is in the default