kubelet: add checkpoint/restore infrastructure
This adds the first infrastructure code parts to the kubelet to support checkpoint/restore. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
eeb5923937
commit
564f0e9a25
@ -28,4 +28,5 @@ const (
|
||||
DefaultKubeletPluginContainersDirName = "plugin-containers"
|
||||
DefaultKubeletPodResourcesDirName = "pod-resources"
|
||||
KubeletPluginsDirSELinuxLabel = "system_u:object_r:container_file_t:s0"
|
||||
DefaultKubeletCheckpointsDirName = "checkpoints"
|
||||
)
|
||||
|
@ -1229,6 +1229,7 @@ func (kl *Kubelet) RlimitStats() (*statsapi.RlimitStats, error) {
|
||||
// 2. the pods directory
|
||||
// 3. the plugins directory
|
||||
// 4. the pod-resources directory
|
||||
// 5. the checkpoint directory
|
||||
func (kl *Kubelet) setupDataDirs() error {
|
||||
kl.rootDirectory = path.Clean(kl.rootDirectory)
|
||||
pluginRegistrationDir := kl.getPluginsRegistrationDir()
|
||||
@ -1251,6 +1252,11 @@ func (kl *Kubelet) setupDataDirs() error {
|
||||
if err := os.MkdirAll(kl.getPodResourcesDir(), 0750); err != nil {
|
||||
return fmt.Errorf("error creating podresources directory: %v", err)
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ContainerCheckpoint) {
|
||||
if err := os.MkdirAll(kl.getCheckpointsDir(), 0700); err != nil {
|
||||
return fmt.Errorf("error creating checkpoint directory: %v", err)
|
||||
}
|
||||
}
|
||||
if selinux.GetEnabled() {
|
||||
err := selinux.SetFileLabel(pluginRegistrationDir, config.KubeletPluginsDirSELinuxLabel)
|
||||
if err != nil {
|
||||
|
@ -77,6 +77,12 @@ func (kl *Kubelet) getPluginDir(pluginName string) string {
|
||||
return filepath.Join(kl.getPluginsDir(), pluginName)
|
||||
}
|
||||
|
||||
// getCheckpointsDir returns a data directory name for checkpoints.
|
||||
// Checkpoints can be stored in this directory for further use.
|
||||
func (kl *Kubelet) getCheckpointsDir() string {
|
||||
return filepath.Join(kl.getRootDir(), config.DefaultKubeletCheckpointsDirName)
|
||||
}
|
||||
|
||||
// getVolumeDevicePluginsDir returns the full path to the directory under which plugin
|
||||
// directories are created. Plugins can use these directories for data that
|
||||
// they need to persist. Plugins should create subdirectories under this named
|
||||
|
Loading…
Reference in New Issue
Block a user