From 1780b5c74fcf78e016bc659e07dbe151af1bb5ea Mon Sep 17 00:00:00 2001 From: Qiming Date: Thu, 14 Mar 2019 01:47:40 +0800 Subject: [PATCH] Fix Travis example tests for release-1.13 (#13145) xref: #13122 --- .travis.yml | 4 +- content/en/examples/examples_test.go | 128 +++++++++--------- .../pods/pod-projected-svc-token.yaml | 1 + 3 files changed, 66 insertions(+), 67 deletions(-) diff --git a/.travis.yml b/.travis.yml index c030808c6aac1..4f150089441b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.10.2 + - 1.11.5 jobs: include: @@ -16,7 +16,7 @@ jobs: # Make sure we are testing against the correct branch - pushd $GOPATH/src/k8s.io && git clone https://github.com/kubernetes/kubernetes && popd - - pushd $GOPATH/src/k8s.io/kubernetes && git checkout release-1.11 && popd + - pushd $GOPATH/src/k8s.io/kubernetes && git checkout release-1.13 && make generated_files && popd - cp -L -R $GOPATH/src/k8s.io/kubernetes/vendor/ $GOPATH/src/ - rm -r $GOPATH/src/k8s.io/kubernetes/vendor/ diff --git a/content/en/examples/examples_test.go b/content/en/examples/examples_test.go index 78a5c2d18f089..97ac154f68c57 100644 --- a/content/en/examples/examples_test.go +++ b/content/en/examples/examples_test.go @@ -88,8 +88,6 @@ func getCodecForObject(obj runtime.Object) (runtime.Codec, error) { func validateObject(obj runtime.Object) (errors field.ErrorList) { // Enable CustomPodDNS for testing utilfeature.DefaultFeatureGate.Set("CustomPodDNS=true") - // Enable TokenRequestProjection for ServiceAccountTokenVolumeProjection testing - utilfeature.DefaultFeatureGate.Set("TokenRequestProjection=true") switch t := obj.(type) { case *admissionregistration.InitializerConfiguration: // cluster scope resource @@ -186,16 +184,16 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) { t.ObjectMeta.Name = "skip-for-good" } errors = job.Strategy.Validate(nil, t) - case *extensions.DaemonSet: + case *apps.DaemonSet: if t.Namespace == "" { t.Namespace = api.NamespaceDefault } - errors = ext_validation.ValidateDaemonSet(t) - case *extensions.Deployment: + errors = apps_validation.ValidateDaemonSet(t) + case *apps.Deployment: if t.Namespace == "" { t.Namespace = api.NamespaceDefault } - errors = ext_validation.ValidateDeployment(t) + errors = apps_validation.ValidateDeployment(t) case *extensions.Ingress: if t.Namespace == "" { t.Namespace = api.NamespaceDefault @@ -203,11 +201,11 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) { errors = ext_validation.ValidateIngress(t) case *policy.PodSecurityPolicy: errors = policy_validation.ValidatePodSecurityPolicy(t) - case *extensions.ReplicaSet: + case *apps.ReplicaSet: if t.Namespace == "" { t.Namespace = api.NamespaceDefault } - errors = ext_validation.ValidateReplicaSet(t) + errors = apps_validation.ValidateReplicaSet(t) case *batch.CronJob: if t.Namespace == "" { t.Namespace = api.NamespaceDefault @@ -300,11 +298,11 @@ func TestExampleObjectSchemas(t *testing.T) { "namespace-prod": {&api.Namespace{}}, }, "admin/cloud": { - "ccm-example": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.DaemonSet{}}, + "ccm-example": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &apps.DaemonSet{}}, }, "admin/dns": { "busybox": {&api.Pod{}}, - "dns-horizontal-autoscaler": {&extensions.Deployment{}}, + "dns-horizontal-autoscaler": {&apps.Deployment{}}, }, "admin/logging": { "fluentd-sidecar-config": {&api.ConfigMap{}}, @@ -338,42 +336,42 @@ func TestExampleObjectSchemas(t *testing.T) { "quota-objects-pvc": {&api.PersistentVolumeClaim{}}, "quota-objects-pvc-2": {&api.PersistentVolumeClaim{}}, "quota-pod": {&api.ResourceQuota{}}, - "quota-pod-deployment": {&extensions.Deployment{}}, + "quota-pod-deployment": {&apps.Deployment{}}, }, "admin/sched": { - "my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.Deployment{}}, + "my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &apps.Deployment{}}, "pod1": {&api.Pod{}}, "pod2": {&api.Pod{}}, "pod3": {&api.Pod{}}, }, "application": { - "deployment": {&extensions.Deployment{}}, - "deployment-patch": {&extensions.Deployment{}}, - "deployment-scale": {&extensions.Deployment{}}, - "deployment-update": {&extensions.Deployment{}}, - "nginx-app": {&api.Service{}, &extensions.Deployment{}}, - "nginx-with-request": {&extensions.Deployment{}}, + "deployment": {&apps.Deployment{}}, + "deployment-patch": {&apps.Deployment{}}, + "deployment-scale": {&apps.Deployment{}}, + "deployment-update": {&apps.Deployment{}}, + "nginx-app": {&api.Service{}, &apps.Deployment{}}, + "nginx-with-request": {&apps.Deployment{}}, "shell-demo": {&api.Pod{}}, - "simple_deployment": {&extensions.Deployment{}}, - "update_deployment": {&extensions.Deployment{}}, + "simple_deployment": {&apps.Deployment{}}, + "update_deployment": {&apps.Deployment{}}, }, "application/cassandra": { "cassandra-service": {&api.Service{}}, "cassandra-statefulset": {&apps.StatefulSet{}, &storage.StorageClass{}}, }, "application/guestbook": { - "frontend-deployment": {&extensions.Deployment{}}, + "frontend-deployment": {&apps.Deployment{}}, "frontend-service": {&api.Service{}}, - "redis-master-deployment": {&extensions.Deployment{}}, + "redis-master-deployment": {&apps.Deployment{}}, "redis-master-service": {&api.Service{}}, - "redis-slave-deployment": {&extensions.Deployment{}}, + "redis-slave-deployment": {&apps.Deployment{}}, "redis-slave-service": {&api.Service{}}, }, "application/hpa": { "php-apache": {&autoscaling.HorizontalPodAutoscaler{}}, }, "application/nginx": { - "nginx-deployment": {&extensions.Deployment{}}, + "nginx-deployment": {&apps.Deployment{}}, "nginx-svc": {&api.Service{}}, }, "application/job": { @@ -390,7 +388,7 @@ func TestExampleObjectSchemas(t *testing.T) { }, "application/mysql": { "mysql-configmap": {&api.ConfigMap{}}, - "mysql-deployment": {&api.Service{}, &extensions.Deployment{}}, + "mysql-deployment": {&api.Service{}, &apps.Deployment{}}, "mysql-pv": {&api.PersistentVolume{}, &api.PersistentVolumeClaim{}}, "mysql-services": {&api.Service{}, &api.Service{}}, "mysql-statefulset": {&apps.StatefulSet{}}, @@ -400,34 +398,34 @@ func TestExampleObjectSchemas(t *testing.T) { "web-parallel": {&api.Service{}, &apps.StatefulSet{}}, }, "application/wordpress": { - "mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}}, - "wordpress-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}}, + "mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &apps.Deployment{}}, + "wordpress-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &apps.Deployment{}}, }, "application/zookeeper": { "zookeeper": {&api.Service{}, &api.Service{}, &policy.PodDisruptionBudget{}, &apps.StatefulSet{}}, }, "controllers": { - "daemonset": {&extensions.DaemonSet{}}, - "frontend": {&extensions.ReplicaSet{}}, + "daemonset": {&apps.DaemonSet{}}, + "frontend": {&apps.ReplicaSet{}}, "hpa-rs": {&autoscaling.HorizontalPodAutoscaler{}}, "job": {&batch.Job{}}, - "replicaset": {&extensions.ReplicaSet{}}, + "replicaset": {&apps.ReplicaSet{}}, "replication": {&api.ReplicationController{}}, - "nginx-deployment": {&extensions.Deployment{}}, + "nginx-deployment": {&apps.Deployment{}}, }, "debug": { "counter-pod": {&api.Pod{}}, - "event-exporter": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &extensions.Deployment{}}, + "event-exporter": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &apps.Deployment{}}, "fluentd-gcp-configmap": {&api.ConfigMap{}}, - "fluentd-gcp-ds": {&extensions.DaemonSet{}}, - "node-problem-detector": {&extensions.DaemonSet{}}, - "node-problem-detector-configmap": {&extensions.DaemonSet{}}, + "fluentd-gcp-ds": {&apps.DaemonSet{}}, + "node-problem-detector": {&apps.DaemonSet{}}, + "node-problem-detector-configmap": {&apps.DaemonSet{}}, "termination": {&api.Pod{}}, }, "federation": { - "policy-engine-deployment": {&extensions.Deployment{}}, + "policy-engine-deployment": {&apps.Deployment{}}, "policy-engine-service": {&api.Service{}}, - "replicaset-example-policy": {&extensions.ReplicaSet{}}, + "replicaset-example-policy": {&apps.ReplicaSet{}}, "scheduling-policy-admission": {&api.ConfigMap{}}, }, "podpreset": { @@ -442,28 +440,28 @@ func TestExampleObjectSchemas(t *testing.T) { "preset": {&settings.PodPreset{}}, "proxy": {&settings.PodPreset{}}, "replicaset-merged": {&api.Pod{}}, - "replicaset": {&extensions.ReplicaSet{}}, + "replicaset": {&apps.ReplicaSet{}}, }, "pods": { - "commands": {&api.Pod{}}, - "init-containers": {&api.Pod{}}, - "lifecycle-events": {&api.Pod{}}, - "pod-configmap-env-var-valueFrom": {&api.Pod{}}, - "pod-configmap-envFrom": {&api.Pod{}}, - "pod-configmap-volume-specific-key": {&api.Pod{}}, - "pod-configmap-volume": {&api.Pod{}}, - "pod-multiple-configmap-env-variable": {&api.Pod{}}, - "pod-nginx-specific-node": {&api.Pod{}}, - "pod-nginx": {&api.Pod{}}, - "pod-projected-svc-token": {&api.Pod{}}, - "pod-rs": {&api.Pod{}, &api.Pod{}}, - "pod-single-configmap-env-variable": {&api.Pod{}}, - "pod-with-node-affinity": {&api.Pod{}}, - "pod-with-pod-affinity": {&api.Pod{}}, - "private-reg-pod": {&api.Pod{}}, - "share-process-namespace": {&api.Pod{}}, - "simple-pod": {&api.Pod{}}, - "two-container-pod": {&api.Pod{}}, + "commands": {&api.Pod{}}, + "init-containers": {&api.Pod{}}, + "lifecycle-events": {&api.Pod{}}, + "pod-configmap-env-var-valueFrom": {&api.Pod{}}, + "pod-configmap-envFrom": {&api.Pod{}}, + "pod-configmap-volume": {&api.Pod{}}, + "pod-configmap-volume-specific-key": {&api.Pod{}}, + "pod-multiple-configmap-env-variable": {&api.Pod{}}, + "pod-nginx-specific-node": {&api.Pod{}}, + "pod-nginx": {&api.Pod{}}, + "pod-projected-svc-token": {&api.Pod{}}, + "pod-rs": {&api.Pod{}, &api.Pod{}}, + "pod-single-configmap-env-variable": {&api.Pod{}}, + "pod-with-node-affinity": {&api.Pod{}}, + "pod-with-pod-affinity": {&api.Pod{}}, + "private-reg-pod": {&api.Pod{}}, + "share-process-namespace": {&api.Pod{}}, + "simple-pod": {&api.Pod{}}, + "two-container-pod": {&api.Pod{}}, }, "pods/config": { "redis-pod": {&api.Pod{}}, @@ -523,24 +521,24 @@ func TestExampleObjectSchemas(t *testing.T) { "nginx-service": {&api.Service{}}, }, "service/access": { - "frontend": {&api.Service{}, &extensions.Deployment{}}, + "frontend": {&api.Service{}, &apps.Deployment{}}, "hello-service": {&api.Service{}}, - "hello": {&extensions.Deployment{}}, + "hello": {&apps.Deployment{}}, }, "service/networking": { - "curlpod": {&extensions.Deployment{}}, + "curlpod": {&apps.Deployment{}}, "custom-dns": {&api.Pod{}}, "hostaliases-pod": {&api.Pod{}}, "ingress": {&extensions.Ingress{}}, - "nginx-secure-app": {&api.Service{}, &extensions.Deployment{}}, + "nginx-secure-app": {&api.Service{}, &apps.Deployment{}}, "nginx-svc": {&api.Service{}}, - "run-my-nginx": {&extensions.Deployment{}}, + "run-my-nginx": {&apps.Deployment{}}, }, "windows": { "configmap-pod": {&api.ConfigMap{}, &api.Pod{}}, - "daemonset": {&extensions.DaemonSet{}}, - "deploy-hyperv": {&extensions.Deployment{}}, - "deploy-resource": {&extensions.Deployment{}}, + "daemonset": {&apps.DaemonSet{}}, + "deploy-hyperv": {&apps.Deployment{}}, + "deploy-resource": {&apps.Deployment{}}, "emptydir-pod": {&api.Pod{}}, "hostpath-volume-pod": {&api.Pod{}}, "secret-pod": {&api.Secret{}, &api.Pod{}}, diff --git a/content/en/examples/pods/pod-projected-svc-token.yaml b/content/en/examples/pods/pod-projected-svc-token.yaml index 72b4ac2b520d3..1c6ba249806cb 100644 --- a/content/en/examples/pods/pod-projected-svc-token.yaml +++ b/content/en/examples/pods/pod-projected-svc-token.yaml @@ -9,6 +9,7 @@ spec: volumeMounts: - mountPath: /var/run/secrets/tokens name: vault-token + serviceAccountName: acct volumes: - name: vault-token projected: