Merge pull request #510 from Random-Liu/do-not-exit

Do not error out if uuid is not found.
This commit is contained in:
Lantao Liu 2018-01-08 11:41:26 -08:00 committed by GitHub
commit f6437b44c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -96,6 +96,9 @@ type Config struct {
ProfilingPort string `toml:"profiling_port" json:"profilingPort,omitempty"` ProfilingPort string `toml:"profiling_port" json:"profilingPort,omitempty"`
// ProfilingAddress is address for profiling via host:port/debug/pprof/ // ProfilingAddress is address for profiling via host:port/debug/pprof/
ProfilingAddress string `toml:"profiling_addr" json:"profilingAddress,omitempty"` ProfilingAddress string `toml:"profiling_addr" json:"profilingAddress,omitempty"`
// SkipImageFSUUID skips retrieving imagefs uuid.
// TODO(random-liu): Remove this after we find a generic way to get imagefs uuid.
SkipImageFSUUID bool `toml:"skip_imagefs_uuid" json:"skipImageFSUUID,omitempty"`
} }
// CRIContainerdOptions contains cri-containerd command line and toml options. // CRIContainerdOptions contains cri-containerd command line and toml options.
@ -158,6 +161,8 @@ func (c *CRIContainerdOptions) AddFlags(fs *pflag.FlagSet) {
defaults.ProfilingPort, "Profiling port for web interface host:port/debug/pprof/.") defaults.ProfilingPort, "Profiling port for web interface host:port/debug/pprof/.")
fs.StringVar(&c.ProfilingAddress, "profiling-addr", fs.StringVar(&c.ProfilingAddress, "profiling-addr",
defaults.ProfilingAddress, "Profiling address for web interface host:port/debug/pprof/.") defaults.ProfilingAddress, "Profiling address for web interface host:port/debug/pprof/.")
fs.BoolVar(&c.SkipImageFSUUID, "skip-imagefs-uuid",
defaults.SkipImageFSUUID, "Skip retrieval of imagefs uuid. When turned on, kubelet will not be able to get imagefs capacity or perform imagefs disk eviction.")
} }
// InitFlags load configurations from config file, and then overwrite with flags. // InitFlags load configurations from config file, and then overwrite with flags.
@ -228,5 +233,6 @@ func defaultConfig() Config {
EnableProfiling: true, EnableProfiling: true,
ProfilingPort: "10011", ProfilingPort: "10011",
ProfilingAddress: "127.0.0.1", ProfilingAddress: "127.0.0.1",
SkipImageFSUUID: false,
} }
} }

View File

@ -134,12 +134,16 @@ func NewCRIContainerdService(config options.Config) (CRIContainerdService, error
client: client, client: client,
} }
if !c.config.SkipImageFSUUID {
imageFSPath := imageFSPath(config.ContainerdConfig.RootDir, config.ContainerdConfig.Snapshotter) imageFSPath := imageFSPath(config.ContainerdConfig.RootDir, config.ContainerdConfig.Snapshotter)
c.imageFSUUID, err = c.getDeviceUUID(imageFSPath) c.imageFSUUID, err = c.getDeviceUUID(imageFSPath)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to get imagefs uuid of %q: %v", imageFSPath, err) return nil, fmt.Errorf("failed to get imagefs uuid of %q: %v", imageFSPath, err)
} }
glog.V(2).Infof("Get device uuid %q for image filesystem %q", c.imageFSUUID, imageFSPath) glog.V(2).Infof("Get device uuid %q for image filesystem %q", c.imageFSUUID, imageFSPath)
} else {
glog.Warning("Skip retrieving imagefs UUID, kubelet will not be able to get imagefs capacity or perform imagefs disk eviction.")
}
c.netPlugin, err = ocicni.InitCNI(config.NetworkPluginConfDir, config.NetworkPluginBinDir) c.netPlugin, err = ocicni.InitCNI(config.NetworkPluginConfDir, config.NetworkPluginBinDir)
if err != nil { if err != nil {