mirror of https://github.com/k3s-io/k3s
kubelet runonce: create data dirs
parent
643cb7a1c7
commit
81b9097a80
|
@ -18,6 +18,7 @@ package kubelet
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
@ -41,6 +42,18 @@ type RunPodResult struct {
|
|||
|
||||
// RunOnce polls from one configuration update and run the associated pods.
|
||||
func (kl *Kubelet) RunOnce(updates <-chan kubetypes.PodUpdate) ([]RunPodResult, error) {
|
||||
// Setup filesystem directories.
|
||||
if err := kl.setupDataDirs(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If the container logs directory does not exist, create it.
|
||||
if _, err := os.Stat(containerLogsDir); err != nil {
|
||||
if err := kl.os.Mkdir(containerLogsDir, 0755); err != nil {
|
||||
glog.Errorf("Failed to create directory %q: %v", containerLogsDir, err)
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case u := <-updates:
|
||||
glog.Infof("processing manifest with %d pods", len(u.Pods))
|
||||
|
|
Loading…
Reference in New Issue