mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
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:
@@ -28,4 +28,5 @@ const (
|
|||||||
DefaultKubeletPluginContainersDirName = "plugin-containers"
|
DefaultKubeletPluginContainersDirName = "plugin-containers"
|
||||||
DefaultKubeletPodResourcesDirName = "pod-resources"
|
DefaultKubeletPodResourcesDirName = "pod-resources"
|
||||||
KubeletPluginsDirSELinuxLabel = "system_u:object_r:container_file_t:s0"
|
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
|
// 2. the pods directory
|
||||||
// 3. the plugins directory
|
// 3. the plugins directory
|
||||||
// 4. the pod-resources directory
|
// 4. the pod-resources directory
|
||||||
|
// 5. the checkpoint directory
|
||||||
func (kl *Kubelet) setupDataDirs() error {
|
func (kl *Kubelet) setupDataDirs() error {
|
||||||
kl.rootDirectory = path.Clean(kl.rootDirectory)
|
kl.rootDirectory = path.Clean(kl.rootDirectory)
|
||||||
pluginRegistrationDir := kl.getPluginsRegistrationDir()
|
pluginRegistrationDir := kl.getPluginsRegistrationDir()
|
||||||
@@ -1251,6 +1252,11 @@ func (kl *Kubelet) setupDataDirs() error {
|
|||||||
if err := os.MkdirAll(kl.getPodResourcesDir(), 0750); err != nil {
|
if err := os.MkdirAll(kl.getPodResourcesDir(), 0750); err != nil {
|
||||||
return fmt.Errorf("error creating podresources directory: %v", err)
|
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() {
|
if selinux.GetEnabled() {
|
||||||
err := selinux.SetFileLabel(pluginRegistrationDir, config.KubeletPluginsDirSELinuxLabel)
|
err := selinux.SetFileLabel(pluginRegistrationDir, config.KubeletPluginsDirSELinuxLabel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -77,6 +77,12 @@ func (kl *Kubelet) getPluginDir(pluginName string) string {
|
|||||||
return filepath.Join(kl.getPluginsDir(), pluginName)
|
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
|
// getVolumeDevicePluginsDir returns the full path to the directory under which plugin
|
||||||
// directories are created. Plugins can use these directories for data that
|
// directories are created. Plugins can use these directories for data that
|
||||||
// they need to persist. Plugins should create subdirectories under this named
|
// they need to persist. Plugins should create subdirectories under this named
|
||||||
|
Reference in New Issue
Block a user