Add new manifests, storageclass validation

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
reviewable/pr4069/r3^2
Ahmet Alp Balkan 2017-07-27 15:59:51 -07:00 committed by Jared
parent f7b3a88df6
commit 28f66c1f71
1 changed files with 24 additions and 17 deletions

View File

@ -43,6 +43,8 @@ import (
expvalidation "k8s.io/kubernetes/pkg/apis/extensions/validation"
"k8s.io/kubernetes/pkg/apis/policy"
policyvalidation "k8s.io/kubernetes/pkg/apis/policy/validation"
"k8s.io/kubernetes/pkg/apis/storage"
storagevalidation "k8s.io/kubernetes/pkg/apis/storage/validation"
"k8s.io/kubernetes/pkg/capabilities"
"k8s.io/kubernetes/pkg/registry/batch/job"
schedulerapilatest "k8s.io/kubernetes/plugin/pkg/scheduler/api/latest"
@ -156,6 +158,9 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
t.Namespace = api.NamespaceDefault
}
errors = policyvalidation.ValidatePodDisruptionBudget(t)
case *storage.StorageClass:
// storageclass does not accept namespace
errors = storagevalidation.ValidateStorageClass(t)
default:
errors = field.ErrorList{}
errors = append(errors, field.InternalError(field.NewPath(""), fmt.Errorf("no validation defined for %#v", obj)))
@ -215,15 +220,15 @@ func walkConfigFiles(inDir string, fn func(name, path string, data [][]byte)) er
func TestExampleObjectSchemas(t *testing.T) {
cases := map[string]map[string][]runtime.Object{
"../docs/user-guide/walkthrough": {
"deployment": {&extensions.Deployment{}},
"deployment-update": {&extensions.Deployment{}},
"pod-nginx": {&api.Pod{}},
"pod-nginx-with-label": {&api.Pod{}},
"pod-redis": {&api.Pod{}},
"pod-with-http-healthcheck": {&api.Pod{}},
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
"podtemplate": {&api.PodTemplate{}},
"service": {&api.Service{}},
"deployment": {&extensions.Deployment{}},
"deployment-update": {&extensions.Deployment{}},
"pod-nginx": {&api.Pod{}},
"pod-nginx-with-label": {&api.Pod{}},
"pod-redis": {&api.Pod{}},
"pod-with-http-healthcheck": {&api.Pod{}},
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
"podtemplate": {&api.PodTemplate{}},
"service": {&api.Service{}},
},
"../docs/user-guide/update-demo": {
"kitten-rc": {&api.ReplicationController{}},
@ -326,14 +331,16 @@ func TestExampleObjectSchemas(t *testing.T) {
"secret-env-pod": {&api.Pod{}},
},
"../docs/tutorials/stateful-application": {
"gce-volume": {&api.PersistentVolume{}},
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
"mysql-services": {&api.Service{}, &api.Service{}},
"mysql-configmap": {&api.ConfigMap{}},
"mysql-statefulset": {&apps.StatefulSet{}},
"web": {&api.Service{}, &apps.StatefulSet{}},
"webp": {&api.Service{}, &apps.StatefulSet{}},
"zookeeper": {&api.Service{}, &api.ConfigMap{}, &policy.PodDisruptionBudget{}, &apps.StatefulSet{}},
"gce-volume": {&api.PersistentVolume{}},
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
"mysql-services": {&api.Service{}, &api.Service{}},
"mysql-configmap": {&api.ConfigMap{}},
"mysql-statefulset": {&apps.StatefulSet{}},
"cassandra-service": {&api.Service{}},
"cassandra-statefulset": {&apps.StatefulSet{}, &storage.StorageClass{}},
"web": {&api.Service{}, &apps.StatefulSet{}},
"webp": {&api.Service{}, &apps.StatefulSet{}},
"zookeeper": {&api.Service{}, &api.ConfigMap{}, &policy.PodDisruptionBudget{}, &apps.StatefulSet{}},
},
}