1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-14 20:56:42 +00:00

test/e2e: no pod restart policy of nfd-worker by default

Fixes stricter API check on daemonset pod spec that started to cause e2e
test failures. RestartPolicyNever that we previously set (by defaylt)
isn't compatible with DaemonSets.
This commit is contained in:
Markus Lehtonen 2022-12-01 16:03:56 +02:00
parent fbce8d7702
commit 42ae216284
2 changed files with 8 additions and 3 deletions

View file

@ -158,6 +158,7 @@ var _ = SIGDescribe("Node Feature Discovery", func() {
// Launch nfd-worker
By("Creating a nfd worker pod")
podSpecOpts := []testpod.SpecOption{
testpod.SpecWithRestartPolicy(corev1.RestartPolicyNever),
testpod.SpecWithContainerImage(fmt.Sprintf("%s:%s", *dockerRepo, *dockerTag)),
testpod.SpecWithContainerExtraArgs("-oneshot", "-label-sources=fake"),
}

View file

@ -174,12 +174,16 @@ func NFDWorker(opts ...SpecOption) *corev1.Pod {
},
Spec: *nfdWorkerSpec(opts...),
}
p.Spec.RestartPolicy = corev1.RestartPolicyNever
return p
}
// SpecWithRestartPolicy returns a SpecOption that sets the pod restart policy
func SpecWithRestartPolicy(restartpolicy corev1.RestartPolicy) SpecOption {
return func(spec *corev1.PodSpec) {
spec.RestartPolicy = restartpolicy
}
}
// SpecWithContainerImage returns a SpecOption that sets the image used by the first container.
func SpecWithContainerImage(image string) SpecOption {
return func(spec *corev1.PodSpec) {