Merge pull request #6546 from tengqm/fix-example-validation
Fix example validation
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
approvers:
|
||||
- derekwaynecarr
|
||||
- janetkuo
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"kind": "Namespace",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "development",
|
||||
"labels": {
|
||||
"name": "development"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ $ kubectl create -f docs/admin/namespaces/namespace-dev.json
|
||||
And then let's create the production namespace using kubectl.
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/admin/namespaces/namespace-prod.json
|
||||
$ kubectl create -f docs/tasks/administer-cluster/namespace-prod.json
|
||||
```
|
||||
|
||||
To be sure things are right, let's list all of the namespaces in our cluster.
|
||||
|
||||
@@ -152,7 +152,7 @@ $ kubectl create -f docs/admin/namespaces/namespace-dev.json
|
||||
And then let's create the production namespace using kubectl.
|
||||
|
||||
```shell
|
||||
$ kubectl create -f docs/admin/namespaces/namespace-prod.json
|
||||
$ kubectl create -f docs/tasks/administer-cluster/namespace-prod.json
|
||||
```
|
||||
|
||||
To be sure things are right, list all of the namespaces in our cluster.
|
||||
|
||||
@@ -10,7 +10,6 @@ apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: event-exporter-rb
|
||||
namespace: default
|
||||
labels:
|
||||
app: event-exporter
|
||||
roleRef:
|
||||
@@ -42,4 +41,4 @@ spec:
|
||||
image: gcr.io/google-containers/event-exporter:v0.1.0
|
||||
command:
|
||||
- '/event-exporter'
|
||||
terminationGracePeriodSeconds: 30
|
||||
terminationGracePeriodSeconds: 30
|
||||
|
||||
@@ -28,7 +28,7 @@ spec:
|
||||
value: $(REPLACE_ME)
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: etcd-env-config
|
||||
name: etcd-env-config
|
||||
volumes:
|
||||
- name: cache-volume
|
||||
emptyDir: {}
|
||||
|
||||
@@ -8,7 +8,7 @@ spec:
|
||||
role: frontend
|
||||
env:
|
||||
- name: DB_PORT
|
||||
value: 6379
|
||||
value: "6379"
|
||||
- name: duplicate_key
|
||||
value: FROM_ENV
|
||||
- name: expansion
|
||||
|
||||
@@ -13,7 +13,7 @@ spec:
|
||||
- mountPath: /cache
|
||||
name: cache-volume
|
||||
ports:
|
||||
- containerPort: 80
|
||||
volumes:
|
||||
- name: cache-volume
|
||||
emptyDir: {}
|
||||
- containerPort: 80
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: frontend
|
||||
labels:
|
||||
app: guestbook
|
||||
tier: frontend
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: myclaim-1
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 3Gi
|
||||
@@ -1,10 +0,0 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: myclaim-2
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"kind": "PersistentVolumeClaim",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "myclaim-3"
|
||||
}, "spec": {
|
||||
"accessModes": [
|
||||
"ReadWriteOnce",
|
||||
"ReadOnlyMany"
|
||||
],
|
||||
"resources": {
|
||||
"requests": {
|
||||
"storage": "10G"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"kind": "Namespace",
|
||||
"apiVersion":"v1",
|
||||
"metadata": {
|
||||
"name": "myns",
|
||||
"labels": {
|
||||
"name": "development"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
kind: Pod
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: mypod
|
||||
labels:
|
||||
name: frontendhttp
|
||||
spec:
|
||||
containers:
|
||||
- name: myfrontend
|
||||
image: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: "http-server"
|
||||
volumeMounts:
|
||||
- mountPath: "/usr/share/nginx/html"
|
||||
name: mypd
|
||||
volumes:
|
||||
- name: mypd
|
||||
persistentVolumeClaim:
|
||||
claimName: myclaim-1
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "frontendservice"
|
||||
},
|
||||
"spec": {
|
||||
"ports": [
|
||||
{
|
||||
"protocol": "TCP",
|
||||
"port": 3000,
|
||||
"targetPort": "http-server"
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"name": "frontendhttp"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: pv0003
|
||||
spec:
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
- ReadOnlyMany
|
||||
gcePersistentDisk:
|
||||
pdName: "abc123"
|
||||
fsType: "ext4"
|
||||
@@ -1,13 +0,0 @@
|
||||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: pv0001
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
hostPath:
|
||||
path: "/tmp/data01"
|
||||
@@ -1,14 +0,0 @@
|
||||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: pv0002
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
capacity:
|
||||
storage: 8Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
hostPath:
|
||||
path: "/somepath/data02"
|
||||
persistentVolumeReclaimPolicy: Recycle
|
||||
@@ -1,12 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv0003
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
nfs:
|
||||
path: /somepath
|
||||
server: 172.17.0.2
|
||||
@@ -1,4 +0,0 @@
|
||||
approvers:
|
||||
- caesarxuchao
|
||||
- mikedanese
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"kind": "Pod",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"labels": {
|
||||
"name": ""
|
||||
},
|
||||
"generateName": "",
|
||||
"namespace": "",
|
||||
"annotations": []
|
||||
},
|
||||
"spec": {
|
||||
|
||||
// See 'The spec schema' for details.
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: ""
|
||||
labels:
|
||||
name: ""
|
||||
namespace: ""
|
||||
annotations: []
|
||||
generateName: ""
|
||||
spec:
|
||||
? "// See 'The spec schema' for details."
|
||||
: ~
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"kind": "Pod",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "redis-django",
|
||||
"labels": {
|
||||
"app": "webapp"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "key-value-store",
|
||||
"image": "redis",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 6379
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "frontend",
|
||||
"image": "django",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 8000
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: redis-django
|
||||
labels:
|
||||
app: web
|
||||
spec:
|
||||
containers:
|
||||
- name: key-value-store
|
||||
image: redis
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
- name: frontend
|
||||
image: django
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
@@ -1,44 +0,0 @@
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "",
|
||||
"image": "",
|
||||
"command": [
|
||||
""
|
||||
],
|
||||
"args": [
|
||||
""
|
||||
],
|
||||
"env": [
|
||||
{
|
||||
"name": "",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"imagePullPolicy": "",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 0,
|
||||
"name": "",
|
||||
"protocol": ""
|
||||
}
|
||||
],
|
||||
"resources": {
|
||||
"cpu": "",
|
||||
"memory": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"restartPolicy": "",
|
||||
"volumes": [
|
||||
{
|
||||
"name": "",
|
||||
"emptyDir": {
|
||||
"medium": ""
|
||||
},
|
||||
"secret": {
|
||||
"secretName": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
spec:
|
||||
containers:
|
||||
-
|
||||
args:
|
||||
- ""
|
||||
command:
|
||||
- ""
|
||||
env:
|
||||
-
|
||||
name: ""
|
||||
value: ""
|
||||
image: ""
|
||||
imagePullPolicy: ""
|
||||
name: ""
|
||||
ports:
|
||||
-
|
||||
containerPort: 0
|
||||
name: ""
|
||||
protocol: ""
|
||||
resources:
|
||||
cpu: ""
|
||||
memory: ""
|
||||
restartPolicy: ""
|
||||
volumes:
|
||||
-
|
||||
emptyDir:
|
||||
medium: ""
|
||||
name: ""
|
||||
secret:
|
||||
secretName: ""
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
approvers:
|
||||
- bprashanth
|
||||
- bprashanth
|
||||
- caesarxuchao
|
||||
- janetkuo
|
||||
- mikedanese
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
app: nginx
|
||||
template:
|
||||
metadata:
|
||||
name: nginx
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
+276
-88
@@ -34,6 +34,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/kubernetes/pkg/api/testapi"
|
||||
"k8s.io/kubernetes/pkg/apis/admissionregistration"
|
||||
ar_validation "k8s.io/kubernetes/pkg/apis/admissionregistration/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
apps_validation "k8s.io/kubernetes/pkg/apis/apps/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
@@ -45,9 +47,13 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
ext_validation "k8s.io/kubernetes/pkg/apis/extensions/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/policy"
|
||||
policyvalidation "k8s.io/kubernetes/pkg/apis/policy/validation"
|
||||
policy_validation "k8s.io/kubernetes/pkg/apis/policy/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/rbac"
|
||||
rbac_validation "k8s.io/kubernetes/pkg/apis/rbac/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/settings"
|
||||
settings_validation "k8s.io/kubernetes/pkg/apis/settings/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/storage"
|
||||
storagevalidation "k8s.io/kubernetes/pkg/apis/storage/validation"
|
||||
storage_validation "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"
|
||||
@@ -57,24 +63,33 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
|
||||
// Enable CustomPodDNS for testing
|
||||
utilfeature.DefaultFeatureGate.Set("CustomPodDNS=true")
|
||||
switch t := obj.(type) {
|
||||
case *api.ReplicationController:
|
||||
case *admissionregistration.InitializerConfiguration:
|
||||
// cluster scope resource
|
||||
errors = ar_validation.ValidateInitializerConfiguration(t)
|
||||
case *api.ConfigMap:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateReplicationController(t)
|
||||
case *api.ReplicationControllerList:
|
||||
for i := range t.Items {
|
||||
errors = append(errors, validateObject(&t.Items[i])...)
|
||||
}
|
||||
case *api.Service:
|
||||
errors = validation.ValidateConfigMap(t)
|
||||
case *api.Endpoints:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateService(t)
|
||||
case *api.ServiceList:
|
||||
for i := range t.Items {
|
||||
errors = append(errors, validateObject(&t.Items[i])...)
|
||||
errors = validation.ValidateEndpoints(t)
|
||||
case *api.LimitRange:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateLimitRange(t)
|
||||
case *api.Namespace:
|
||||
errors = validation.ValidateNamespace(t)
|
||||
case *api.PersistentVolume:
|
||||
errors = validation.ValidatePersistentVolume(t)
|
||||
case *api.PersistentVolumeClaim:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidatePersistentVolumeClaim(t)
|
||||
case *api.Pod:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
@@ -84,55 +99,54 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
|
||||
for i := range t.Items {
|
||||
errors = append(errors, validateObject(&t.Items[i])...)
|
||||
}
|
||||
case *api.PersistentVolume:
|
||||
errors = validation.ValidatePersistentVolume(t)
|
||||
case *api.PersistentVolumeClaim:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidatePersistentVolumeClaim(t)
|
||||
case *api.PodTemplate:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidatePodTemplate(t)
|
||||
case *api.Endpoints:
|
||||
case *api.ReplicationController:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateEndpoints(t)
|
||||
case *api.Namespace:
|
||||
errors = validation.ValidateNamespace(t)
|
||||
case *api.Secret:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
errors = validation.ValidateReplicationController(t)
|
||||
case *api.ReplicationControllerList:
|
||||
for i := range t.Items {
|
||||
errors = append(errors, validateObject(&t.Items[i])...)
|
||||
}
|
||||
errors = validation.ValidateSecret(t)
|
||||
case *api.LimitRange:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateLimitRange(t)
|
||||
case *api.ResourceQuota:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateResourceQuota(t)
|
||||
case *api.Secret:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateSecret(t)
|
||||
case *api.Service:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateService(t)
|
||||
case *api.ServiceAccount:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateServiceAccount(t)
|
||||
case *api.ServiceList:
|
||||
for i := range t.Items {
|
||||
errors = append(errors, validateObject(&t.Items[i])...)
|
||||
}
|
||||
case *apps.StatefulSet:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = apps_validation.ValidateStatefulSet(t)
|
||||
case *autoscaling.HorizontalPodAutoscaler:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = autoscaling_validation.ValidateHorizontalPodAutoscaler(t)
|
||||
case *extensions.Deployment:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = ext_validation.ValidateDeployment(t)
|
||||
case *extensions.ReplicaSet:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = ext_validation.ValidateReplicaSet(t)
|
||||
case *batch.Job:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
@@ -140,42 +154,53 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
|
||||
// Job needs generateSelector called before validation, and job.Validate does this.
|
||||
// See: https://github.com/kubernetes/kubernetes/issues/20951#issuecomment-187787040
|
||||
t.ObjectMeta.UID = types.UID("fakeuid")
|
||||
errors = job.Strategy.Validate(nil, t)
|
||||
case *extensions.Ingress:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
if strings.Index(t.ObjectMeta.Name, "$") > -1 {
|
||||
t.ObjectMeta.Name = "skip-for-good"
|
||||
}
|
||||
errors = ext_validation.ValidateIngress(t)
|
||||
errors = job.Strategy.Validate(nil, t)
|
||||
case *extensions.DaemonSet:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = ext_validation.ValidateDaemonSet(t)
|
||||
case *extensions.Deployment:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = ext_validation.ValidateDeployment(t)
|
||||
case *extensions.Ingress:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = ext_validation.ValidateIngress(t)
|
||||
case *extensions.PodSecurityPolicy:
|
||||
errors = ext_validation.ValidatePodSecurityPolicy(t)
|
||||
case *extensions.ReplicaSet:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = ext_validation.ValidateReplicaSet(t)
|
||||
case *batch.CronJob:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = batch_validation.ValidateCronJob(t)
|
||||
case *api.ConfigMap:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = validation.ValidateConfigMap(t)
|
||||
case *apps.StatefulSet:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = apps_validation.ValidateStatefulSet(t)
|
||||
case *policy.PodDisruptionBudget:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = policyvalidation.ValidatePodDisruptionBudget(t)
|
||||
errors = policy_validation.ValidatePodDisruptionBudget(t)
|
||||
case *rbac.ClusterRoleBinding:
|
||||
// clusterolebinding does not accept namespace
|
||||
errors = rbac_validation.ValidateClusterRoleBinding(t)
|
||||
case *settings.PodPreset:
|
||||
if t.Namespace == "" {
|
||||
t.Namespace = api.NamespaceDefault
|
||||
}
|
||||
errors = settings_validation.ValidatePodPreset(t)
|
||||
case *storage.StorageClass:
|
||||
// storageclass does not accept namespace
|
||||
errors = storagevalidation.ValidateStorageClass(t)
|
||||
errors = storage_validation.ValidateStorageClass(t)
|
||||
default:
|
||||
errors = field.ErrorList{}
|
||||
errors = append(errors, field.InternalError(field.NewPath(""), fmt.Errorf("no validation defined for %#v", obj)))
|
||||
@@ -261,10 +286,6 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||
"pod2": {&api.Pod{}},
|
||||
"pod3": {&api.Pod{}},
|
||||
},
|
||||
"../docs/admin/namespaces": {
|
||||
"namespace-dev": {&api.Namespace{}},
|
||||
"namespace-prod": {&api.Namespace{}},
|
||||
},
|
||||
"../docs/admin/resourcequota": {
|
||||
"best-effort": {&api.ResourceQuota{}},
|
||||
"compute-resources": {&api.ResourceQuota{}},
|
||||
@@ -314,6 +335,118 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||
"nginx-deployment": {&extensions.Deployment{}},
|
||||
"replication": {&api.ReplicationController{}},
|
||||
},
|
||||
"../docs/tasks/access-application-cluster": {
|
||||
"frontend": {&api.Service{}, &extensions.Deployment{}},
|
||||
"hello-service": {&api.Service{}},
|
||||
"hello": {&extensions.Deployment{}},
|
||||
"redis-master": {&api.Pod{}},
|
||||
"two-container-pod": {&api.Pod{}},
|
||||
},
|
||||
"../docs/tasks/administer-cluster": {
|
||||
"cloud-controller-manager-daemonset-example": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.DaemonSet{}},
|
||||
"cpu-constraints": {&api.LimitRange{}},
|
||||
"cpu-constraints-pod": {&api.Pod{}},
|
||||
"cpu-constraints-pod-2": {&api.Pod{}},
|
||||
"cpu-constraints-pod-3": {&api.Pod{}},
|
||||
"cpu-constraints-pod-4": {&api.Pod{}},
|
||||
"cpu-defaults": {&api.LimitRange{}},
|
||||
"cpu-defaults-pod": {&api.Pod{}},
|
||||
"cpu-defaults-pod-2": {&api.Pod{}},
|
||||
"cpu-defaults-pod-3": {&api.Pod{}},
|
||||
"dns-horizontal-autoscaler": {&extensions.Deployment{}},
|
||||
"memory-constraints": {&api.LimitRange{}},
|
||||
"memory-constraints-pod": {&api.Pod{}},
|
||||
"memory-constraints-pod-2": {&api.Pod{}},
|
||||
"memory-constraints-pod-3": {&api.Pod{}},
|
||||
"memory-constraints-pod-4": {&api.Pod{}},
|
||||
"memory-defaults": {&api.LimitRange{}},
|
||||
"memory-defaults-pod": {&api.Pod{}},
|
||||
"memory-defaults-pod-2": {&api.Pod{}},
|
||||
"memory-defaults-pod-3": {&api.Pod{}},
|
||||
"my-scheduler": {&extensions.Deployment{}},
|
||||
"namespace-dev": {&api.Namespace{}},
|
||||
"namespace-prod": {&api.Namespace{}},
|
||||
"persistent-volume-label-initializer-config": {&admissionregistration.InitializerConfiguration{}},
|
||||
"pod1": {&api.Pod{}},
|
||||
"pod2": {&api.Pod{}},
|
||||
"pod3": {&api.Pod{}},
|
||||
"quota-mem-cpu": {&api.ResourceQuota{}},
|
||||
"quota-mem-cpu-pod": {&api.Pod{}},
|
||||
"quota-mem-cpu-pod-2": {&api.Pod{}},
|
||||
"quota-objects": {&api.ResourceQuota{}},
|
||||
"quota-objects-pvc": {&api.PersistentVolumeClaim{}},
|
||||
"quota-objects-pvc-2": {&api.PersistentVolumeClaim{}},
|
||||
"quota-pod": {&api.ResourceQuota{}},
|
||||
"quota-pod-deployment": {&extensions.Deployment{}},
|
||||
"quota-pvc-2": {&api.PersistentVolumeClaim{}},
|
||||
},
|
||||
"../docs/tasks/configure-pod-container": {
|
||||
"cpu-request-limit": {&api.Pod{}},
|
||||
"cpu-request-limit-2": {&api.Pod{}},
|
||||
"exec-liveness": {&api.Pod{}},
|
||||
"http-liveness": {&api.Pod{}},
|
||||
"init-containers": {&api.Pod{}},
|
||||
"lifecycle-events": {&api.Pod{}},
|
||||
"mem-limit-range": {&api.LimitRange{}},
|
||||
"memory-request-limit": {&api.Pod{}},
|
||||
"memory-request-limit-2": {&api.Pod{}},
|
||||
"memory-request-limit-3": {&api.Pod{}},
|
||||
"oir-pod": {&api.Pod{}},
|
||||
"oir-pod-2": {&api.Pod{}},
|
||||
"pod": {&api.Pod{}},
|
||||
"pod-redis": {&api.Pod{}},
|
||||
"private-reg-pod": {&api.Pod{}},
|
||||
"projected-volume": {&api.Pod{}},
|
||||
"qos-pod": {&api.Pod{}},
|
||||
"qos-pod-2": {&api.Pod{}},
|
||||
"qos-pod-3": {&api.Pod{}},
|
||||
"qos-pod-4": {&api.Pod{}},
|
||||
"rq-compute-resources": {&api.ResourceQuota{}},
|
||||
"security-context": {&api.Pod{}},
|
||||
"security-context-2": {&api.Pod{}},
|
||||
"security-context-3": {&api.Pod{}},
|
||||
"security-context-4": {&api.Pod{}},
|
||||
"task-pv-claim": {&api.PersistentVolumeClaim{}},
|
||||
"task-pv-pod": {&api.Pod{}},
|
||||
"task-pv-volume": {&api.PersistentVolume{}},
|
||||
"tcp-liveness-readiness": {&api.Pod{}},
|
||||
},
|
||||
"../docs/tasks/debug-application-cluster": {
|
||||
"counter-pod": {&api.Pod{}},
|
||||
"event-exporter-deploy": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.Deployment{}},
|
||||
"fluentd-gcp-configmap": {&api.ConfigMap{}},
|
||||
"fluentd-gcp-ds": {&extensions.DaemonSet{}},
|
||||
"nginx-dep": {&extensions.Deployment{}},
|
||||
"shell-demo": {&api.Pod{}},
|
||||
"termination": {&api.Pod{}},
|
||||
},
|
||||
// TODO: decide whether federation examples should be added
|
||||
"../docs/tasks/inject-data-application": {
|
||||
"commands": {&api.Pod{}},
|
||||
"dapi-envars-container": {&api.Pod{}},
|
||||
"dapi-envars-pod": {&api.Pod{}},
|
||||
"dapi-volume": {&api.Pod{}},
|
||||
"dapi-volume-resources": {&api.Pod{}},
|
||||
"envars": {&api.Pod{}},
|
||||
"podpreset-allow-db": {&settings.PodPreset{}},
|
||||
"podpreset-allow-db-merged": {&api.Pod{}},
|
||||
"podpreset-configmap": {&api.ConfigMap{}},
|
||||
"podpreset-conflict-pod": {&api.Pod{}},
|
||||
"podpreset-conflict-preset": {&settings.PodPreset{}},
|
||||
"podpreset-merged": {&api.Pod{}},
|
||||
"podpreset-multi-merged": {&api.Pod{}},
|
||||
"podpreset-pod": {&api.Pod{}},
|
||||
"podpreset-preset": {&settings.PodPreset{}},
|
||||
"podpreset-proxy": {&settings.PodPreset{}},
|
||||
"podpreset-replicaset-merged": {&api.Pod{}},
|
||||
"podpreset-replicaset": {&extensions.ReplicaSet{}},
|
||||
"secret": {&api.Secret{}},
|
||||
"secret-envars-pod": {&api.Pod{}},
|
||||
"secret-pod": {&api.Pod{}},
|
||||
},
|
||||
"../docs/tasks/job": {
|
||||
"job": {&batch.Job{}},
|
||||
},
|
||||
"../docs/tasks/job/coarse-parallel-processing-work-queue": {
|
||||
"job": {&batch.Job{}},
|
||||
},
|
||||
@@ -322,21 +455,53 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||
"redis-pod": {&api.Pod{}},
|
||||
"redis-service": {&api.Service{}},
|
||||
},
|
||||
"../docs/tutorials/stateful-application": {
|
||||
"gce-volume": {&api.PersistentVolume{}},
|
||||
"../docs/tasks/run-application": {
|
||||
"deployment": {&extensions.Deployment{}},
|
||||
"deployment-patch-demo": {&extensions.Deployment{}},
|
||||
"deployment-scale": {&extensions.Deployment{}},
|
||||
"deployment-update": {&extensions.Deployment{}},
|
||||
"mysql-configmap": {&api.ConfigMap{}},
|
||||
"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{}},
|
||||
},
|
||||
"../docs/tutorials/clusters": {
|
||||
"hello-apparmor-pod": {&api.Pod{}},
|
||||
"my-scheduler": {&extensions.Deployment{}},
|
||||
},
|
||||
"../docs/tutorials/object-management-kubectl": {
|
||||
"simple_deployment": {&extensions.Deployment{}},
|
||||
"update_deployment": {&extensions.Deployment{}},
|
||||
},
|
||||
"../docs/tutorials/stateful-application": {
|
||||
"web": {&api.Service{}, &apps.StatefulSet{}},
|
||||
"webp": {&api.Service{}, &apps.StatefulSet{}},
|
||||
"zookeeper": {&api.Service{}, &api.Service{}, &policy.PodDisruptionBudget{}, &apps.StatefulSet{}},
|
||||
},
|
||||
"../docs/tutorials/stateful-application/cassandra": {
|
||||
"cassandra-service": {&api.Service{}},
|
||||
"cassandra-statefulset": {&apps.StatefulSet{}, &storage.StorageClass{}},
|
||||
},
|
||||
"../docs/tutorials/stateful-application/mysql-wordpress-persistent-volume": {
|
||||
"local-volumes": {&api.PersistentVolume{}, &api.PersistentVolume{}},
|
||||
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
|
||||
"wordpress-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
|
||||
},
|
||||
"../docs/tutorials/stateless-application": {
|
||||
"deployment": {&extensions.Deployment{}},
|
||||
"deployment-scale": {&extensions.Deployment{}},
|
||||
"deployment-update": {&extensions.Deployment{}},
|
||||
},
|
||||
"../docs/tutorials/stateless-application/guestbook": {
|
||||
"frontend-deployment": {&extensions.Deployment{}},
|
||||
"frontend-service": {&api.Service{}},
|
||||
"redis-master-deployment": {&extensions.Deployment{}},
|
||||
"redis-master-service": {&api.Service{}},
|
||||
"redis-slave-deployment": {&extensions.Deployment{}},
|
||||
"redis-slave-service": {&api.Service{}},
|
||||
},
|
||||
"../docs/user-guide": {
|
||||
"bad-nginx-deployment": {&extensions.Deployment{}},
|
||||
"counter-pod": {&api.Pod{}},
|
||||
"curlpod": {&extensions.Deployment{}},
|
||||
"deployment": {&extensions.Deployment{}},
|
||||
"ingress": {&extensions.Ingress{}},
|
||||
@@ -356,46 +521,69 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||
"redis-resource-deployment": {&extensions.Deployment{}},
|
||||
"redis-secret-deployment": {&extensions.Deployment{}},
|
||||
"run-my-nginx": {&extensions.Deployment{}},
|
||||
"cronjob": {&batch.CronJob{}},
|
||||
},
|
||||
"../docs/user-guide/configmap": {
|
||||
"command-pod": {&api.Pod{}},
|
||||
"configmap": {&api.ConfigMap{}},
|
||||
"env-pod": {&api.Pod{}},
|
||||
"mount-file-pod": {&api.Pod{}},
|
||||
"volume-pod": {&api.Pod{}},
|
||||
},
|
||||
"../docs/user-guide/configmap/redis": {
|
||||
"redis-pod": {&api.Pod{}},
|
||||
},
|
||||
"../docs/user-guide/downward-api": {
|
||||
"dapi-pod": {&api.Pod{}},
|
||||
"dapi-container-resources": {&api.Pod{}},
|
||||
},
|
||||
"../docs/user-guide/downward-api/volume/": {
|
||||
"../docs/user-guide/downward-api/volume": {
|
||||
"dapi-volume": {&api.Pod{}},
|
||||
"dapi-volume-resources": {&api.Pod{}},
|
||||
},
|
||||
"../docs/user-guide/environment-guide": {
|
||||
"backend-rc": {&api.ReplicationController{}},
|
||||
"backend-srv": {&api.Service{}},
|
||||
"show-rc": {&api.ReplicationController{}},
|
||||
"show-srv": {&api.Service{}},
|
||||
},
|
||||
"../docs/user-guide/horizontal-pod-autoscaling": {
|
||||
"hpa-php-apache": {&autoscaling.HorizontalPodAutoscaler{}},
|
||||
},
|
||||
"../docs/user-guide/jobs/work-queue-1": {
|
||||
"job": {&batch.Job{}},
|
||||
},
|
||||
"../docs/user-guide/jobs/work-queue-2": {
|
||||
"job": {&batch.Job{}},
|
||||
"redis-pod": {&api.Pod{}},
|
||||
"redis-service": {&api.Service{}},
|
||||
},
|
||||
"../docs/user-guide/liveness": {
|
||||
"exec-liveness": {&api.Pod{}},
|
||||
"http-liveness": {&api.Pod{}},
|
||||
"http-liveness-named-port": {&api.Pod{}},
|
||||
},
|
||||
"../docs/user-guide/nginx": {
|
||||
"nginx-deployment": {&extensions.Deployment{}},
|
||||
"nginx-svc": {&api.Service{}},
|
||||
},
|
||||
"../docs/user-guide/node-selection": {
|
||||
"pod": {&api.Pod{}},
|
||||
"pod-with-node-affinity": {&api.Pod{}},
|
||||
"pod-with-pod-affinity": {&api.Pod{}},
|
||||
},
|
||||
"../docs/user-guide/persistent-volumes/volumes": {
|
||||
"local-01": {&api.PersistentVolume{}},
|
||||
"local-02": {&api.PersistentVolume{}},
|
||||
"gce": {&api.PersistentVolume{}},
|
||||
"nfs": {&api.PersistentVolume{}},
|
||||
},
|
||||
"../docs/user-guide/persistent-volumes/claims": {
|
||||
"claim-01": {&api.PersistentVolumeClaim{}},
|
||||
"claim-02": {&api.PersistentVolumeClaim{}},
|
||||
"claim-03": {&api.PersistentVolumeClaim{}},
|
||||
},
|
||||
"../docs/user-guide/persistent-volumes/simpletest": {
|
||||
"namespace": {&api.Namespace{}},
|
||||
"pod": {&api.Pod{}},
|
||||
"service": {&api.Service{}},
|
||||
"../docs/user-guide/replicasets": {
|
||||
"frontend": {&extensions.ReplicaSet{}},
|
||||
"hpa-rs": {&autoscaling.HorizontalPodAutoscaler{}},
|
||||
"redis-slave": {&extensions.ReplicaSet{}},
|
||||
},
|
||||
"../docs/user-guide/secrets": {
|
||||
"secret-pod": {&api.Pod{}},
|
||||
"secret": {&api.Secret{}},
|
||||
"secret-env-pod": {&api.Pod{}},
|
||||
"secret-pod": {&api.Pod{}},
|
||||
},
|
||||
"../docs/user-guide/services": {
|
||||
"load-balancer-sample": {&api.Service{}},
|
||||
"service-sample": {&api.Service{}},
|
||||
},
|
||||
"../docs/user-guide/update-demo": {
|
||||
"kitten-rc": {&api.ReplicationController{}},
|
||||
|
||||
Reference in New Issue
Block a user