mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #342 from thockin/valid2
Simplify supported manifest versions
This commit is contained in:
commit
a1be413cb3
@ -23,13 +23,9 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func isSupportedManifestVersion(value string) bool {
|
var (
|
||||||
switch value {
|
supportedManifestVersions util.StringSet = util.NewStringSet("v1beta1", "v1beta2")
|
||||||
case "v1beta1", "v1beta2":
|
)
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func errInvalid(field string, value interface{}) error {
|
func errInvalid(field string, value interface{}) error {
|
||||||
return fmt.Errorf("%s is invalid: '%v'", field, value)
|
return fmt.Errorf("%s is invalid: '%v'", field, value)
|
||||||
@ -109,7 +105,7 @@ func ValidateManifest(manifest *ContainerManifest) error {
|
|||||||
if len(manifest.Version) == 0 {
|
if len(manifest.Version) == 0 {
|
||||||
return errInvalid("ContainerManifest.Version", manifest.Version)
|
return errInvalid("ContainerManifest.Version", manifest.Version)
|
||||||
}
|
}
|
||||||
if !isSupportedManifestVersion(manifest.Version) {
|
if !supportedManifestVersions.Has(manifest.Version) {
|
||||||
return errNotSupported("ContainerManifest.Version", manifest.Version)
|
return errNotSupported("ContainerManifest.Version", manifest.Version)
|
||||||
}
|
}
|
||||||
if len(manifest.ID) > 255 || !util.IsDNSSubdomain(manifest.ID) {
|
if len(manifest.ID) > 255 || !util.IsDNSSubdomain(manifest.ID) {
|
||||||
|
Loading…
Reference in New Issue
Block a user