mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Merge pull request #119158 from dims/skip-GracefulNodeShutdown-tests-on-older-systemd-versions
Skip GracefulNodeShutdown on older systemd versions
This commit is contained in:
commit
16e3980c08
@ -23,7 +23,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
@ -40,6 +43,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||||
|
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
||||||
|
|
||||||
"github.com/godbus/dbus/v5"
|
"github.com/godbus/dbus/v5"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
@ -57,6 +61,28 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut
|
|||||||
f := framework.NewDefaultFramework("graceful-node-shutdown")
|
f := framework.NewDefaultFramework("graceful-node-shutdown")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
|
ginkgo.BeforeEach(func() {
|
||||||
|
if _, err := exec.LookPath("systemd-run"); err == nil {
|
||||||
|
if version, verr := exec.Command("systemd-run", "--version").Output(); verr == nil {
|
||||||
|
// sample output from $ systemd-run --version
|
||||||
|
// systemd 245 (245.4-4ubuntu3.13)
|
||||||
|
re := regexp.MustCompile(`systemd (\d+)`)
|
||||||
|
if match := re.FindSubmatch(version); len(match) > 1 {
|
||||||
|
systemdVersion, err := strconv.Atoi(string(match[1]))
|
||||||
|
if err != nil {
|
||||||
|
framework.Logf("failed to parse systemd version with error %v, 'systemd-run --version' output was [%s]", err, version)
|
||||||
|
} else {
|
||||||
|
// See comments in issue 107043, this is a known problem for a long time that this feature does not work on older systemd
|
||||||
|
// https://github.com/kubernetes/kubernetes/issues/107043#issuecomment-997546598
|
||||||
|
if systemdVersion < 245 {
|
||||||
|
e2eskipper.Skipf("skipping GracefulNodeShutdown tests as we are running on an old version of systemd : %d", systemdVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
ginkgo.Context("graceful node shutdown when PodDisruptionConditions are enabled [NodeFeature:PodDisruptionConditions]", func() {
|
ginkgo.Context("graceful node shutdown when PodDisruptionConditions are enabled [NodeFeature:PodDisruptionConditions]", func() {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user