mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
e2e_node: Disable auto restart on CoreOS.
This commit is contained in:
parent
05951caa44
commit
d705cc5cf8
@ -22,6 +22,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
@ -65,6 +66,11 @@ var _ = BeforeSuite(func() {
|
|||||||
*nodeName = strings.TrimSpace(fmt.Sprintf("%s", output))
|
*nodeName = strings.TrimSpace(fmt.Sprintf("%s", output))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(yifan): Temporary workaround to disable coreos from auto restart
|
||||||
|
// by masking the locksmithd.
|
||||||
|
// We should mask locksmithd when provisioning the machine.
|
||||||
|
maskLocksmithdOnCoreos()
|
||||||
|
|
||||||
if *startServices {
|
if *startServices {
|
||||||
e2es = newE2eService(*nodeName)
|
e2es = newE2eService(*nodeName)
|
||||||
if err := e2es.start(); err != nil {
|
if err := e2es.start(); err != nil {
|
||||||
@ -118,3 +124,16 @@ func (lr *LogReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) {
|
|||||||
b.WriteString("******************************************************\n")
|
b.WriteString("******************************************************\n")
|
||||||
glog.Infof(b.String())
|
glog.Infof(b.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func maskLocksmithdOnCoreos() {
|
||||||
|
data, err := ioutil.ReadFile("/etc/os-release")
|
||||||
|
if err != nil {
|
||||||
|
glog.Fatalf("Could not read /etc/os-release: %v", err)
|
||||||
|
}
|
||||||
|
if bytes.Contains(data, []byte("ID=coreos")) {
|
||||||
|
if output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput(); err != nil {
|
||||||
|
glog.Fatalf("Could not mask locksmithd: %v, output: %q", err, string(output))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glog.Infof("Locksmithd is masked successfully")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user