mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-17 22:08:33 +00:00
Merge pull request #1039 from marquiz/backports/e2e
[release-0.12] e2e: init docker image
This commit is contained in:
commit
3260eb3a25
3 changed files with 18 additions and 11 deletions
|
@ -18,6 +18,7 @@ package e2e
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -29,6 +30,11 @@ import (
|
||||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
dockerRepo = flag.String("nfd.repo", "registry.k8s.io/nfd/node-feature-discovery", "Docker repository to fetch image from")
|
||||||
|
dockerTag = flag.String("nfd.tag", "v0.12.0", "Docker tag to use")
|
||||||
|
)
|
||||||
|
|
||||||
// handleFlags sets up all flags and parses the command line.
|
// handleFlags sets up all flags and parses the command line.
|
||||||
func handleFlags() {
|
func handleFlags() {
|
||||||
config.CopyFlags(config.Flags, flag.CommandLine)
|
config.CopyFlags(config.Flags, flag.CommandLine)
|
||||||
|
@ -37,6 +43,11 @@ func handleFlags() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// must be called after flags are parsed
|
||||||
|
func dockerImage() string {
|
||||||
|
return fmt.Sprintf("%s:%s", *dockerRepo, *dockerTag)
|
||||||
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
// Register test flags, then parse flags.
|
// Register test flags, then parse flags.
|
||||||
handleFlags()
|
handleFlags()
|
||||||
|
|
|
@ -18,7 +18,6 @@ package e2e
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -49,9 +48,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
dockerRepo = flag.String("nfd.repo", "registry.k8s.io/nfd/node-feature-discovery", "Docker repository to fetch image from")
|
|
||||||
dockerTag = flag.String("nfd.tag", "v0.12.0", "Docker tag to use")
|
|
||||||
dockerImage = fmt.Sprintf("%s:%s", *dockerRepo, *dockerTag)
|
|
||||||
testTolerations = []corev1.Toleration{
|
testTolerations = []corev1.Toleration{
|
||||||
{
|
{
|
||||||
Key: "nfd.node.kubernetes.io/fake-special-node",
|
Key: "nfd.node.kubernetes.io/fake-special-node",
|
||||||
|
@ -216,7 +212,7 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
|
||||||
// Launch nfd-master
|
// Launch nfd-master
|
||||||
By("Creating nfd master pod and nfd-master service")
|
By("Creating nfd master pod and nfd-master service")
|
||||||
podSpecOpts := createPodSpecOpts(
|
podSpecOpts := createPodSpecOpts(
|
||||||
testpod.SpecWithContainerImage(dockerImage),
|
testpod.SpecWithContainerImage(dockerImage()),
|
||||||
testpod.SpecWithTolerations(testTolerations),
|
testpod.SpecWithTolerations(testTolerations),
|
||||||
testpod.SpecWithContainerExtraArgs("-enable-taints"),
|
testpod.SpecWithContainerExtraArgs("-enable-taints"),
|
||||||
)
|
)
|
||||||
|
@ -265,7 +261,7 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
|
||||||
By("Creating a nfd worker pod")
|
By("Creating a nfd worker pod")
|
||||||
podSpecOpts := createPodSpecOpts(
|
podSpecOpts := createPodSpecOpts(
|
||||||
testpod.SpecWithRestartPolicy(corev1.RestartPolicyNever),
|
testpod.SpecWithRestartPolicy(corev1.RestartPolicyNever),
|
||||||
testpod.SpecWithContainerImage(dockerImage),
|
testpod.SpecWithContainerImage(dockerImage()),
|
||||||
testpod.SpecWithContainerExtraArgs("-oneshot", "-label-sources=fake"),
|
testpod.SpecWithContainerExtraArgs("-oneshot", "-label-sources=fake"),
|
||||||
testpod.SpecWithTolerations(testTolerations),
|
testpod.SpecWithTolerations(testTolerations),
|
||||||
)
|
)
|
||||||
|
@ -318,7 +314,7 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
|
||||||
|
|
||||||
By("Creating nfd-worker daemonset")
|
By("Creating nfd-worker daemonset")
|
||||||
podSpecOpts := createPodSpecOpts(
|
podSpecOpts := createPodSpecOpts(
|
||||||
testpod.SpecWithContainerImage(dockerImage),
|
testpod.SpecWithContainerImage(dockerImage()),
|
||||||
testpod.SpecWithTolerations(testTolerations),
|
testpod.SpecWithTolerations(testTolerations),
|
||||||
)
|
)
|
||||||
workerDS := testds.NFDWorker(podSpecOpts...)
|
workerDS := testds.NFDWorker(podSpecOpts...)
|
||||||
|
@ -448,7 +444,7 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
|
||||||
|
|
||||||
By("Creating nfd-worker daemonset with configmap mounted")
|
By("Creating nfd-worker daemonset with configmap mounted")
|
||||||
podSpecOpts := createPodSpecOpts(
|
podSpecOpts := createPodSpecOpts(
|
||||||
testpod.SpecWithContainerImage(dockerImage),
|
testpod.SpecWithContainerImage(dockerImage()),
|
||||||
testpod.SpecWithConfigMap(cm1.Name, filepath.Join(custom.Directory, "cm1")),
|
testpod.SpecWithConfigMap(cm1.Name, filepath.Join(custom.Directory, "cm1")),
|
||||||
testpod.SpecWithConfigMap(cm2.Name, filepath.Join(custom.Directory, "cm2")),
|
testpod.SpecWithConfigMap(cm2.Name, filepath.Join(custom.Directory, "cm2")),
|
||||||
testpod.SpecWithTolerations(testTolerations),
|
testpod.SpecWithTolerations(testTolerations),
|
||||||
|
@ -511,7 +507,7 @@ core:
|
||||||
|
|
||||||
By("Creating nfd-worker daemonset")
|
By("Creating nfd-worker daemonset")
|
||||||
podSpecOpts := createPodSpecOpts(
|
podSpecOpts := createPodSpecOpts(
|
||||||
testpod.SpecWithContainerImage(dockerImage),
|
testpod.SpecWithContainerImage(dockerImage()),
|
||||||
testpod.SpecWithConfigMap(cm.Name, "/etc/kubernetes/node-feature-discovery"),
|
testpod.SpecWithConfigMap(cm.Name, "/etc/kubernetes/node-feature-discovery"),
|
||||||
testpod.SpecWithTolerations(testTolerations),
|
testpod.SpecWithTolerations(testTolerations),
|
||||||
)
|
)
|
||||||
|
|
|
@ -115,7 +115,7 @@ var _ = SIGDescribe("Node Feature Discovery topology updater", func() {
|
||||||
kcfg := cfg.GetKubeletConfig()
|
kcfg := cfg.GetKubeletConfig()
|
||||||
By(fmt.Sprintf("Using config (%#v)", kcfg))
|
By(fmt.Sprintf("Using config (%#v)", kcfg))
|
||||||
|
|
||||||
podSpecOpts := []testpod.SpecOption{testpod.SpecWithContainerImage(dockerImage)}
|
podSpecOpts := []testpod.SpecOption{testpod.SpecWithContainerImage(dockerImage())}
|
||||||
topologyUpdaterDaemonSet = testds.NFDTopologyUpdater(kcfg, podSpecOpts...)
|
topologyUpdaterDaemonSet = testds.NFDTopologyUpdater(kcfg, podSpecOpts...)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ excludeList:
|
||||||
By(fmt.Sprintf("Using config (%#v)", kcfg))
|
By(fmt.Sprintf("Using config (%#v)", kcfg))
|
||||||
|
|
||||||
podSpecOpts := []testpod.SpecOption{
|
podSpecOpts := []testpod.SpecOption{
|
||||||
testpod.SpecWithContainerImage(dockerImage),
|
testpod.SpecWithContainerImage(dockerImage()),
|
||||||
testpod.SpecWithConfigMap(cm.Name, "/etc/kubernetes/node-feature-discovery"),
|
testpod.SpecWithConfigMap(cm.Name, "/etc/kubernetes/node-feature-discovery"),
|
||||||
}
|
}
|
||||||
topologyUpdaterDaemonSet = testds.NFDTopologyUpdater(kcfg, podSpecOpts...)
|
topologyUpdaterDaemonSet = testds.NFDTopologyUpdater(kcfg, podSpecOpts...)
|
||||||
|
|
Loading…
Add table
Reference in a new issue