mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Add containerize flag to avoid starting kubelet and collecting logs.
This commit is contained in:
parent
f7e0c6c19e
commit
13a50e3b97
@ -102,6 +102,8 @@ type TestContextType struct {
|
|||||||
type NodeTestContextType struct {
|
type NodeTestContextType struct {
|
||||||
// Name of the node to run tests on (node e2e suite only).
|
// Name of the node to run tests on (node e2e suite only).
|
||||||
NodeName string
|
NodeName string
|
||||||
|
// NodeConformance indicates whether the test is running in node conformance mode.
|
||||||
|
NodeConformance bool
|
||||||
// DisableKubenet disables kubenet when starting kubelet.
|
// DisableKubenet disables kubenet when starting kubelet.
|
||||||
DisableKubenet bool
|
DisableKubenet bool
|
||||||
// Whether to enable the QoS Cgroup Hierarchy or not
|
// Whether to enable the QoS Cgroup Hierarchy or not
|
||||||
@ -209,6 +211,13 @@ func RegisterClusterFlags() {
|
|||||||
// Register flags specific to the node e2e test suite.
|
// Register flags specific to the node e2e test suite.
|
||||||
func RegisterNodeFlags() {
|
func RegisterNodeFlags() {
|
||||||
flag.StringVar(&TestContext.NodeName, "node-name", "", "Name of the node to run tests on (node e2e suite only).")
|
flag.StringVar(&TestContext.NodeName, "node-name", "", "Name of the node to run tests on (node e2e suite only).")
|
||||||
|
// TODO(random-liu): Move kubelet start logic out of the test.
|
||||||
|
// TODO(random-liu): Move log fetch logic out of the test.
|
||||||
|
// There are different ways to start kubelet (systemd, initd, docker, rkt, manually started etc.)
|
||||||
|
// and manage logs (journald, upstart etc.).
|
||||||
|
// For different situation we need to mount different things into the container, run different commands.
|
||||||
|
// It is hard and unnecessary to deal with the complexity inside the test suite.
|
||||||
|
flag.BoolVar(&TestContext.NodeConformance, "conformance", false, "If true, the test suite will not start kubelet, and fetch system log (kernel, docker, kubelet log etc.) to the report directory.")
|
||||||
// TODO(random-liu): Remove kubelet related flags when we move the kubelet start logic out of the test.
|
// TODO(random-liu): Remove kubelet related flags when we move the kubelet start logic out of the test.
|
||||||
// TODO(random-liu): Find someway to get kubelet configuration, and automatic config and filter test based on the configuration.
|
// TODO(random-liu): Find someway to get kubelet configuration, and automatic config and filter test based on the configuration.
|
||||||
flag.BoolVar(&TestContext.DisableKubenet, "disable-kubenet", false, "If true, start kubelet without kubenet. (default false)")
|
flag.BoolVar(&TestContext.DisableKubenet, "disable-kubenet", false, "If true, start kubelet without kubenet. (default false)")
|
||||||
|
@ -78,6 +78,7 @@ func NewE2EServices(monitorParent bool) *E2EServices {
|
|||||||
// standard kubelet launcher)
|
// standard kubelet launcher)
|
||||||
func (e *E2EServices) Start() error {
|
func (e *E2EServices) Start() error {
|
||||||
var err error
|
var err error
|
||||||
|
if !framework.TestContext.NodeConformance {
|
||||||
// Start kubelet
|
// Start kubelet
|
||||||
// Create the manifest path for kubelet.
|
// Create the manifest path for kubelet.
|
||||||
// TODO(random-liu): Remove related logic when we move kubelet starting logic out of the test.
|
// TODO(random-liu): Remove related logic when we move kubelet starting logic out of the test.
|
||||||
@ -89,6 +90,7 @@ func (e *E2EServices) Start() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to start kubelet: %v", err)
|
return fmt.Errorf("failed to start kubelet: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
e.services, err = e.startInternalServices()
|
e.services, err = e.startInternalServices()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -96,6 +98,7 @@ func (e *E2EServices) Start() error {
|
|||||||
// Stop stops the e2e services.
|
// Stop stops the e2e services.
|
||||||
func (e *E2EServices) Stop() {
|
func (e *E2EServices) Stop() {
|
||||||
defer func() {
|
defer func() {
|
||||||
|
if !framework.TestContext.NodeConformance {
|
||||||
// Collect log files.
|
// Collect log files.
|
||||||
e.getLogFiles()
|
e.getLogFiles()
|
||||||
// Cleanup the manifest path for kubelet.
|
// Cleanup the manifest path for kubelet.
|
||||||
@ -106,6 +109,7 @@ func (e *E2EServices) Stop() {
|
|||||||
glog.Errorf("Failed to delete static pod manifest directory %s: %v", manifestPath, err)
|
glog.Errorf("Failed to delete static pod manifest directory %s: %v", manifestPath, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
if e.services != nil {
|
if e.services != nil {
|
||||||
if err := e.services.kill(); err != nil {
|
if err := e.services.kill(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user