mirror of https://github.com/k3s-io/k3s
e2e_node: Disable auto restart on CoreOS.
parent
05951caa44
commit
d705cc5cf8
|
@ -22,6 +22,7 @@ import (
|
|||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
@ -65,6 +66,11 @@ var _ = BeforeSuite(func() {
|
|||
*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 {
|
||||
e2es = newE2eService(*nodeName)
|
||||
if err := e2es.start(); err != nil {
|
||||
|
@ -118,3 +124,16 @@ func (lr *LogReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) {
|
|||
b.WriteString("******************************************************\n")
|
||||
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