mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-23 02:26:52 +00:00
Merge pull request #53794 from xiangpengzhao/poduid-e2e-dapi
Automatic merge from submit-queue (batch tested with PRs 53575, 53794). 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>. Add e2e test case for downward API exposing pod UID **What this PR does / why we need it**: Pod UID is added to downward API env var in #48125 for 1.8. This PR adds a e2e test case for it. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # ref: #48125 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
d7e56d5330
@ -29,7 +29,10 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var hostIPVersion = utilversion.MustParseSemantic("v1.8.0")
|
var (
|
||||||
|
hostIPVersion = utilversion.MustParseSemantic("v1.8.0")
|
||||||
|
podUIDVersion = utilversion.MustParseSemantic("v1.8.0")
|
||||||
|
)
|
||||||
|
|
||||||
var _ = Describe("[sig-api-machinery] Downward API", func() {
|
var _ = Describe("[sig-api-machinery] Downward API", func() {
|
||||||
f := framework.NewDefaultFramework("downward-api")
|
f := framework.NewDefaultFramework("downward-api")
|
||||||
@ -198,6 +201,28 @@ var _ = Describe("[sig-api-machinery] Downward API", func() {
|
|||||||
|
|
||||||
testDownwardAPIUsingPod(f, pod, env, expectations)
|
testDownwardAPIUsingPod(f, pod, env, expectations)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should provide pod UID as env vars [Conformance]", func() {
|
||||||
|
framework.SkipUnlessServerVersionGTE(podUIDVersion, f.ClientSet.Discovery())
|
||||||
|
podName := "downward-api-" + string(uuid.NewUUID())
|
||||||
|
env := []v1.EnvVar{
|
||||||
|
{
|
||||||
|
Name: "POD_UID",
|
||||||
|
ValueFrom: &v1.EnvVarSource{
|
||||||
|
FieldRef: &v1.ObjectFieldSelector{
|
||||||
|
APIVersion: "v1",
|
||||||
|
FieldPath: "metadata.uid",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
expectations := []string{
|
||||||
|
fmt.Sprintf("POD_UID=[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}"),
|
||||||
|
}
|
||||||
|
|
||||||
|
testDownwardAPI(f, podName, env, expectations)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
func testDownwardAPI(f *framework.Framework, podName string, env []v1.EnvVar, expectations []string) {
|
func testDownwardAPI(f *framework.Framework, podName string, env []v1.EnvVar, expectations []string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user