mirror of https://github.com/k3s-io/k3s
parent
1d42fc9755
commit
483df6fd82
|
@ -8,6 +8,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
systemd "github.com/coreos/go-systemd/daemon"
|
systemd "github.com/coreos/go-systemd/daemon"
|
||||||
"github.com/docker/docker/pkg/reexec"
|
"github.com/docker/docker/pkg/reexec"
|
||||||
|
@ -67,6 +68,10 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
||||||
return runWithLogging(app, cfg)
|
return runWithLogging(app, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := checkUnixTimestamp(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
setupLogging(app)
|
setupLogging(app)
|
||||||
|
|
||||||
if !cfg.DisableAgent && os.Getuid() != 0 && !cfg.Rootless {
|
if !cfg.DisableAgent && os.Getuid() != 0 && !cfg.Rootless {
|
||||||
|
@ -180,3 +185,12 @@ func knownIPs(ips []string) []string {
|
||||||
}
|
}
|
||||||
return ips
|
return ips
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkUnixTimestamp() error {
|
||||||
|
timeNow := time.Now()
|
||||||
|
// check if time before 01/01/1980
|
||||||
|
if timeNow.Before(time.Unix(315532800, 0)) {
|
||||||
|
return fmt.Errorf("server time isn't set properly: %v", timeNow)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue