Merge pull request #116351 from vinaykul/restart-free-pod-vertical-scaling-kubelet-fix-followup

Initialize pod resource allocation checkpoint manager to noop
This commit is contained in:
Kubernetes Prow Robot 2023-03-14 08:36:37 -07:00 committed by GitHub
commit 2bd69db8d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 0 deletions

View File

@ -177,3 +177,50 @@ func (sc *stateCheckpoint) ClearState() error {
sc.cache.ClearState()
return sc.storeState()
}
type noopStateCheckpoint struct{}
// NewNoopStateCheckpoint creates a dummy state checkpoint manager
func NewNoopStateCheckpoint() State {
return &noopStateCheckpoint{}
}
func (sc *noopStateCheckpoint) GetContainerResourceAllocation(_ string, _ string) (v1.ResourceList, bool) {
return nil, false
}
func (sc *noopStateCheckpoint) GetPodResourceAllocation() PodResourceAllocation {
return nil
}
func (sc *noopStateCheckpoint) GetPodResizeStatus(_ string) (v1.PodResizeStatus, bool) {
return "", false
}
func (sc *noopStateCheckpoint) GetResizeStatus() PodResizeStatus {
return nil
}
func (sc *noopStateCheckpoint) SetContainerResourceAllocation(_ string, _ string, _ v1.ResourceList) error {
return nil
}
func (sc *noopStateCheckpoint) SetPodResourceAllocation(_ PodResourceAllocation) error {
return nil
}
func (sc *noopStateCheckpoint) SetPodResizeStatus(_ string, _ v1.PodResizeStatus) error {
return nil
}
func (sc *noopStateCheckpoint) SetResizeStatus(_ PodResizeStatus) error {
return nil
}
func (sc *noopStateCheckpoint) Delete(_ string, _ string) error {
return nil
}
func (sc *noopStateCheckpoint) ClearState() error {
return nil
}

View File

@ -186,6 +186,9 @@ func isPodStatusByKubeletEqual(oldStatus, status *v1.PodStatus) bool {
}
func (m *manager) Start() {
// Initialize m.state to no-op state checkpoint manager
m.state = state.NewNoopStateCheckpoint()
// Create pod allocation checkpoint manager even if client is nil so as to allow local get/set of AllocatedResources & Resize
if utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {
stateImpl, err := state.NewStateCheckpoint(m.stateFileDirectory, podStatusManagerStateFile)