Merge pull request #53673 from timothysc/downward_hostip_e2e

Automatic merge from submit-queue (batch tested with PRs 53678, 53677, 53682, 53673). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix to prevent downward api change break on older versions

Signed-off-by: Timothy St. Clair <timothysc@gmail.com>

**What this PR does / why we need it**:
Prevents "should provide pod and host IP as an env var [Conformance]" from running on older versions whose api does not have that field and will break on those clusters. 

This is not a upstream tested configuration, but downstream folks do this regularly.  

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: 
N/A

**Special notes for your reviewer**:
N/A

**Release note**:

```
Prevent downward api-change from breaking on older version
```

/cc @kubernetes/sig-testing-bugs @jpbetz  @marun
This commit is contained in:
Kubernetes Submit Queue 2017-10-10 18:36:08 -07:00 committed by GitHub
commit 3ac4762db9
2 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,7 @@ go_library(
"//pkg/kubelet:go_default_library",
"//pkg/kubelet/sysctl:go_default_library",
"//pkg/security/apparmor:go_default_library",
"//pkg/util/version:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/utils:go_default_library",
"//test/utils/image:go_default_library",

View File

@ -23,11 +23,14 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
utilversion "k8s.io/kubernetes/pkg/util/version"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo"
)
var hostIPVersion = utilversion.MustParseSemantic("v1.8.0")
var _ = framework.KubeDescribe("Downward API", func() {
f := framework.NewDefaultFramework("downward-api")
@ -63,6 +66,7 @@ var _ = framework.KubeDescribe("Downward API", func() {
})
It("should provide pod and host IP as an env var [Conformance]", func() {
framework.SkipUnlessServerVersionGTE(hostIPVersion, f.ClientSet.Discovery())
podName := "downward-api-" + string(uuid.NewUUID())
env := []v1.EnvVar{
{