Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit f6437b4

Browse files
authored
Merge pull request #510 from Random-Liu/do-not-exit
Do not error out if uuid is not found.
2 parents 896cbd7 + dca0535 commit f6437b4

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

cmd/cri-containerd/options/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ type Config struct {
9696
ProfilingPort string `toml:"profiling_port" json:"profilingPort,omitempty"`
9797
// ProfilingAddress is address for profiling via host:port/debug/pprof/
9898
ProfilingAddress string `toml:"profiling_addr" json:"profilingAddress,omitempty"`
99+
// SkipImageFSUUID skips retrieving imagefs uuid.
100+
// TODO(random-liu): Remove this after we find a generic way to get imagefs uuid.
101+
SkipImageFSUUID bool `toml:"skip_imagefs_uuid" json:"skipImageFSUUID,omitempty"`
99102
}
100103

101104
// CRIContainerdOptions contains cri-containerd command line and toml options.
@@ -158,6 +161,8 @@ func (c *CRIContainerdOptions) AddFlags(fs *pflag.FlagSet) {
158161
defaults.ProfilingPort, "Profiling port for web interface host:port/debug/pprof/.")
159162
fs.StringVar(&c.ProfilingAddress, "profiling-addr",
160163
defaults.ProfilingAddress, "Profiling address for web interface host:port/debug/pprof/.")
164+
fs.BoolVar(&c.SkipImageFSUUID, "skip-imagefs-uuid",
165+
defaults.SkipImageFSUUID, "Skip retrieval of imagefs uuid. When turned on, kubelet will not be able to get imagefs capacity or perform imagefs disk eviction.")
161166
}
162167

163168
// InitFlags load configurations from config file, and then overwrite with flags.
@@ -228,5 +233,6 @@ func defaultConfig() Config {
228233
EnableProfiling: true,
229234
ProfilingPort: "10011",
230235
ProfilingAddress: "127.0.0.1",
236+
SkipImageFSUUID: false,
231237
}
232238
}

pkg/server/service.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,16 @@ func NewCRIContainerdService(config options.Config) (CRIContainerdService, error
134134
client: client,
135135
}
136136

137-
imageFSPath := imageFSPath(config.ContainerdConfig.RootDir, config.ContainerdConfig.Snapshotter)
138-
c.imageFSUUID, err = c.getDeviceUUID(imageFSPath)
139-
if err != nil {
140-
return nil, fmt.Errorf("failed to get imagefs uuid of %q: %v", imageFSPath, err)
137+
if !c.config.SkipImageFSUUID {
138+
imageFSPath := imageFSPath(config.ContainerdConfig.RootDir, config.ContainerdConfig.Snapshotter)
139+
c.imageFSUUID, err = c.getDeviceUUID(imageFSPath)
140+
if err != nil {
141+
return nil, fmt.Errorf("failed to get imagefs uuid of %q: %v", imageFSPath, err)
142+
}
143+
glog.V(2).Infof("Get device uuid %q for image filesystem %q", c.imageFSUUID, imageFSPath)
144+
} else {
145+
glog.Warning("Skip retrieving imagefs UUID, kubelet will not be able to get imagefs capacity or perform imagefs disk eviction.")
141146
}
142-
glog.V(2).Infof("Get device uuid %q for image filesystem %q", c.imageFSUUID, imageFSPath)
143147

144148
c.netPlugin, err = ocicni.InitCNI(config.NetworkPluginConfDir, config.NetworkPluginBinDir)
145149
if err != nil {

0 commit comments

Comments
 (0)